From 0c646f71040b6d12f1d1aad3c9e4433f9cb9a667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AC=B4=EB=9D=BC=EC=BF=A0=EB=AA=A8?= Date: Sun, 7 Apr 2024 22:22:24 +0900 Subject: [PATCH] fix: direct message problem --- .../features/account_direct/index.jsx | 2 +- .../features/direct_messages/index.jsx | 70 +++++++++++++++++++ .../features/ui/util/async-components.js | 6 +- app/models/status.rb | 3 + 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 app/javascript/mastodon/features/direct_messages/index.jsx diff --git a/app/javascript/mastodon/features/account_direct/index.jsx b/app/javascript/mastodon/features/account_direct/index.jsx index 80c17db71..ca28aa1b4 100644 --- a/app/javascript/mastodon/features/account_direct/index.jsx +++ b/app/javascript/mastodon/features/account_direct/index.jsx @@ -164,7 +164,7 @@ class AccountTimeline extends ImmutablePureComponent { ({ + 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 ( + + + + + + + + ); + } + +} + +export default connect(mapStateToProps)(injectIntl(PinnedStatuses)); diff --git a/app/javascript/mastodon/features/ui/util/async-components.js b/app/javascript/mastodon/features/ui/util/async-components.js index f72ed934e..3d4089ffc 100644 --- a/app/javascript/mastodon/features/ui/util/async-components.js +++ b/app/javascript/mastodon/features/ui/util/async-components.js @@ -58,8 +58,12 @@ export function PinnedStatuses () { return import(/* webpackChunkName: "features/pinned_statuses" */'../../pinned_statuses'); } +export function SendDirectMessagesStatuses () { + return import(/* webpackChunkName: "features/direct_messages" */'../../direct_messages'); +} + export function AccountDirectMessages () { - return import(/* webpackChunkName: "features/pinned_statuses" */'../../account_direct'); + return import(/* webpackChunkName: "features/account_direct" */'../../account_direct'); } export function AccountTimeline () { diff --git a/app/models/status.rb b/app/models/status.rb index 52b79263d..62d33cb12 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -108,6 +108,9 @@ class Status < ApplicationRecord 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_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 :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)) }