From b5c1d074f83d08473a19a3885f6ff5eeb95274e5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 25 May 2020 23:38:31 +0300 Subject: fix reprööted posts not being muted properly. fix muted posts making desktop notifications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/status/status.js | 57 +++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) (limited to 'src/components/status/status.js') diff --git a/src/components/status/status.js b/src/components/status/status.js index 9cd9d61c..95278968 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -12,7 +12,8 @@ import StatusPopover from '../status_popover/status_popover.vue' import EmojiReactions from '../emoji_reactions/emoji_reactions.vue' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' -import { filter, unescape, uniqBy } from 'lodash' +import { muteWordHits } from '../../services/status_parser/status_parser.js' +import { unescape, uniqBy } from 'lodash' import { mapGetters, mapState } from 'vuex' const Status = { @@ -44,6 +45,12 @@ const Status = { muteWords () { return this.mergedConfig.muteWords }, + showReasonMutedThread () { + return ( + this.status.thread_muted || + (this.status.reblog && this.status.reblog.thread_muted) + ) && !this.inConversation + }, repeaterClass () { const user = this.statusoid.user return highlightClass(user) @@ -93,20 +100,44 @@ const Status = { return !!this.currentUser }, muteWordHits () { - const statusText = this.status.text.toLowerCase() - const statusSummary = this.status.summary.toLowerCase() - const hits = filter(this.muteWords, (muteWord) => { - return statusText.includes(muteWord.toLowerCase()) || statusSummary.includes(muteWord.toLowerCase()) - }) - - return hits + return muteWordHits(this.status, this.muteWords) }, muted () { - const relationship = this.$store.getters.relationship(this.status.user.id) - return !this.unmuted && ( - (!(this.inProfile && this.status.user.id === this.profileUserId) && relationship.muting) || - (!this.inConversation && this.status.thread_muted) || - this.muteWordHits.length > 0) + const { status } = this + const { reblog } = status + const relationship = this.$store.getters.relationship(status.user.id) + const relationshipReblog = reblog && this.$store.getters.relationship(reblog.user.id) + const reasonsToMute = ( + // Post is muted according to BE + status.muted || + // Reprööt of a muted post according to BE + (reblog && reblog.muted) || + // Muted user + relationship.muting || + // Muted user of a reprööt + (relationshipReblog && relationshipReblog.muting) || + // Thread is muted + status.thread_muted || + // Wordfiltered + this.muteWordHits.length > 0 + ) + const excusesNotToMute = ( + // Currently showing status + this.unmuted || + ( + this.inProfile && ( + // Don't mute user's posts on user timeline (except reblogs) + (!reblog && status.user.id === this.profileUserId) || + // Same as above but also allow self-reblogs + (reblog && reblog.user.id === this.profileUserId) + ) + ) || + // Don't mute statuses in muted conversation when said conversation is opened + (this.inConversation && status.thread_muted) + // No excuses if post has muted words + ) && !this.muteWordHits.length > 0 + + return !excusesNotToMute && reasonsToMute }, hideFilteredStatuses () { return this.mergedConfig.hideFilteredStatuses -- 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/status/status.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 ea09bbecf8b7715a1242a104b6233a7c3b5ac588 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Tue, 30 Jun 2020 17:02:38 +0300 Subject: Make use of backend reply filtering --- CHANGELOG.md | 1 + .../settings_modal/tabs/filtering_tab.js | 3 ++ src/components/status/status.js | 33 +--------------------- src/components/timeline/timeline.js | 6 ++-- src/components/timeline/timeline.vue | 4 +-- src/modules/statuses.js | 8 ++++++ src/services/api/api.service.js | 6 +++- .../timeline_fetcher/timeline_fetcher.service.js | 4 ++- 8 files changed, 27 insertions(+), 38 deletions(-) (limited to 'src/components/status/status.js') diff --git a/CHANGELOG.md b/CHANGELOG.md index 887588f3..d978d362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Subject field now appears disabled when posting - Fix status ellipsis menu being cut off in notifications column - Fixed autocomplete sometimes not returning the right user when there's already some results +- Reply filtering options in Settings -> Filtering now work again using filtering on server ## [2.0.3] - 2020-05-02 ### Fixed diff --git a/src/components/settings_modal/tabs/filtering_tab.js b/src/components/settings_modal/tabs/filtering_tab.js index 224a7f47..3b2df556 100644 --- a/src/components/settings_modal/tabs/filtering_tab.js +++ b/src/components/settings_modal/tabs/filtering_tab.js @@ -37,6 +37,9 @@ const FilteringTab = { }) }, deep: true + }, + replyVisibility () { + this.$store.dispatch('queueFlushAll') } } } diff --git a/src/components/status/status.js b/src/components/status/status.js index 73382521..ad0b72a9 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -141,7 +141,7 @@ const Status = { return this.mergedConfig.hideFilteredStatuses }, hideStatus () { - return (this.hideReply || this.deleted) || (this.muted && this.hideFilteredStatuses) + return this.deleted || (this.muted && this.hideFilteredStatuses) }, isFocused () { // retweet or root of an expanded conversation @@ -164,37 +164,6 @@ const Status = { return user && user.screen_name } }, - hideReply () { - if (this.mergedConfig.replyVisibility === 'all') { - return false - } - if (this.inConversation || !this.isReply) { - return false - } - if (this.status.user.id === this.currentUser.id) { - return false - } - if (this.status.type === 'retweet') { - return false - } - const checkFollowing = this.mergedConfig.replyVisibility === 'following' - for (var i = 0; i < this.status.attentions.length; ++i) { - if (this.status.user.id === this.status.attentions[i].id) { - continue - } - // There's zero guarantee of this working. If we happen to have that user and their - // relationship in store then it will work, but there's kinda little chance of having - // them for people you're not following. - const relationship = this.$store.state.users.relationships[this.status.attentions[i].id] - if (checkFollowing && relationship && relationship.following) { - return false - } - if (this.status.attentions[i].id === this.currentUser.id) { - return false - } - } - return this.status.attentions.length > 0 - }, replySubject () { if (!this.status.summary) return '' const decodedSummary = unescape(this.status.summary) diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index 9a53acd6..3a244c83 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -45,6 +45,10 @@ const Timeline = { newStatusCount () { return this.timeline.newStatusCount }, + showLoadButton () { + if (this.timelineError || this.errorData) return false + return this.timeline.newStatusCount > 0 || this.timeline.flushMarker !== 0 + }, newStatusCountStr () { if (this.timeline.flushMarker !== 0) { return '' @@ -112,8 +116,6 @@ const Timeline = { if (e.key === '.') this.showNewStatuses() }, showNewStatuses () { - if (this.newStatusCount === 0) return - if (this.timeline.flushMarker !== 0) { this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true }) this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 }) diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index 9777bd0c..bd8389b9 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -19,14 +19,14 @@ {{ errorData.statusText }}
diff --git a/src/modules/statuses.js b/src/modules/statuses.js index 073b15f1..4d3f8031 100644 --- a/src/modules/statuses.js +++ b/src/modules/statuses.js @@ -515,6 +515,11 @@ export const mutations = { queueFlush (state, { timeline, id }) { state.timelines[timeline].flushMarker = id }, + queueFlushAll (state) { + Object.keys(state.timelines).forEach((timeline) => { + state.timelines[timeline].flushMarker = state.timelines[timeline].maxId + }) + }, addRepeats (state, { id, rebloggedByUsers, currentUser }) { const newStatus = state.allStatusesObject[id] newStatus.rebloggedBy = rebloggedByUsers.filter(_ => _) @@ -664,6 +669,9 @@ const statuses = { queueFlush ({ rootState, commit }, { timeline, id }) { commit('queueFlush', { timeline, id }) }, + queueFlushAll ({ rootState, commit }) { + commit('queueFlushAll') + }, markNotificationsAsSeen ({ rootState, commit }) { commit('markNotificationsAsSeen') apiService.markNotificationsAsSeen({ diff --git a/src/services/api/api.service.js b/src/services/api/api.service.js index dfffc291..7e5e9645 100644 --- a/src/services/api/api.service.js +++ b/src/services/api/api.service.js @@ -498,7 +498,8 @@ const fetchTimeline = ({ until = false, userId = false, tag = false, - withMuted = false + withMuted = false, + replyVisibility = 'all' }) => { const timelineUrls = { public: MASTODON_PUBLIC_TIMELINE, @@ -541,6 +542,9 @@ const fetchTimeline = ({ if (timeline !== 'favorites') { params.push(['with_muted', withMuted]) } + if (replyVisibility !== 'all') { + params.push(['reply_visibility', replyVisibility]) + } params.push(['limit', 20]) diff --git a/src/services/timeline_fetcher/timeline_fetcher.service.js b/src/services/timeline_fetcher/timeline_fetcher.service.js index c6b28ad5..30fb26bd 100644 --- a/src/services/timeline_fetcher/timeline_fetcher.service.js +++ b/src/services/timeline_fetcher/timeline_fetcher.service.js @@ -30,7 +30,8 @@ const fetchAndUpdate = ({ const rootState = store.rootState || store.state const { getters } = store const timelineData = rootState.statuses.timelines[camelCase(timeline)] - const hideMutedPosts = getters.mergedConfig.hideMutedPosts + const { hideMutedPosts, replyVisibility } = getters.mergedConfig + const loggedIn = !!rootState.users.currentUser if (older) { args['until'] = until || timelineData.minId @@ -41,6 +42,7 @@ const fetchAndUpdate = ({ args['userId'] = userId args['tag'] = tag args['withMuted'] = !hideMutedPosts + if (loggedIn) args['replyVisibility'] = replyVisibility const numStatusesBeforeFetch = timelineData.statuses.length -- cgit v1.2.3-70-g09d2 From 6079301ec45c6c13a1f8b5f9f6acf52b5a449331 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 16 Jul 2020 17:42:16 +0300 Subject: Move user list from reactions to its own component, make favs and rts use it --- src/components/emoji_reactions/emoji_reactions.js | 4 +- src/components/emoji_reactions/emoji_reactions.vue | 65 +------------------ src/components/status/status.js | 30 +++++---- src/components/status/status.vue | 35 ++++++---- .../user_list_popover/user_list_popover.js | 13 ++++ .../user_list_popover/user_list_popover.vue | 74 ++++++++++++++++++++++ 6 files changed, 131 insertions(+), 90 deletions(-) create mode 100644 src/components/user_list_popover/user_list_popover.js create mode 100644 src/components/user_list_popover/user_list_popover.vue (limited to 'src/components/status/status.js') diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js index ae7f53be..bb11b840 100644 --- a/src/components/emoji_reactions/emoji_reactions.js +++ b/src/components/emoji_reactions/emoji_reactions.js @@ -1,5 +1,5 @@ import UserAvatar from '../user_avatar/user_avatar.vue' -import Popover from '../popover/popover.vue' +import UserListPopover from '../user_list_popover/user_list_popover.vue' const EMOJI_REACTION_COUNT_CUTOFF = 12 @@ -7,7 +7,7 @@ const EmojiReactions = { name: 'EmojiReactions', components: { UserAvatar, - Popover + UserListPopover }, props: ['status'], data: () => ({ diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue index bac4c605..2f14b5b2 100644 --- a/src/components/emoji_reactions/emoji_reactions.vue +++ b/src/components/emoji_reactions/emoji_reactions.vue @@ -1,44 +1,11 @@