From 6bb75a3a6d8452a3e1b88085fe87cf27386f222c Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 21 Apr 2020 23:27:51 +0300 Subject: make relationships separate from users --- src/components/notification/notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index e7bd769e..09554f54 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -56,7 +56,7 @@ const Notification = { return this.generateUserProfileLink(this.targetUser) }, needMute () { - return this.user.muted + return (this.$store.state.users.relationships[this.user.id] || {}).muting } } } -- cgit v1.2.3-70-g09d2 From af9492977aaa10903d54add3187b5cf9d9a00d6c Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Fri, 24 Apr 2020 18:53:17 +0300 Subject: add back mute prediction, add getter for relationships --- src/components/block_card/block_card.js | 2 +- src/components/follow_card/follow_card.js | 2 +- src/components/mute_card/mute_card.js | 2 +- src/components/notification/notification.js | 2 +- src/components/status/status.js | 2 +- src/components/user_card/user_card.js | 2 +- src/components/user_settings/user_settings.js | 4 ++-- src/modules/users.js | 12 ++++++++++++ test/unit/specs/components/user_profile.spec.js | 1 + 9 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/block_card/block_card.js b/src/components/block_card/block_card.js index 659c75d8..0bf4e37b 100644 --- a/src/components/block_card/block_card.js +++ b/src/components/block_card/block_card.js @@ -12,7 +12,7 @@ const BlockCard = { return this.$store.getters.findUser(this.userId) }, relationship () { - return this.$store.state.users.relationships[this.userId] || {} + return this.$store.getters.relationship(this.userId) }, blocked () { return this.relationship.blocking diff --git a/src/components/follow_card/follow_card.js b/src/components/follow_card/follow_card.js index 620ae7fd..6dcb6d47 100644 --- a/src/components/follow_card/follow_card.js +++ b/src/components/follow_card/follow_card.js @@ -20,7 +20,7 @@ const FollowCard = { return this.$store.state.users.currentUser }, relationship () { - return this.$store.state.users.relationships[this.user.id] + return this.$store.getters.relationship(this.user.id) } } } diff --git a/src/components/mute_card/mute_card.js b/src/components/mute_card/mute_card.js index be528d37..cbec0e9b 100644 --- a/src/components/mute_card/mute_card.js +++ b/src/components/mute_card/mute_card.js @@ -12,7 +12,7 @@ const MuteCard = { return this.$store.getters.findUser(this.userId) }, relationship () { - return this.$store.state.users.relationships[this.userId] + return this.$store.getters.relationship(this.userId) }, muted () { return this.relationship.muting diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 09554f54..ff1c2817 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -56,7 +56,7 @@ const Notification = { return this.generateUserProfileLink(this.targetUser) }, needMute () { - return (this.$store.state.users.relationships[this.user.id] || {}).muting + return this.$store.getters.relationship(this.user.id).muting } } } diff --git a/src/components/status/status.js b/src/components/status/status.js index a73e3ae2..a36de028 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -119,7 +119,7 @@ const Status = { return hits }, muted () { - const relationship = this.$store.state.users.relationships[this.status.user.id] || {} + const relationship = this.$store.getters.relationship(this.userId) return !this.unmuted && ( (!(this.inProfile && this.status.user.id === this.profileUserId) && relationship.muting) || (!this.inConversation && this.status.thread_muted) || diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index fb3cfebc..8e6b9d7f 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -25,7 +25,7 @@ export default { return this.$store.getters.findUser(this.userId) }, relationship () { - return this.$store.state.users.relationships[this.userId] || {} + return this.$store.getters.relationship(this.userId) }, classes () { return [{ diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index adfab8fa..5338c974 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -351,13 +351,13 @@ const UserSettings = { }, filterUnblockedUsers (userIds) { return reject(userIds, (userId) => { - const relationship = this.$store.state.users.relationships[userId] || {} + const relationship = this.$store.getters.relationship(this.userId) return relationship.blocking || userId === this.$store.state.users.currentUser.id }) }, filterUnMutedUsers (userIds) { return reject(userIds, (userId) => { - const relationship = this.$store.state.users.relationships[userId] || {} + const relationship = this.$store.getters.relationship(this.userId) return relationship.muting || userId === this.$store.state.users.currentUser.id }) }, diff --git a/src/modules/users.js b/src/modules/users.js index 6b19fc97..fb04ebd3 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -48,6 +48,11 @@ const unblockUser = (store, id) => { } const muteUser = (store, id) => { + const predictedRelationship = store.state.relationships[id] || { id } + predictedRelationship.muting = true + store.commit('updateUserRelationship', [predictedRelationship]) + store.commit('addMuteId', id) + return store.rootState.api.backendInteractor.muteUser({ id }) .then((relationship) => { store.commit('updateUserRelationship', [relationship]) @@ -56,6 +61,10 @@ const muteUser = (store, id) => { } const unmuteUser = (store, id) => { + const predictedRelationship = store.state.relationships[id] || { id } + predictedRelationship.muting = false + store.commit('updateUserRelationship', [predictedRelationship]) + return store.rootState.api.backendInteractor.unmuteUser({ id }) .then((relationship) => store.commit('updateUserRelationship', [relationship])) } @@ -227,6 +236,9 @@ export const getters = { return state.usersObject[query.toLowerCase()] } return result + }, + relationship: state => id => { + return state.relationships[id] || { id, loading: true } } } diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js index 0a3f2d27..dcf066f9 100644 --- a/test/unit/specs/components/user_profile.spec.js +++ b/test/unit/specs/components/user_profile.spec.js @@ -19,6 +19,7 @@ const actions = { const testGetters = { findUser: state => getters.findUser(state.users), + relationship: state => getters.relationship(state.users), mergedConfig: state => ({ colors: '', highlight: {}, -- cgit v1.2.3-70-g09d2 From 01b07f01e9340935faf51e5a3c8034cc90423989 Mon Sep 17 00:00:00 2001 From: eugenijm Date: Sat, 25 Apr 2020 07:04:39 +0300 Subject: Add support for follow request notifications --- CHANGELOG.md | 3 ++ src/components/notification/notification.js | 19 ++++++++++ src/components/notification/notification.vue | 44 ++++++++++++++++------ src/components/notifications/notifications.scss | 15 ++++++++ src/i18n/en.json | 5 ++- src/modules/config.js | 3 +- src/modules/statuses.js | 22 ++++++++++- src/services/api/api.service.js | 11 ++++++ .../entity_normalizer/entity_normalizer.service.js | 5 +-- .../notification_utils/notification_utils.js | 7 +++- static/fontello.json | 14 ++++++- 11 files changed, 128 insertions(+), 20 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/CHANGELOG.md b/CHANGELOG.md index f45561d0..685fe629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed - Emoji autocomplete will match any part of the word and not just start, for example :drool will now helpfully suggest :blobcatdrool: and :blobcatdroolreach: +### Add +- Follow request notification support + ## [2.0.2] - 2020-04-08 ### Fixed - Favorite/Repeat avatars not showing up on private instances/non-public posts diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index e7bd769e..6deee7d5 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -2,6 +2,7 @@ import Status from '../status/status.vue' import UserAvatar from '../user_avatar/user_avatar.vue' import UserCard from '../user_card/user_card.vue' import Timeago from '../timeago/timeago.vue' +import { isStatusNotification } from '../../services/notification_utils/notification_utils.js' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' @@ -32,6 +33,21 @@ const Notification = { }, toggleMute () { this.unmuted = !this.unmuted + }, + approveUser () { + this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) + this.$store.dispatch('removeFollowRequest', this.user) + this.$store.dispatch('updateNotification', { + id: this.notification.id, + updater: notification => { + notification.type = 'follow' + } + }) + }, + denyUser () { + this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) + this.$store.dispatch('removeFollowRequest', this.user) + this.$store.dispatch('dismissNotification', { id: this.notification.id }) } }, computed: { @@ -57,6 +73,9 @@ const Notification = { }, needMute () { return this.user.muted + }, + isStatusNotification () { + return isStatusNotification(this.notification.type) } } } diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 51875747..02802776 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -74,6 +74,10 @@ {{ $t('notifications.followed_you') }} + + + {{ $t('notifications.follow_request') }} + {{ $t('notifications.migrated_to') }} @@ -87,30 +91,30 @@
- + - +
- + - +
{ each(notifications, (notification) => { - if (notification.type !== 'follow' && notification.type !== 'move') { + if (isStatusNotification(notification.type)) { notification.action = addStatusToGlobalStorage(state, notification.action).item notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item } @@ -361,13 +362,16 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot case 'move': i18nString = 'migrated_to' break + case 'follow_request': + i18nString = 'follow_request' + break } if (notification.type === 'pleroma:emoji_reaction') { notifObj.body = rootGetters.i18n.t('notifications.reacted_with', [notification.emoji]) } else if (i18nString) { notifObj.body = rootGetters.i18n.t('notifications.' + i18nString) - } else { + } else if (isStatusNotification(notification.type)) { notifObj.body = notification.status.text } @@ -521,6 +525,13 @@ export const mutations = { notification.seen = true }) }, + dismissNotification (state, { id }) { + state.notifications.data = state.notifications.data.filter(n => n.id !== id) + }, + updateNotification (state, { id, updater }) { + const notification = find(state.notifications.data, n => n.id === id) + notification && updater(notification) + }, queueFlush (state, { timeline, id }) { state.timelines[timeline].flushMarker = id }, @@ -680,6 +691,13 @@ const statuses = { credentials: rootState.users.currentUser.credentials }) }, + dismissNotification ({ rootState, commit }, { id }) { + rootState.api.backendInteractor.dismissNotification({ id }) + .then(() => commit('dismissNotification', { id })) + }, + updateNotification ({ rootState, commit }, { id, updater }) { + commit('updateNotification', { id, updater }) + }, fetchFavsAndRepeats ({ rootState, commit }, id) { Promise.all([ rootState.api.backendInteractor.fetchFavoritedByUsers({ id }), diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index ad2b2ad5..cda61ee2 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -29,6 +29,7 @@ const MASTODON_LOGIN_URL = '/api/v1/accounts/verify_credentials' const MASTODON_REGISTRATION_URL = '/api/v1/accounts' const MASTODON_USER_FAVORITES_TIMELINE_URL = '/api/v1/favourites' const MASTODON_USER_NOTIFICATIONS_URL = '/api/v1/notifications' +const MASTODON_DISMISS_NOTIFICATION_URL = id => `/api/v1/notifications/${id}/dismiss` const MASTODON_FAVORITE_URL = id => `/api/v1/statuses/${id}/favourite` const MASTODON_UNFAVORITE_URL = id => `/api/v1/statuses/${id}/unfavourite` const MASTODON_RETWEET_URL = id => `/api/v1/statuses/${id}/reblog` @@ -1010,6 +1011,15 @@ const unmuteDomain = ({ domain, credentials }) => { }) } +const dismissNotification = ({ credentials, id }) => { + return promisedRequest({ + url: MASTODON_DISMISS_NOTIFICATION_URL(id), + method: 'POST', + payload: { id }, + credentials + }) +} + export const getMastodonSocketURI = ({ credentials, stream, args = {} }) => { return Object.entries({ ...(credentials @@ -1165,6 +1175,7 @@ const apiService = { denyUser, suggestions, markNotificationsAsSeen, + dismissNotification, vote, fetchPoll, fetchFavoritedByUsers, diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js index 84169a7b..6cacd0b8 100644 --- a/src/services/entity_normalizer/entity_normalizer.service.js +++ b/src/services/entity_normalizer/entity_normalizer.service.js @@ -1,4 +1,5 @@ import escape from 'escape-html' +import { isStatusNotification } from '../notification_utils/notification_utils.js' const qvitterStatusType = (status) => { if (status.is_post_verb) { @@ -346,9 +347,7 @@ 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.type === 'move' - ? null - : parseStatus(data.status) + output.status = isStatusNotification(output.type) ? parseStatus(data.status) : null output.action = output.status // TODO: Refactor, this is unneeded output.target = output.type !== 'move' ? null diff --git a/src/services/notification_utils/notification_utils.js b/src/services/notification_utils/notification_utils.js index b17bd7bf..eb479227 100644 --- a/src/services/notification_utils/notification_utils.js +++ b/src/services/notification_utils/notification_utils.js @@ -1,4 +1,4 @@ -import { filter, sortBy } from 'lodash' +import { filter, sortBy, includes } from 'lodash' export const notificationsFromStore = store => store.state.statuses.notifications.data @@ -7,10 +7,15 @@ export const visibleTypes = store => ([ store.state.config.notificationVisibility.mentions && 'mention', store.state.config.notificationVisibility.repeats && 'repeat', store.state.config.notificationVisibility.follows && 'follow', + store.state.config.notificationVisibility.followRequest && 'follow_request', store.state.config.notificationVisibility.moves && 'move', store.state.config.notificationVisibility.emojiReactions && 'pleroma:emoji_reaction' ].filter(_ => _)) +const statusNotifications = ['like', 'mention', 'repeat', 'pleroma:emoji_reaction'] + +export const isStatusNotification = (type) => includes(statusNotifications, type) + const sortById = (a, b) => { const seqA = Number(a.id) const seqB = Number(b.id) diff --git a/static/fontello.json b/static/fontello.json index 5a7086a2..5963b68b 100755 --- a/static/fontello.json +++ b/static/fontello.json @@ -345,6 +345,18 @@ "css": "link", "code": 59427, "src": "fontawesome" + }, + { + "uid": "8b80d36d4ef43889db10bc1f0dc9a862", + "css": "user", + "code": 59428, + "src": "fontawesome" + }, + { + "uid": "12f4ece88e46abd864e40b35e05b11cd", + "css": "ok", + "code": 59431, + "src": "fontawesome" } ] -} +} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From 406fdd8edec210d14589e0ff684a166250236779 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 2 May 2020 10:19:47 +0300 Subject: follow request bugfixes, wrong text, notifs not being marked as read, approving from follow request view --- .../follow_request_card/follow_request_card.js | 19 +++++++++++++++++++ src/components/notification/notification.js | 1 + src/components/notification/notification.vue | 6 +++--- src/components/notifications/notifications.scss | 19 +++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index a8931787..2a9d3db5 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -1,4 +1,5 @@ import BasicUserCard from '../basic_user_card/basic_user_card.vue' +import { notificationsFromStore } from '../../services/notification_utils/notification_utils.js' const FollowRequestCard = { props: ['user'], @@ -6,13 +7,31 @@ const FollowRequestCard = { BasicUserCard }, methods: { + findFollowRequestNotificationId () { + const notif = notificationsFromStore(this.$store).find( + (notif) => notif.from_profile.id === this.user.id && notif.type === 'follow_request' + ) + return notif && notif.id + }, approveUser () { this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) + + const notifId = this.findFollowRequestNotificationId() + this.$store.dispatch('updateNotification', { + id: notifId, + updater: notification => { + notification.type = 'follow' + notification.seen = true + } + }) }, denyUser () { this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) + + const notifId = this.findFollowRequestNotificationId() + this.$store.dispatch('dismissNotification', { id: notifId }) } } } diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 6deee7d5..8c20ff09 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -41,6 +41,7 @@ const Notification = { id: this.notification.id, updater: notification => { notification.type = 'follow' + notification.seen = true } }) }, diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 02802776..f6da07dd 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -137,13 +137,13 @@ style="white-space: nowrap;" >
diff --git a/src/components/notifications/notifications.scss b/src/components/notifications/notifications.scss index 80dad28b..9efcfcf8 100644 --- a/src/components/notifications/notifications.scss +++ b/src/components/notifications/notifications.scss @@ -79,6 +79,25 @@ } } + .follow-request-accept { + cursor: pointer; + + &:hover { + color: $fallback--text; + color: var(--text, $fallback--text); + } + } + + .follow-request-reject { + cursor: pointer; + + &:hover { + color: $fallback--cRed; + color: var(--cRed, $fallback--cRed); + } + } + + .follow-text, .move-text { padding: 0.5em 0; overflow-wrap: break-word; -- cgit v1.2.3-70-g09d2 From 75519223f9a715aacb99d3780ee681089a479292 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 2 May 2020 10:52:57 +0300 Subject: mark single notifs as seen properly on server --- src/components/follow_request_card/follow_request_card.js | 2 +- src/components/notification/notification.js | 2 +- src/modules/statuses.js | 12 ++++++++++++ src/services/api/api.service.js | 12 ++++++++---- 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index 2a9d3db5..33e2699e 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -18,11 +18,11 @@ const FollowRequestCard = { this.$store.dispatch('removeFollowRequest', this.user) const notifId = this.findFollowRequestNotificationId() + this.$store.dispatch('markSingleNotificationAsSeen', { id: notifId }) this.$store.dispatch('updateNotification', { id: notifId, updater: notification => { notification.type = 'follow' - notification.seen = true } }) }, diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 8c20ff09..abe3bebe 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -37,11 +37,11 @@ const Notification = { approveUser () { this.$store.state.api.backendInteractor.approveUser({ id: this.user.id }) this.$store.dispatch('removeFollowRequest', this.user) + this.$store.dispatch('markSingleNotificationAsSeen', { id: this.notification.id }) this.$store.dispatch('updateNotification', { id: this.notification.id, updater: notification => { notification.type = 'follow' - notification.seen = true } }) }, diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 239f41eb..2a8b9581 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -525,6 +525,10 @@ export const mutations = { notification.seen = true }) }, + markSingleNotificationAsSeen (state, { id }) { + const notification = find(state.notifications.data, n => n.id === id) + if (notification) notification.seen = true + }, dismissNotification (state, { id }) { state.notifications.data = state.notifications.data.filter(n => n.id !== id) }, @@ -691,6 +695,14 @@ const statuses = { credentials: rootState.users.currentUser.credentials }) }, + markSingleNotificationAsSeen ({ rootState, commit }, { id }) { + commit('markSingleNotificationAsSeen', { id }) + apiService.markNotificationsAsSeen({ + single: true, + id, + credentials: rootState.users.currentUser.credentials + }) + }, dismissNotification ({ rootState, commit }, { id }) { rootState.api.backendInteractor.dismissNotification({ id }) .then(() => commit('dismissNotification', { id })) diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index 3a58c38d..72c8874f 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -4,7 +4,6 @@ import 'whatwg-fetch' import { RegistrationError, StatusCodeError } from '../errors/errors' /* eslint-env browser */ -const QVITTER_USER_NOTIFICATIONS_READ_URL = '/api/qvitter/statuses/notifications/read.json' const BLOCKS_IMPORT_URL = '/api/pleroma/blocks_import' const FOLLOW_IMPORT_URL = '/api/pleroma/follow_import' const DELETE_ACCOUNT_URL = '/api/pleroma/delete_account' @@ -17,6 +16,7 @@ const DEACTIVATE_USER_URL = '/api/pleroma/admin/users/deactivate' const ADMIN_USERS_URL = '/api/pleroma/admin/users' const SUGGESTIONS_URL = '/api/v1/suggestions' const NOTIFICATION_SETTINGS_URL = '/api/pleroma/notification_settings' +const NOTIFICATION_READ_URL = '/api/v1/pleroma/notifications/read' const MFA_SETTINGS_URL = '/api/pleroma/accounts/mfa' const MFA_BACKUP_CODES_URL = '/api/pleroma/accounts/mfa/backup_codes' @@ -841,12 +841,16 @@ const suggestions = ({ credentials }) => { }).then((data) => data.json()) } -const markNotificationsAsSeen = ({ id, credentials }) => { +const markNotificationsAsSeen = ({ id, credentials, single = false }) => { const body = new FormData() - body.append('latest_id', id) + if (single) { + body.append('id', id) + } else { + body.append('max_id', id) + } - return fetch(QVITTER_USER_NOTIFICATIONS_READ_URL, { + return fetch(NOTIFICATION_READ_URL, { body, headers: authHeaders(credentials), method: 'POST' -- cgit v1.2.3-70-g09d2 From 92ccaa97bb0a2c15b96e2fbcf03823ba902dc516 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Sat, 2 May 2020 11:51:39 +0300 Subject: don't dismiss a rejected follow request on server --- src/components/follow_request_card/follow_request_card.js | 9 +++++---- src/components/notification/notification.js | 6 ++++-- src/modules/statuses.js | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/follow_request_card/follow_request_card.js b/src/components/follow_request_card/follow_request_card.js index 33e2699e..cbd75311 100644 --- a/src/components/follow_request_card/follow_request_card.js +++ b/src/components/follow_request_card/follow_request_card.js @@ -27,11 +27,12 @@ const FollowRequestCard = { }) }, denyUser () { - this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) - this.$store.dispatch('removeFollowRequest', this.user) - const notifId = this.findFollowRequestNotificationId() - this.$store.dispatch('dismissNotification', { id: notifId }) + this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) + .then(() => { + this.$store.dispatch('dismissNotificationLocal', { id: notifId }) + this.$store.dispatch('removeFollowRequest', this.user) + }) } } } diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index abe3bebe..1ae81ce4 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -47,8 +47,10 @@ const Notification = { }, denyUser () { this.$store.state.api.backendInteractor.denyUser({ id: this.user.id }) - this.$store.dispatch('removeFollowRequest', this.user) - this.$store.dispatch('dismissNotification', { id: this.notification.id }) + .then(() => { + this.$store.dispatch('dismissNotificationLocal', { id: this.notification.id }) + this.$store.dispatch('removeFollowRequest', this.user) + }) } }, computed: { diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 2a8b9581..cd8c1dba 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -703,9 +703,12 @@ const statuses = { credentials: rootState.users.currentUser.credentials }) }, + dismissNotificationLocal ({ rootState, commit }, { id }) { + commit('dismissNotification', { id }) + }, dismissNotification ({ rootState, commit }, { id }) { + commit('dismissNotification', { id }) rootState.api.backendInteractor.dismissNotification({ id }) - .then(() => commit('dismissNotification', { id })) }, updateNotification ({ rootState, commit }, { id, updater }) { commit('updateNotification', { id, updater }) -- cgit v1.2.3-70-g09d2 From 9d09e4090fe37b5cbc775e4e9ae8097610ffd952 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 26 May 2020 01:01:25 +0300 Subject: multiple fixes --- src/components/notification/notification.js | 6 ++++-- src/components/notification/notification.vue | 6 ++---- src/components/status/status.js | 4 +--- src/modules/statuses.js | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 1cf4c9bc..cacdce87 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -1,3 +1,4 @@ +import StatusContent from '../status_content/status_content.vue' import Status from '../status/status.vue' import UserAvatar from '../user_avatar/user_avatar.vue' import UserCard from '../user_card/user_card.vue' @@ -16,10 +17,11 @@ const Notification = { }, props: [ 'notification' ], components: { - Status, + StatusContent, UserAvatar, UserCard, - Timeago + Timeago, + Status, }, methods: { toggleUserExpanded () { diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 0e46a2a7..044ac871 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -157,11 +157,9 @@ diff --git a/src/components/status/status.js b/src/components/status/status.js index 95278968..73382521 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -122,8 +122,6 @@ const Status = { this.muteWordHits.length > 0 ) const excusesNotToMute = ( - // Currently showing status - this.unmuted || ( this.inProfile && ( // Don't mute user's posts on user timeline (except reblogs) @@ -137,7 +135,7 @@ const Status = { // No excuses if post has muted words ) && !this.muteWordHits.length > 0 - return !excusesNotToMute && reasonsToMute + return !this.unmuted && !excusesNotToMute && reasonsToMute }, hideFilteredStatuses () { return this.mergedConfig.hideFilteredStatuses diff --git a/src/modules/statuses.js b/src/modules/statuses.js index c809cf1c..9a2e0df1 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -386,7 +386,7 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot state.notifications.desktopNotificationSilence || !visibleNotificationTypes.includes(notification.type) || ( - status && ( + notification.type === 'mention' && status && ( status.muted || muteWordHits(status, rootGetters.mergedConfig.muteWords).length === 0 ) -- cgit v1.2.3-70-g09d2 From 1f205b87ac906f67fa8e72530d18977bca085296 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 26 May 2020 01:06:34 +0300 Subject: lint --- src/components/notification/notification.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/components/notification/notification.js') diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index cacdce87..5aa40e98 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -21,7 +21,7 @@ const Notification = { UserAvatar, UserCard, Timeago, - Status, + Status }, methods: { toggleUserExpanded () { -- cgit v1.2.3-70-g09d2