diff --git a/src/components/interactions/interactions.js b/src/components/interactions/interactions.js index 1f8a9de912938256d36b19167b13bfe5ae6f3702..cc31ff203d238bffccd7801da346ebdcc6a5ebf1 100644 --- a/src/components/interactions/interactions.js +++ b/src/components/interactions/interactions.js @@ -3,7 +3,8 @@ import Notifications from '../notifications/notifications.vue' const tabModeDict = { mentions: ['mention'], 'likes+repeats': ['repeat', 'like'], - follows: ['follow'] + follows: ['follow'], + moves: ['move'] } const Interactions = { diff --git a/src/components/interactions/interactions.vue b/src/components/interactions/interactions.vue index 08cee343021757a30d473d078cf86539e4777f85..a2e252ab1c34a53fd7df1473b332eb451505fb72 100644 --- a/src/components/interactions/interactions.vue +++ b/src/components/interactions/interactions.vue @@ -21,6 +21,10 @@ key="follows" :label="$t('interactions.follows')" /> + <span + key="moves" + :label="$t('interactions.moves')" + /> </tab-switcher> <Notifications ref="notifications" diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 7d46eb5aaa43f616ee863ca272660b14acdf50d4..e7bd769e05ace53e010194993769cb11b4a37bb0 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -43,18 +43,18 @@ const Notification = { const user = this.notification.from_profile return highlightStyle(highlight[user.screen_name]) }, - userInStore () { - return this.$store.getters.findUser(this.notification.from_profile.id) - }, user () { - if (this.userInStore) { - return this.userInStore - } - return this.notification.from_profile + return this.$store.getters.findUser(this.notification.from_profile.id) }, userProfileLink () { return this.generateUserProfileLink(this.user) }, + targetUser () { + return this.$store.getters.findUser(this.notification.target.id) + }, + targetUserProfileLink () { + return this.generateUserProfileLink(this.targetUser) + }, needMute () { return this.user.muted } diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 1f192c7709ccc2a9b37de8cf46f5db489a8dfa4b..16124e506d91bba5666e22ccccba7480fdd65e2a 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -74,9 +74,13 @@ <i class="fa icon-user-plus lit" /> <small>{{ $t('notifications.followed_you') }}</small> </span> + <span v-if="notification.type === 'move'"> + <i class="fa icon-arrow-curved lit" /> + <small>{{ $t('notifications.migrated_to') }}</small> + </span> </div> <div - v-if="notification.type === 'follow'" + v-if="notification.type === 'follow' || notification.type === 'move'" class="timeago" > <span class="faint"> @@ -115,6 +119,14 @@ @{{ notification.from_profile.screen_name }} </router-link> </div> + <div + v-else-if="notification.type === 'move'" + class="move-text" + > + <router-link :to="targetUserProfileLink"> + @{{ notification.target.screen_name }} + </router-link> + </div> <template v-else> <status class="faint" diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss index 71876b1451facd3e1c6f6b2f56dede3a3172b56c..148ac7f242f08d98f552649da9c9718fc2f745ea 100644 --- a/src/components/notifications/notifications.scss +++ b/src/components/notifications/notifications.scss @@ -76,7 +76,7 @@ } } - .follow-text { + .follow-text, .move-text { padding: 0.5em 0; } @@ -151,6 +151,11 @@ color: var(--cOrange, $fallback--cOrange); } + .icon-arrow-curved.lit { + color: $fallback--cBlue; + color: var(--cBlue, $fallback--cBlue); + } + .status-content { margin: 0; max-height: 300px; diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index b40c85dd2203c3ed26fe8c9fd4413dfae1a3c29c..cef492f350d2591453a91510b9b6b02a28e2961c 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -323,6 +323,11 @@ {{ $t('settings.notification_visibility_mentions') }} </Checkbox> </li> + <li> + <Checkbox v-model="notificationVisibility.moves"> + {{ $t('settings.notification_visibility_moves') }} + </Checkbox> + </li> </ul> </div> <div> diff --git a/src/i18n/en.json b/src/i18n/en.json index 60fc792fe2b8cf93a3075b7519766dfe61ae7e4a..75d66b9ff584bd0876826550e54bee25833ac9ca 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -110,7 +110,8 @@ "notifications": "Notifications", "read": "Read!", "repeated_you": "repeated your status", - "no_more_notifications": "No more notifications" + "no_more_notifications": "No more notifications", + "migrated_to": "migrated to" }, "polls": { "add_poll": "Add Poll", @@ -140,6 +141,7 @@ "interactions": { "favs_repeats": "Repeats and Favorites", "follows": "New follows", + "moves": "User migrates", "load_older": "Load older interactions" }, "post_status": { @@ -311,6 +313,7 @@ "notification_visibility_likes": "Likes", "notification_visibility_mentions": "Mentions", "notification_visibility_repeats": "Repeats", + "notification_visibility_moves": "User Migrates", "no_rich_text_description": "Strip rich text formatting from all posts", "no_blocks": "No blocks", "no_mutes": "No mutes", diff --git a/src/modules/config.js b/src/modules/config.js index 74025db1bd062552b45baa43a0df5e1b5260a90a..de9f041b0df91861cc61dc8826440338b85c2ca1 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -28,7 +28,8 @@ export const defaultState = { follows: true, mentions: true, likes: true, - repeats: true + repeats: true, + moves: true }, webPushNotifications: false, muteWords: [], diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 7d88761ca2c2324f09aa2689d85667225f45b31c..16dae8ce16eabc80f460dbe2275d4693c0da0f65 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -67,7 +67,8 @@ const visibleNotificationTypes = (rootState) => { rootState.config.notificationVisibility.likes && 'like', rootState.config.notificationVisibility.mentions && 'mention', rootState.config.notificationVisibility.repeats && 'repeat', - rootState.config.notificationVisibility.follows && 'follow' + rootState.config.notificationVisibility.follows && 'follow', + rootState.config.notificationVisibility.moves && 'move' ].filter(_ => _) } @@ -306,7 +307,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes, rootGetters }) => { each(notifications, (notification) => { - if (notification.type !== 'follow') { + if (notification.type !== 'follow' && notification.type !== 'move') { notification.action = addStatusToGlobalStorage(state, notification.action).item notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item } @@ -339,6 +340,9 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot case 'follow': i18nString = 'followed_you' break + case 'move': + i18nString = 'migrated_to' + break } if (i18nString) { diff --git a/src/modules/users.js b/src/modules/users.js index e54588df3f098f5329561360018628a51a0b460d..84fa0255526721ff142ee2fa7fec732029010f1a 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -373,8 +373,10 @@ const users = { }, addNewNotifications (store, { notifications }) { const users = map(notifications, 'from_profile') + const targetUsers = map(notifications, 'target') const notificationIds = notifications.map(_ => _.id) store.commit('addNewUsers', users) + store.commit('addNewUsers', targetUsers) const notificationsObject = store.rootState.statuses.notifications.idStore const relevantNotifications = Object.entries(notificationsObject) diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index ca79df6f6fd974a1e005b89b3106280df3c65d2f..ee007bee1246c24ad26f77dc7bdba705747523a6 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -341,10 +341,13 @@ export const parseNotification = (data) => { if (masto) { output.type = mastoDict[data.type] || data.type output.seen = data.pleroma.is_seen - output.status = output.type === 'follow' + output.status = output.type === 'follow' || output.type === 'move' ? null : parseStatus(data.status) output.action = output.status // TODO: Refactor, this is unneeded + output.target = output.type !== 'move' + ? null + : parseUser(data.target) output.from_profile = parseUser(data.account) } else { const parsedNotice = parseStatus(data.notice) diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index 7021adbdd2ec7ca5e0bb73af33a5a3e70423763a..b08514da00b0f63cbba9643d540fa70e2d61253c 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -6,7 +6,8 @@ export const visibleTypes = store => ([ store.state.config.notificationVisibility.likes && 'like', store.state.config.notificationVisibility.mentions && 'mention', store.state.config.notificationVisibility.repeats && 'repeat', - store.state.config.notificationVisibility.follows && 'follow' + store.state.config.notificationVisibility.follows && 'follow', + store.state.config.notificationVisibility.moves && 'move' ].filter(_ => _)) const sortById = (a, b) => { diff --git a/src/services/push/push.js b/src/services/push/push.js index 1b189a29339a79c3b31750403a1b12af29a539f5..5836fc262683adb0c776ceb2b0665e4fcac15fe7 100644 --- a/src/services/push/push.js +++ b/src/services/push/push.js @@ -65,7 +65,8 @@ function sendSubscriptionToBackEnd (subscription, token, notificationVisibility) follow: notificationVisibility.follows, favourite: notificationVisibility.likes, mention: notificationVisibility.mentions, - reblog: notificationVisibility.repeats + reblog: notificationVisibility.repeats, + move: notificationVisibility.moves } } }) diff --git a/static/fontello.json b/static/fontello.json index c1ed3393838699828ae0afe230e9fa411b3bd7d5..829241b55d8b7fac070b756e16b923eea2d51c93 100755 --- a/static/fontello.json +++ b/static/fontello.json @@ -333,6 +333,12 @@ "css": "login", "code": 59424, "src": "fontawesome" + }, + { + "uid": "f3ebd6751c15a280af5cc5f4a764187d", + "css": "arrow-curved", + "code": 59426, + "src": "iconic" } ] } \ No newline at end of file