Fix report modal not working, add include_types

This commit is contained in:
Shpuld Shpuldson 2021-02-01 12:55:23 +02:00
parent 8334649c11
commit 3822a73a49
4 changed files with 30 additions and 7 deletions

View File

@ -1,4 +1,3 @@
import Status from '../status/status.vue' import Status from '../status/status.vue'
import List from '../list/list.vue' import List from '../list/list.vue'
import Checkbox from '../checkbox/checkbox.vue' import Checkbox from '../checkbox/checkbox.vue'
@ -21,14 +20,17 @@ const UserReportingModal = {
} }
}, },
computed: { computed: {
reportModal () {
return this.$store.state.reports.reportModal
},
isLoggedIn () { isLoggedIn () {
return !!this.$store.state.users.currentUser return !!this.$store.state.users.currentUser
}, },
isOpen () { isOpen () {
return this.isLoggedIn && this.$store.state.reports.modalActivated return this.isLoggedIn && this.reportModal.activated
}, },
userId () { userId () {
return this.$store.state.reports.userId return this.reportModal.userId
}, },
user () { user () {
return this.$store.getters.findUser(this.userId) return this.$store.getters.findUser(this.userId)
@ -37,10 +39,10 @@ const UserReportingModal = {
return !this.user.is_local && this.user.screen_name.substr(this.user.screen_name.indexOf('@') + 1) return !this.user.is_local && this.user.screen_name.substr(this.user.screen_name.indexOf('@') + 1)
}, },
statuses () { statuses () {
return this.$store.state.reports.statuses return this.reportModal.statuses
}, },
preTickedIds () { preTickedIds () {
return this.$store.state.reports.preTickedIds return this.reportModal.preTickedIds
} }
}, },
watch: { watch: {

View File

@ -18,7 +18,7 @@ const reports = {
state.reportModal.activated = true state.reportModal.activated = true
}, },
closeUserReportingModal (state) { closeUserReportingModal (state) {
state.reportModal.modalActivated = false state.reportModal.activated = false
}, },
setReportState (reportsState, { id, state }) { setReportState (reportsState, { id, state }) {
reportsState.reports[id].state = state reportsState.reports[id].state = state

View File

@ -498,7 +498,8 @@ const fetchTimeline = ({
userId = false, userId = false,
tag = false, tag = false,
withMuted = false, withMuted = false,
replyVisibility = 'all' replyVisibility = 'all',
includeTypes = []
}) => { }) => {
const timelineUrls = { const timelineUrls = {
public: MASTODON_PUBLIC_TIMELINE, public: MASTODON_PUBLIC_TIMELINE,
@ -545,6 +546,11 @@ const fetchTimeline = ({
if (replyVisibility !== 'all') { if (replyVisibility !== 'all') {
params.push(['reply_visibility', replyVisibility]) params.push(['reply_visibility', replyVisibility])
} }
if (includeTypes.length > 0) {
includeTypes.forEach(type => {
params.push(['include_types[]', type])
})
}
params.push(['limit', 20]) params.push(['limit', 20])

View File

@ -1,6 +1,18 @@
import apiService from '../api/api.service.js' import apiService from '../api/api.service.js'
import { promiseInterval } from '../promise_interval/promise_interval.js' import { promiseInterval } from '../promise_interval/promise_interval.js'
// For using include_types when fetching notifications.
// Note: chat_mention excluded as pleroma-fe polls them separately
const mastoApiNotificationTypes = [
'mention',
'favourite',
'reblog',
'follow',
'move',
'pleroma:emoji_reaction',
'pleroma:report'
]
const update = ({ store, notifications, older }) => { const update = ({ store, notifications, older }) => {
store.dispatch('addNewNotifications', { notifications, older }) store.dispatch('addNewNotifications', { notifications, older })
} }
@ -12,6 +24,9 @@ const fetchAndUpdate = ({ store, credentials, older = false }) => {
const timelineData = rootState.statuses.notifications const timelineData = rootState.statuses.notifications
const hideMutedPosts = getters.mergedConfig.hideMutedPosts const hideMutedPosts = getters.mergedConfig.hideMutedPosts
if (rootState.users.currentUser.role === 'admin') {
args['includeTypes'] = mastoApiNotificationTypes
}
args['withMuted'] = !hideMutedPosts args['withMuted'] = !hideMutedPosts
args['timeline'] = 'notifications' args['timeline'] = 'notifications'