forked from AkkomaGang/akkoma-fe
Merge branch 'fix/use-backend-reply-filtering' into 'develop'
Make use of backend reply filtering See merge request pleroma/pleroma-fe!1163
This commit is contained in:
commit
beb160bd53
9 changed files with 32 additions and 42 deletions
|
@ -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
|
- Subject field now appears disabled when posting
|
||||||
- Fix status ellipsis menu being cut off in notifications column
|
- Fix status ellipsis menu being cut off in notifications column
|
||||||
- Fixed autocomplete sometimes not returning the right user when there's already some results
|
- 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
|
## [2.0.3] - 2020-05-02
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -37,6 +37,9 @@ const FilteringTab = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
},
|
||||||
|
replyVisibility () {
|
||||||
|
this.$store.dispatch('queueFlushAll')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ const Status = {
|
||||||
return this.mergedConfig.hideFilteredStatuses
|
return this.mergedConfig.hideFilteredStatuses
|
||||||
},
|
},
|
||||||
hideStatus () {
|
hideStatus () {
|
||||||
return (this.hideReply || this.deleted) || (this.muted && this.hideFilteredStatuses)
|
return this.deleted || (this.muted && this.hideFilteredStatuses)
|
||||||
},
|
},
|
||||||
isFocused () {
|
isFocused () {
|
||||||
// retweet or root of an expanded conversation
|
// retweet or root of an expanded conversation
|
||||||
|
@ -164,37 +164,6 @@ const Status = {
|
||||||
return user && user.screen_name
|
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 () {
|
replySubject () {
|
||||||
if (!this.status.summary) return ''
|
if (!this.status.summary) return ''
|
||||||
const decodedSummary = unescape(this.status.summary)
|
const decodedSummary = unescape(this.status.summary)
|
||||||
|
|
|
@ -45,11 +45,15 @@ const Timeline = {
|
||||||
newStatusCount () {
|
newStatusCount () {
|
||||||
return this.timeline.newStatusCount
|
return this.timeline.newStatusCount
|
||||||
},
|
},
|
||||||
newStatusCountStr () {
|
showLoadButton () {
|
||||||
|
if (this.timelineError || this.errorData) return false
|
||||||
|
return this.timeline.newStatusCount > 0 || this.timeline.flushMarker !== 0
|
||||||
|
},
|
||||||
|
loadButtonString () {
|
||||||
if (this.timeline.flushMarker !== 0) {
|
if (this.timeline.flushMarker !== 0) {
|
||||||
return ''
|
return this.$t('timeline.reload')
|
||||||
} else {
|
} else {
|
||||||
return ` (${this.newStatusCount})`
|
return `${this.$t('timeline.show_new')} (${this.newStatusCount})`
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
classes () {
|
classes () {
|
||||||
|
@ -112,8 +116,6 @@ const Timeline = {
|
||||||
if (e.key === '.') this.showNewStatuses()
|
if (e.key === '.') this.showNewStatuses()
|
||||||
},
|
},
|
||||||
showNewStatuses () {
|
showNewStatuses () {
|
||||||
if (this.newStatusCount === 0) return
|
|
||||||
|
|
||||||
if (this.timeline.flushMarker !== 0) {
|
if (this.timeline.flushMarker !== 0) {
|
||||||
this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
|
this.$store.commit('clearTimeline', { timeline: this.timelineName, excludeUserId: true })
|
||||||
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
|
this.$store.commit('queueFlush', { timeline: this.timelineName, id: 0 })
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
{{ errorData.statusText }}
|
{{ errorData.statusText }}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
v-if="timeline.newStatusCount > 0 && !timelineError && !errorData"
|
v-else-if="showLoadButton"
|
||||||
class="loadmore-button"
|
class="loadmore-button"
|
||||||
@click.prevent="showNewStatuses"
|
@click.prevent="showNewStatuses"
|
||||||
>
|
>
|
||||||
{{ $t('timeline.show_new') }}{{ newStatusCountStr }}
|
{{ loadButtonString }}
|
||||||
</button>
|
</button>
|
||||||
<div
|
<div
|
||||||
v-if="!timeline.newStatusCount > 0 && !timelineError && !errorData"
|
v-else
|
||||||
class="loadmore-text faint"
|
class="loadmore-text faint"
|
||||||
@click.prevent
|
@click.prevent
|
||||||
>
|
>
|
||||||
|
|
|
@ -617,6 +617,7 @@
|
||||||
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
|
"no_retweet_hint": "Post is marked as followers-only or direct and cannot be repeated",
|
||||||
"repeated": "repeated",
|
"repeated": "repeated",
|
||||||
"show_new": "Show new",
|
"show_new": "Show new",
|
||||||
|
"reload": "Reload",
|
||||||
"up_to_date": "Up-to-date",
|
"up_to_date": "Up-to-date",
|
||||||
"no_more_statuses": "No more statuses",
|
"no_more_statuses": "No more statuses",
|
||||||
"no_statuses": "No statuses"
|
"no_statuses": "No statuses"
|
||||||
|
|
|
@ -515,6 +515,11 @@ export const mutations = {
|
||||||
queueFlush (state, { timeline, id }) {
|
queueFlush (state, { timeline, id }) {
|
||||||
state.timelines[timeline].flushMarker = 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 }) {
|
addRepeats (state, { id, rebloggedByUsers, currentUser }) {
|
||||||
const newStatus = state.allStatusesObject[id]
|
const newStatus = state.allStatusesObject[id]
|
||||||
newStatus.rebloggedBy = rebloggedByUsers.filter(_ => _)
|
newStatus.rebloggedBy = rebloggedByUsers.filter(_ => _)
|
||||||
|
@ -664,6 +669,9 @@ const statuses = {
|
||||||
queueFlush ({ rootState, commit }, { timeline, id }) {
|
queueFlush ({ rootState, commit }, { timeline, id }) {
|
||||||
commit('queueFlush', { timeline, id })
|
commit('queueFlush', { timeline, id })
|
||||||
},
|
},
|
||||||
|
queueFlushAll ({ rootState, commit }) {
|
||||||
|
commit('queueFlushAll')
|
||||||
|
},
|
||||||
markNotificationsAsSeen ({ rootState, commit }) {
|
markNotificationsAsSeen ({ rootState, commit }) {
|
||||||
commit('markNotificationsAsSeen')
|
commit('markNotificationsAsSeen')
|
||||||
apiService.markNotificationsAsSeen({
|
apiService.markNotificationsAsSeen({
|
||||||
|
|
|
@ -498,7 +498,8 @@ const fetchTimeline = ({
|
||||||
until = false,
|
until = false,
|
||||||
userId = false,
|
userId = false,
|
||||||
tag = false,
|
tag = false,
|
||||||
withMuted = false
|
withMuted = false,
|
||||||
|
replyVisibility = 'all'
|
||||||
}) => {
|
}) => {
|
||||||
const timelineUrls = {
|
const timelineUrls = {
|
||||||
public: MASTODON_PUBLIC_TIMELINE,
|
public: MASTODON_PUBLIC_TIMELINE,
|
||||||
|
@ -541,6 +542,9 @@ const fetchTimeline = ({
|
||||||
if (timeline !== 'favorites') {
|
if (timeline !== 'favorites') {
|
||||||
params.push(['with_muted', withMuted])
|
params.push(['with_muted', withMuted])
|
||||||
}
|
}
|
||||||
|
if (replyVisibility !== 'all') {
|
||||||
|
params.push(['reply_visibility', replyVisibility])
|
||||||
|
}
|
||||||
|
|
||||||
params.push(['limit', 20])
|
params.push(['limit', 20])
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,8 @@ const fetchAndUpdate = ({
|
||||||
const rootState = store.rootState || store.state
|
const rootState = store.rootState || store.state
|
||||||
const { getters } = store
|
const { getters } = store
|
||||||
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
const timelineData = rootState.statuses.timelines[camelCase(timeline)]
|
||||||
const hideMutedPosts = getters.mergedConfig.hideMutedPosts
|
const { hideMutedPosts, replyVisibility } = getters.mergedConfig
|
||||||
|
const loggedIn = !!rootState.users.currentUser
|
||||||
|
|
||||||
if (older) {
|
if (older) {
|
||||||
args['until'] = until || timelineData.minId
|
args['until'] = until || timelineData.minId
|
||||||
|
@ -41,6 +42,7 @@ const fetchAndUpdate = ({
|
||||||
args['userId'] = userId
|
args['userId'] = userId
|
||||||
args['tag'] = tag
|
args['tag'] = tag
|
||||||
args['withMuted'] = !hideMutedPosts
|
args['withMuted'] = !hideMutedPosts
|
||||||
|
if (loggedIn) args['replyVisibility'] = replyVisibility
|
||||||
|
|
||||||
const numStatusesBeforeFetch = timelineData.statuses.length
|
const numStatusesBeforeFetch = timelineData.statuses.length
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue