From fd4bc05c31ddb912378f9df56ee045af592000f2 Mon Sep 17 00:00:00 2001 From: whippyshou Date: Mon, 30 Oct 2023 01:15:00 +0900 Subject: [PATCH] notificaiton / direct message --- .../status_container_without_dm.jsx | 1 - .../notifications/components/notification.jsx | 3 + .../notification_container_without_dm.js | 74 +++++++++++++++++++ .../mastodon/features/notifications/index.jsx | 17 ++++- app/javascript/mastodon/locales/ko.json | 2 +- 5 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 app/javascript/mastodon/features/notifications/containers/notification_container_without_dm.js diff --git a/app/javascript/mastodon/containers/status_container_without_dm.jsx b/app/javascript/mastodon/containers/status_container_without_dm.jsx index 415e9b6c5..547d28f23 100644 --- a/app/javascript/mastodon/containers/status_container_without_dm.jsx +++ b/app/javascript/mastodon/containers/status_container_without_dm.jsx @@ -67,7 +67,6 @@ const makeMapStateToProps = () => { const getPictureInPicture = makeGetPictureInPicture(); const mapStateToProps = (state, props) => ({ - //여기 status 바꿈 status: getStatus(state, props).get('visibility')!=='direct'? getStatus(state, props) : null, nextInReplyToId: props.nextId ? state.getIn(['statuses', props.nextId, 'in_reply_to_id']) : null, pictureInPicture: getPictureInPicture(state, props), diff --git a/app/javascript/mastodon/features/notifications/components/notification.jsx b/app/javascript/mastodon/features/notifications/components/notification.jsx index 43c5e85ce..1e851dbe5 100644 --- a/app/javascript/mastodon/features/notifications/components/notification.jsx +++ b/app/javascript/mastodon/features/notifications/components/notification.jsx @@ -425,6 +425,9 @@ class Notification extends ImmutablePureComponent { const displayNameHtml = { __html: account.get('display_name_html') }; const link = ; + if (!notification) + return null; + switch(notification.get('type')) { case 'follow': return this.renderFollow(notification, account, link); diff --git a/app/javascript/mastodon/features/notifications/containers/notification_container_without_dm.js b/app/javascript/mastodon/features/notifications/containers/notification_container_without_dm.js new file mode 100644 index 000000000..c59a8ebb4 --- /dev/null +++ b/app/javascript/mastodon/features/notifications/containers/notification_container_without_dm.js @@ -0,0 +1,74 @@ +import { connect } from 'react-redux'; + +import { initBoostModal } from '../../../actions/boosts'; +import { mentionCompose } from '../../../actions/compose'; +import { + reblog, + favourite, + unreblog, + unfavourite, +} from '../../../actions/interactions'; +import { + hideStatus, + revealStatus, +} from '../../../actions/statuses'; +import { boostModal } from '../../../initial_state'; +import { makeGetNotification, makeGetStatus, makeGetReport } from '../../../selectors'; +import Notification from '../components/notification'; + +const makeMapStateToProps = () => { + const getNotification = makeGetNotification(); + const getStatus = makeGetStatus(); + const getReport = makeGetReport(); + + const mapStateToProps = (state, props) => { + const notification = getNotification(state, props.notification, props.accountId); + return { + notification: (notification.get('status') && getStatus(state, { id: notification.get('status'), contextType: 'notifications' }).get('visibility')!=='direct') || notification.get('report') ? notification : null, + status: notification.get('status') ? getStatus(state, { id: notification.get('status'), contextType: 'notifications' }) : null, + report: notification.get('report') ? getReport(state, notification.get('report'), notification.getIn(['report', 'target_account', 'id'])) : null, + }; + }; + + return mapStateToProps; +}; + +const mapDispatchToProps = dispatch => ({ + onMention: (account, router) => { + dispatch(mentionCompose(account, router)); + }, + + onModalReblog (status, privacy) { + dispatch(reblog(status, privacy)); + }, + + onReblog (status, e) { + if (status.get('reblogged')) { + dispatch(unreblog(status)); + } else { + if (e.shiftKey || !boostModal) { + this.onModalReblog(status); + } else { + dispatch(initBoostModal({ status, onReblog: this.onModalReblog })); + } + } + }, + + onFavourite (status) { + if (status.get('favourited')) { + dispatch(unfavourite(status)); + } else { + dispatch(favourite(status)); + } + }, + + onToggleHidden (status) { + if (status.get('hidden')) { + dispatch(revealStatus(status.get('id'))); + } else { + dispatch(hideStatus(status.get('id'))); + } + }, +}); + +export default connect(makeMapStateToProps, mapDispatchToProps)(Notification); diff --git a/app/javascript/mastodon/features/notifications/index.jsx b/app/javascript/mastodon/features/notifications/index.jsx index 83734fec9..e15a596a7 100644 --- a/app/javascript/mastodon/features/notifications/index.jsx +++ b/app/javascript/mastodon/features/notifications/index.jsx @@ -35,6 +35,7 @@ import NotificationsPermissionBanner from './components/notifications_permission import ColumnSettingsContainer from './containers/column_settings_container'; import FilterBarContainer from './containers/filter_bar_container'; import NotificationContainer from './containers/notification_container'; +import NotificationContainerWithoutDm from './containers/notification_container_without_dm'; const messages = defineMessages({ title: { id: 'column.notifications', defaultMessage: 'Notifications' }, @@ -82,6 +83,7 @@ class Notifications extends PureComponent { }; static propTypes = { + allowedType: PropTypes.string, columnId: PropTypes.string, notifications: ImmutablePropTypes.list.isRequired, showFilterBar: PropTypes.bool.isRequired, @@ -187,7 +189,7 @@ class Notifications extends PureComponent { }; render () { - const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission, allwoType} = this.props; + const { intl, notifications, isLoading, isUnread, columnId, multiColumn, hasMore, numPending, showFilterBar, lastReadId, canMarkAsRead, needsNotificationPermission, allowedType} = this.props; const pinned = !!columnId; const emptyMessage = ; const { signedIn } = this.context.identity; @@ -209,7 +211,8 @@ class Notifications extends PureComponent { onClick={this.handleLoadGap} /> ) : ( - 0} /> + ) : ( + 0} + /> + ) )); } else { scrollableContent = null; diff --git a/app/javascript/mastodon/locales/ko.json b/app/javascript/mastodon/locales/ko.json index 7aba19906..2889d8d5b 100644 --- a/app/javascript/mastodon/locales/ko.json +++ b/app/javascript/mastodon/locales/ko.json @@ -222,7 +222,7 @@ "emoji_button.search_results": "검색 결과", "emoji_button.symbols": "기호", "emoji_button.travel": "여행과 장소", - "empty_column.visitor": "로그인 후 확인할 수 있습니다.", + "empty_column.visitor": "이 정보에 접근하려면 로그인을 해야 합니다.", "empty_column.account_suspended": "계정 정지됨", "empty_column.account_timeline": "이곳에는 게시물이 없습니다!", "empty_column.account_unavailable": "프로필 사용 불가",