Merge branch 'fix-move-type-notification' into 'develop'
Fix for move type notification See merge request pleroma/pleroma-fe!1026
This commit is contained in:
commit
ad97e03b59
14 changed files with 65 additions and 17 deletions
|
@ -3,7 +3,8 @@ import Notifications from '../notifications/notifications.vue'
|
||||||
const tabModeDict = {
|
const tabModeDict = {
|
||||||
mentions: ['mention'],
|
mentions: ['mention'],
|
||||||
'likes+repeats': ['repeat', 'like'],
|
'likes+repeats': ['repeat', 'like'],
|
||||||
follows: ['follow']
|
follows: ['follow'],
|
||||||
|
moves: ['move']
|
||||||
}
|
}
|
||||||
|
|
||||||
const Interactions = {
|
const Interactions = {
|
||||||
|
|
|
@ -21,6 +21,10 @@
|
||||||
key="follows"
|
key="follows"
|
||||||
:label="$t('interactions.follows')"
|
:label="$t('interactions.follows')"
|
||||||
/>
|
/>
|
||||||
|
<span
|
||||||
|
key="moves"
|
||||||
|
:label="$t('interactions.moves')"
|
||||||
|
/>
|
||||||
</tab-switcher>
|
</tab-switcher>
|
||||||
<Notifications
|
<Notifications
|
||||||
ref="notifications"
|
ref="notifications"
|
||||||
|
|
|
@ -43,18 +43,18 @@ const Notification = {
|
||||||
const user = this.notification.from_profile
|
const user = this.notification.from_profile
|
||||||
return highlightStyle(highlight[user.screen_name])
|
return highlightStyle(highlight[user.screen_name])
|
||||||
},
|
},
|
||||||
userInStore () {
|
|
||||||
return this.$store.getters.findUser(this.notification.from_profile.id)
|
|
||||||
},
|
|
||||||
user () {
|
user () {
|
||||||
if (this.userInStore) {
|
return this.$store.getters.findUser(this.notification.from_profile.id)
|
||||||
return this.userInStore
|
|
||||||
}
|
|
||||||
return this.notification.from_profile
|
|
||||||
},
|
},
|
||||||
userProfileLink () {
|
userProfileLink () {
|
||||||
return this.generateUserProfileLink(this.user)
|
return this.generateUserProfileLink(this.user)
|
||||||
},
|
},
|
||||||
|
targetUser () {
|
||||||
|
return this.$store.getters.findUser(this.notification.target.id)
|
||||||
|
},
|
||||||
|
targetUserProfileLink () {
|
||||||
|
return this.generateUserProfileLink(this.targetUser)
|
||||||
|
},
|
||||||
needMute () {
|
needMute () {
|
||||||
return this.user.muted
|
return this.user.muted
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,9 +74,13 @@
|
||||||
<i class="fa icon-user-plus lit" />
|
<i class="fa icon-user-plus lit" />
|
||||||
<small>{{ $t('notifications.followed_you') }}</small>
|
<small>{{ $t('notifications.followed_you') }}</small>
|
||||||
</span>
|
</span>
|
||||||
|
<span v-if="notification.type === 'move'">
|
||||||
|
<i class="fa icon-arrow-curved lit" />
|
||||||
|
<small>{{ $t('notifications.migrated_to') }}</small>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="notification.type === 'follow'"
|
v-if="notification.type === 'follow' || notification.type === 'move'"
|
||||||
class="timeago"
|
class="timeago"
|
||||||
>
|
>
|
||||||
<span class="faint">
|
<span class="faint">
|
||||||
|
@ -115,6 +119,14 @@
|
||||||
@{{ notification.from_profile.screen_name }}
|
@{{ notification.from_profile.screen_name }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</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>
|
<template v-else>
|
||||||
<status
|
<status
|
||||||
class="faint"
|
class="faint"
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.follow-text {
|
.follow-text, .move-text {
|
||||||
padding: 0.5em 0;
|
padding: 0.5em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,11 @@
|
||||||
color: var(--cOrange, $fallback--cOrange);
|
color: var(--cOrange, $fallback--cOrange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-arrow-curved.lit {
|
||||||
|
color: $fallback--cBlue;
|
||||||
|
color: var(--cBlue, $fallback--cBlue);
|
||||||
|
}
|
||||||
|
|
||||||
.status-content {
|
.status-content {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
|
|
|
@ -323,6 +323,11 @@
|
||||||
{{ $t('settings.notification_visibility_mentions') }}
|
{{ $t('settings.notification_visibility_mentions') }}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<Checkbox v-model="notificationVisibility.moves">
|
||||||
|
{{ $t('settings.notification_visibility_moves') }}
|
||||||
|
</Checkbox>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -110,7 +110,8 @@
|
||||||
"notifications": "Notifications",
|
"notifications": "Notifications",
|
||||||
"read": "Read!",
|
"read": "Read!",
|
||||||
"repeated_you": "repeated your status",
|
"repeated_you": "repeated your status",
|
||||||
"no_more_notifications": "No more notifications"
|
"no_more_notifications": "No more notifications",
|
||||||
|
"migrated_to": "migrated to"
|
||||||
},
|
},
|
||||||
"polls": {
|
"polls": {
|
||||||
"add_poll": "Add Poll",
|
"add_poll": "Add Poll",
|
||||||
|
@ -140,6 +141,7 @@
|
||||||
"interactions": {
|
"interactions": {
|
||||||
"favs_repeats": "Repeats and Favorites",
|
"favs_repeats": "Repeats and Favorites",
|
||||||
"follows": "New follows",
|
"follows": "New follows",
|
||||||
|
"moves": "User migrates",
|
||||||
"load_older": "Load older interactions"
|
"load_older": "Load older interactions"
|
||||||
},
|
},
|
||||||
"post_status": {
|
"post_status": {
|
||||||
|
@ -311,6 +313,7 @@
|
||||||
"notification_visibility_likes": "Likes",
|
"notification_visibility_likes": "Likes",
|
||||||
"notification_visibility_mentions": "Mentions",
|
"notification_visibility_mentions": "Mentions",
|
||||||
"notification_visibility_repeats": "Repeats",
|
"notification_visibility_repeats": "Repeats",
|
||||||
|
"notification_visibility_moves": "User Migrates",
|
||||||
"no_rich_text_description": "Strip rich text formatting from all posts",
|
"no_rich_text_description": "Strip rich text formatting from all posts",
|
||||||
"no_blocks": "No blocks",
|
"no_blocks": "No blocks",
|
||||||
"no_mutes": "No mutes",
|
"no_mutes": "No mutes",
|
||||||
|
|
|
@ -28,7 +28,8 @@ export const defaultState = {
|
||||||
follows: true,
|
follows: true,
|
||||||
mentions: true,
|
mentions: true,
|
||||||
likes: true,
|
likes: true,
|
||||||
repeats: true
|
repeats: true,
|
||||||
|
moves: true
|
||||||
},
|
},
|
||||||
webPushNotifications: false,
|
webPushNotifications: false,
|
||||||
muteWords: [],
|
muteWords: [],
|
||||||
|
|
|
@ -67,7 +67,8 @@ const visibleNotificationTypes = (rootState) => {
|
||||||
rootState.config.notificationVisibility.likes && 'like',
|
rootState.config.notificationVisibility.likes && 'like',
|
||||||
rootState.config.notificationVisibility.mentions && 'mention',
|
rootState.config.notificationVisibility.mentions && 'mention',
|
||||||
rootState.config.notificationVisibility.repeats && 'repeat',
|
rootState.config.notificationVisibility.repeats && 'repeat',
|
||||||
rootState.config.notificationVisibility.follows && 'follow'
|
rootState.config.notificationVisibility.follows && 'follow',
|
||||||
|
rootState.config.notificationVisibility.moves && 'move'
|
||||||
].filter(_ => _)
|
].filter(_ => _)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +307,7 @@ const addNewStatuses = (state, { statuses, showImmediately = false, timeline, us
|
||||||
|
|
||||||
const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes, rootGetters }) => {
|
const addNewNotifications = (state, { dispatch, notifications, older, visibleNotificationTypes, rootGetters }) => {
|
||||||
each(notifications, (notification) => {
|
each(notifications, (notification) => {
|
||||||
if (notification.type !== 'follow') {
|
if (notification.type !== 'follow' && notification.type !== 'move') {
|
||||||
notification.action = addStatusToGlobalStorage(state, notification.action).item
|
notification.action = addStatusToGlobalStorage(state, notification.action).item
|
||||||
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
||||||
}
|
}
|
||||||
|
@ -339,6 +340,9 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
||||||
case 'follow':
|
case 'follow':
|
||||||
i18nString = 'followed_you'
|
i18nString = 'followed_you'
|
||||||
break
|
break
|
||||||
|
case 'move':
|
||||||
|
i18nString = 'migrated_to'
|
||||||
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i18nString) {
|
if (i18nString) {
|
||||||
|
|
|
@ -373,8 +373,10 @@ const users = {
|
||||||
},
|
},
|
||||||
addNewNotifications (store, { notifications }) {
|
addNewNotifications (store, { notifications }) {
|
||||||
const users = map(notifications, 'from_profile')
|
const users = map(notifications, 'from_profile')
|
||||||
|
const targetUsers = map(notifications, 'target')
|
||||||
const notificationIds = notifications.map(_ => _.id)
|
const notificationIds = notifications.map(_ => _.id)
|
||||||
store.commit('addNewUsers', users)
|
store.commit('addNewUsers', users)
|
||||||
|
store.commit('addNewUsers', targetUsers)
|
||||||
|
|
||||||
const notificationsObject = store.rootState.statuses.notifications.idStore
|
const notificationsObject = store.rootState.statuses.notifications.idStore
|
||||||
const relevantNotifications = Object.entries(notificationsObject)
|
const relevantNotifications = Object.entries(notificationsObject)
|
||||||
|
|
|
@ -341,10 +341,13 @@ export const parseNotification = (data) => {
|
||||||
if (masto) {
|
if (masto) {
|
||||||
output.type = mastoDict[data.type] || data.type
|
output.type = mastoDict[data.type] || data.type
|
||||||
output.seen = data.pleroma.is_seen
|
output.seen = data.pleroma.is_seen
|
||||||
output.status = output.type === 'follow'
|
output.status = output.type === 'follow' || output.type === 'move'
|
||||||
? null
|
? null
|
||||||
: parseStatus(data.status)
|
: parseStatus(data.status)
|
||||||
output.action = output.status // TODO: Refactor, this is unneeded
|
output.action = output.status // TODO: Refactor, this is unneeded
|
||||||
|
output.target = output.type !== 'move'
|
||||||
|
? null
|
||||||
|
: parseUser(data.target)
|
||||||
output.from_profile = parseUser(data.account)
|
output.from_profile = parseUser(data.account)
|
||||||
} else {
|
} else {
|
||||||
const parsedNotice = parseStatus(data.notice)
|
const parsedNotice = parseStatus(data.notice)
|
||||||
|
|
|
@ -6,7 +6,8 @@ export const visibleTypes = store => ([
|
||||||
store.state.config.notificationVisibility.likes && 'like',
|
store.state.config.notificationVisibility.likes && 'like',
|
||||||
store.state.config.notificationVisibility.mentions && 'mention',
|
store.state.config.notificationVisibility.mentions && 'mention',
|
||||||
store.state.config.notificationVisibility.repeats && 'repeat',
|
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(_ => _))
|
].filter(_ => _))
|
||||||
|
|
||||||
const sortById = (a, b) => {
|
const sortById = (a, b) => {
|
||||||
|
|
|
@ -65,7 +65,8 @@ function sendSubscriptionToBackEnd (subscription, token, notificationVisibility)
|
||||||
follow: notificationVisibility.follows,
|
follow: notificationVisibility.follows,
|
||||||
favourite: notificationVisibility.likes,
|
favourite: notificationVisibility.likes,
|
||||||
mention: notificationVisibility.mentions,
|
mention: notificationVisibility.mentions,
|
||||||
reblog: notificationVisibility.repeats
|
reblog: notificationVisibility.repeats,
|
||||||
|
move: notificationVisibility.moves
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -333,6 +333,12 @@
|
||||||
"css": "login",
|
"css": "login",
|
||||||
"code": 59424,
|
"code": 59424,
|
||||||
"src": "fontawesome"
|
"src": "fontawesome"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"uid": "f3ebd6751c15a280af5cc5f4a764187d",
|
||||||
|
"css": "arrow-curved",
|
||||||
|
"code": 59426,
|
||||||
|
"src": "iconic"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in a new issue