1
0

fix: direct message problem

This commit is contained in:
オスカー、 2024-04-07 22:22:24 +09:00
parent fc596d372c
commit 0c646f7104
4 changed files with 79 additions and 2 deletions

View File

@ -164,7 +164,7 @@ class AccountTimeline extends ImmutablePureComponent {
<ColumnBackButton /> <ColumnBackButton />
<StatusList <StatusList
append={remoteMessage} append={remoteMessage}
scrollKey='account_timeline' scrollKey='account_direct'
statusIds={forceEmptyState ? emptyList : statusIds} statusIds={forceEmptyState ? emptyList : statusIds}
featuredStatusIds={featuredStatusIds} featuredStatusIds={featuredStatusIds}
isLoading={isLoading} isLoading={isLoading}

View File

@ -0,0 +1,70 @@
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import { Helmet } from 'react-helmet';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { getStatusList } from 'mastodon/selectors';
import { fetchDirectStatuses } from '../../actions/direct_statuses';
import { ColumnBackButton } from '../../components/column_back_button';
import StatusList from '../../components/status_list';
import Column from '../ui/components/column';
const messages = defineMessages({
heading: { id: 'column.pins', defaultMessage: 'Pinned post' },
});
const mapStateToProps = state => ({
statusIds: getStatusList(state, 'direct'),
hasMore: !!state.getIn(['status_lists', 'direct', 'next']),
});
class PinnedStatuses extends ImmutablePureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
intl: PropTypes.object.isRequired,
hasMore: PropTypes.bool.isRequired,
multiColumn: PropTypes.bool,
};
UNSAFE_componentWillMount () {
this.props.dispatch(fetchDirectStatuses());
}
handleHeaderClick = () => {
this.column.scrollTop();
};
setRef = c => {
this.column = c;
};
render () {
const { intl, statusIds, hasMore, multiColumn } = this.props;
return (
<Column bindToDocument={!multiColumn} icon='thumb-tack' heading={intl.formatMessage(messages.heading)} ref={this.setRef}>
<ColumnBackButton />
<StatusList
statusIds={statusIds}
scrollKey='direct_messages'
hasMore={hasMore}
bindToDocument={!multiColumn}
/>
<Helmet>
<meta name='robots' content='noindex' />
</Helmet>
</Column>
);
}
}
export default connect(mapStateToProps)(injectIntl(PinnedStatuses));

View File

@ -58,8 +58,12 @@ export function PinnedStatuses () {
return import(/* webpackChunkName: "features/pinned_statuses" */'../../pinned_statuses'); return import(/* webpackChunkName: "features/pinned_statuses" */'../../pinned_statuses');
} }
export function SendDirectMessagesStatuses () {
return import(/* webpackChunkName: "features/direct_messages" */'../../direct_messages');
}
export function AccountDirectMessages () { export function AccountDirectMessages () {
return import(/* webpackChunkName: "features/pinned_statuses" */'../../account_direct'); return import(/* webpackChunkName: "features/account_direct" */'../../account_direct');
} }
export function AccountTimeline () { export function AccountTimeline () {

View File

@ -108,6 +108,9 @@ class Status < ApplicationRecord
scope :with_accounts, ->(ids) { where(id: ids).includes(:account) } scope :with_accounts, ->(ids) { where(id: ids).includes(:account) }
scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') } scope :without_replies, -> { where('statuses.reply = FALSE OR statuses.in_reply_to_account_id = statuses.account_id') }
scope :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) } scope :without_reblogs, -> { where(statuses: { reblog_of_id: nil }) }
scope :with_public_visibility, -> { where(visibility: :public) }
scope :with_unlisted_visibility, -> { where(visibility: :unlisted) }
scope :with
scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) } scope :tagged_with, ->(tag_ids) { joins(:statuses_tags).where(statuses_tags: { tag_id: tag_ids }) }
scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) } scope :not_excluded_by_account, ->(account) { where.not(account_id: account.excluded_from_timeline_account_ids) }
scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).merge(Account.not_domain_blocked_by_account(account)) } scope :not_domain_blocked_by_account, ->(account) { account.excluded_from_timeline_domains.blank? ? left_outer_joins(:account) : left_outer_joins(:account).merge(Account.not_domain_blocked_by_account(account)) }