wip
This commit is contained in:
parent
9613f80f8e
commit
e73553dca7
@ -185,7 +185,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<Report
|
<Report
|
||||||
v-else-if="notification.type === 'pleroma:report'"
|
v-else-if="notification.type === 'pleroma:report'"
|
||||||
:report="notification.report"
|
:report-id="notification.report.id"
|
||||||
/>
|
/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<status-content
|
<status-content
|
||||||
|
@ -4,18 +4,23 @@ import generateProfileLink from 'src/services/user_profile_link_generator/user_p
|
|||||||
|
|
||||||
const Report = {
|
const Report = {
|
||||||
props: [
|
props: [
|
||||||
'report'
|
'reportId'
|
||||||
],
|
],
|
||||||
components: {
|
components: {
|
||||||
StatusContent,
|
StatusContent,
|
||||||
Timeago
|
Timeago
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
report () {
|
||||||
|
return this.$store.state.reports.reports[this.reportId] || {}
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
generateUserProfileLink (user) {
|
generateUserProfileLink (user) {
|
||||||
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames)
|
||||||
},
|
},
|
||||||
setReportState (id, state) {
|
setReportState (id, state) {
|
||||||
return this.$store.state.api.backendInteractor.setReportState({ id, state })
|
return this.$store.dispatch('setReportState', { id, state })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,29 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="Report">
|
<div class="Report">
|
||||||
|
<div class="report-state">
|
||||||
|
<label
|
||||||
|
for="report-state"
|
||||||
|
class="select"
|
||||||
|
>
|
||||||
|
<select
|
||||||
|
id="report-state"
|
||||||
|
v-model="report.state"
|
||||||
|
class="form-control"
|
||||||
|
>
|
||||||
|
<option
|
||||||
|
v-for="state in ['open', 'closed', 'resolved']"
|
||||||
|
:key="state"
|
||||||
|
:value="report.state"
|
||||||
|
>
|
||||||
|
{{ $t('report.state_' + state) }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<FAIcon
|
||||||
|
class="select-down-icon"
|
||||||
|
icon="chevron-down"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<div class="reported-user">
|
<div class="reported-user">
|
||||||
<span>{{ $t('report.reported_user') }}</span>
|
<span>{{ $t('report.reported_user') }}</span>
|
||||||
<router-link :to="generateUserProfileLink(report.acct)">
|
<router-link :to="generateUserProfileLink(report.acct)">
|
||||||
|
@ -1,21 +1,31 @@
|
|||||||
|
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
|
||||||
import filter from 'lodash/filter'
|
import filter from 'lodash/filter'
|
||||||
|
|
||||||
const reports = {
|
const reports = {
|
||||||
state: {
|
state: {
|
||||||
|
reportModal: {
|
||||||
userId: null,
|
userId: null,
|
||||||
statuses: [],
|
statuses: [],
|
||||||
preTickedIds: [],
|
preTickedIds: [],
|
||||||
modalActivated: false
|
activated: false
|
||||||
|
},
|
||||||
|
reports: {}
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
openUserReportingModal (state, { userId, statuses, preTickedIds }) {
|
openUserReportingModal (state, { userId, statuses, preTickedIds }) {
|
||||||
state.userId = userId
|
state.reportModal.userId = userId
|
||||||
state.statuses = statuses
|
state.reportModal.statuses = statuses
|
||||||
state.preTickedIds = preTickedIds
|
state.reportModal.preTickedIds = preTickedIds
|
||||||
state.modalActivated = true
|
state.reportModal.activated = true
|
||||||
},
|
},
|
||||||
closeUserReportingModal (state) {
|
closeUserReportingModal (state) {
|
||||||
state.modalActivated = false
|
state.reportModal.modalActivated = false
|
||||||
|
},
|
||||||
|
setReportState (reportsState, { id, state }) {
|
||||||
|
reportsState.reports[id].state = state
|
||||||
|
},
|
||||||
|
addReport (state, report) {
|
||||||
|
state.reports[report.id] = report
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
@ -31,6 +41,19 @@ const reports = {
|
|||||||
},
|
},
|
||||||
closeUserReportingModal ({ commit }) {
|
closeUserReportingModal ({ commit }) {
|
||||||
commit('closeUserReportingModal')
|
commit('closeUserReportingModal')
|
||||||
|
},
|
||||||
|
setReportState ({ commit, rootState }, { id, state }) {
|
||||||
|
const oldState = rootState.reports.reports[id].state
|
||||||
|
commit('setReportState', { id, state })
|
||||||
|
backendInteractorService.setReportState({ id, state }).then(report => {
|
||||||
|
console.log(report)
|
||||||
|
}).catch(e => {
|
||||||
|
console.error('Failed to set report state', e)
|
||||||
|
commit('setReportState', { id, oldState })
|
||||||
|
})
|
||||||
|
},
|
||||||
|
addReport ({ commit }, report) {
|
||||||
|
commit('addReport', report)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,6 +317,10 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
|
|||||||
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
notification.status = notification.status && addStatusToGlobalStorage(state, notification.status).item
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (notification.type === 'pleroma:report') {
|
||||||
|
dispatch('addReport', notification.report)
|
||||||
|
}
|
||||||
|
|
||||||
if (notification.type === 'pleroma:emoji_reaction') {
|
if (notification.type === 'pleroma:emoji_reaction') {
|
||||||
dispatch('fetchEmojiReactionsBy', notification.status.id)
|
dispatch('fetchEmojiReactionsBy', notification.status.id)
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user