Fix up and code review

* Check if it works properly
    * Notifs are shown as BE returns them
    * The Interaction view has Reports, but only when you're mod or admin
* Do some extra translations
* Fix some console spam
This commit is contained in:
Ilja 2022-02-26 01:53:01 +01:00
parent 52c22e863e
commit 819b760261
7 changed files with 22 additions and 10 deletions

View File

@ -13,7 +13,8 @@ const Interactions = {
data () { data () {
return { return {
allowFollowingMove: this.$store.state.users.currentUser.allow_following_move, allowFollowingMove: this.$store.state.users.currentUser.allow_following_move,
filterMode: tabModeDict['mentions'] filterMode: tabModeDict['mentions'],
canSeeReports: ['moderator', 'admin'].includes(this.$store.state.users.currentUser.role)
} }
}, },
methods: { methods: {

View File

@ -176,6 +176,8 @@
"interactions": { "interactions": {
"favs_repeats": "Repeats and Favorites", "favs_repeats": "Repeats and Favorites",
"follows": "New follows", "follows": "New follows",
"emoji_reactions": "Emoji Reactions",
"reports": "Reports",
"moves": "User migrates", "moves": "User migrates",
"load_older": "Load older interactions" "load_older": "Load older interactions"
}, },

View File

@ -661,6 +661,8 @@
"interactions": { "interactions": {
"favs_repeats": "Herhalingen en Favorieten", "favs_repeats": "Herhalingen en Favorieten",
"follows": "Nieuwe volgingen", "follows": "Nieuwe volgingen",
"emoji_reactions": "Emoji Reacties",
"reports": "Rapportages",
"moves": "Gebruiker migreert", "moves": "Gebruiker migreert",
"load_older": "Oudere interacties laden" "load_older": "Oudere interacties laden"
}, },
@ -669,6 +671,17 @@
"error": "Niet gevonden.", "error": "Niet gevonden.",
"remote_user_resolver": "Externe gebruikers zoeker" "remote_user_resolver": "Externe gebruikers zoeker"
}, },
"report": {
"reporter": "Reporteerder:",
"reported_user": "Gerapporteerde gebruiker:",
"reported_statuses": "Gerapporteerde statussen:",
"notes": "Notas:",
"state": "Status:",
"state_open": "Open",
"state_closed": "Gesloten",
"state_resolved": "Opgelost"
},
"selectable_list": { "selectable_list": {
"select_all": "Alles selecteren" "select_all": "Alles selecteren"
}, },

View File

@ -43,11 +43,8 @@ const reports = {
}, },
setReportState ({ commit, dispatch, rootState }, { id, state }) { setReportState ({ commit, dispatch, rootState }, { id, state }) {
const oldState = rootState.reports.reports[id].state const oldState = rootState.reports.reports[id].state
console.log(oldState, state)
commit('setReportState', { id, state }) commit('setReportState', { id, state })
rootState.api.backendInteractor.setReportState({ id, state }).then(report => { rootState.api.backendInteractor.setReportState({ id, state }).catch(e => {
console.log(report)
}).catch(e => {
console.error('Failed to set report state', e) console.error('Failed to set report state', e)
dispatch('pushGlobalNotice', { dispatch('pushGlobalNotice', {
level: 'error', level: 'error',

View File

@ -1270,7 +1270,8 @@ const deleteChatMessage = ({ chatId, messageId, credentials }) => {
} }
const setReportState = ({ id, state, credentials }) => { const setReportState = ({ id, state, credentials }) => {
// Can't use promisedRequest because on OK this does not return json // TODO: Can't use promisedRequest because on OK this does not return json
// See https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1322
return fetch(PLEROMA_ADMIN_REPORTS, { return fetch(PLEROMA_ADMIN_REPORTS, {
headers: { headers: {
...authHeaders(credentials), ...authHeaders(credentials),

View File

@ -93,7 +93,7 @@ export const prepareNotificationObject = (notification, i18n) => {
i18nString = 'follow_request' i18nString = 'follow_request'
break break
case 'pleroma:report': case 'pleroma:report':
i18nString = 'reported' i18nString = 'submitted_report'
break break
} }

View File

@ -24,9 +24,7 @@ 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['includeTypes'] = mastoApiNotificationTypes
}
args['withMuted'] = !hideMutedPosts args['withMuted'] = !hideMutedPosts
args['timeline'] = 'notifications' args['timeline'] = 'notifications'