diff --git a/CHANGELOG.md b/CHANGELOG.md
index dea955d0..9026cec5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Ability to fetch all statuses from a given instance
- Grouped reports: now you can view reports, which are grouped by status (pagination is not implemented yet, though)
- Ability to confirm users' emails and resend confirmation emails
+- Report notes
- Ability to moderate users on the statuses page
### Fixed
diff --git a/package.json b/package.json
index 0327b45b..73c2fc16 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"driver.js": "0.8.1",
"dropzone": "5.2.0",
"echarts": "4.1.0",
- "element-ui": "^2.10.0",
+ "element-ui": "^2.13.0",
"file-saver": "1.3.8",
"fuse.js": "3.4.2",
"js-cookie": "2.2.0",
diff --git a/src/api/reports.js b/src/api/reports.js
index 373e5bd5..3454da2f 100644
--- a/src/api/reports.js
+++ b/src/api/reports.js
@@ -33,4 +33,23 @@ export async function fetchGroupedReports(authHost, token) {
})
}
+export async function createNote(content, reportID, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/reports/${reportID}/notes`,
+ method: `post`,
+ headers: authHeaders(token),
+ data: { content }
+ })
+}
+
+export async function deleteNote(noteID, reportID, authHost, token) {
+ return await request({
+ baseURL: baseName(authHost),
+ url: `/api/pleroma/admin/reports/${reportID}/notes/${noteID}`,
+ method: `delete`,
+ headers: authHeaders(token)
+ })
+}
+
const authHeaders = (token) => token ? { 'Authorization': `Bearer ${getToken()}` } : {}
diff --git a/src/lang/en.js b/src/lang/en.js
index dd3326e5..3dcd9bdd 100644
--- a/src/lang/en.js
+++ b/src/lang/en.js
@@ -240,9 +240,10 @@ export default {
resendConfirmation: 'Resend confirmation email'
},
statuses: {
- statuses: 'Statuses',
+ statuses: 'Statuses by instance',
instanceFilter: 'Instance filter',
- loadMore: 'Load more'
+ loadMore: 'Load more',
+ noInstances: 'No other instances found'
},
userProfile: {
tags: 'Tags',
@@ -308,7 +309,10 @@ export default {
actors: 'Actors',
content: 'Content',
reportedStatus: 'Reported status',
- statusDeleted: 'This status has been deleted'
+ statusDeleted: 'This status has been deleted',
+ leaveNote: 'Leave a note',
+ postNote: 'Send',
+ deleteNote: 'Delete'
},
reportsFilter: {
inputPlaceholder: 'Select filter',
diff --git a/src/store/modules/reports.js b/src/store/modules/reports.js
index d62f1b55..f64c520d 100644
--- a/src/store/modules/reports.js
+++ b/src/store/modules/reports.js
@@ -1,4 +1,5 @@
-import { changeState, fetchReports, fetchGroupedReports } from '@/api/reports'
+import { Message } from 'element-ui'
+import { changeState, fetchReports, fetchGroupedReports, createNote, deleteNote } from '@/api/reports'
const reports = {
state: {
@@ -79,6 +80,50 @@ const reports = {
},
ToggleReportsGrouping({ commit }) {
commit('SET_REPORTS_GROUPING')
+ },
+ CreateReportNote({ commit, getters, state, rootState }, { content, reportID }) {
+ createNote(content, reportID, getters.authHost, getters.token)
+
+ const optimisticNote = {
+ user: {
+ avatar: rootState.user.avatar,
+ display_name: rootState.user.name,
+ url: `${rootState.user.authHost}/${rootState.user.name}`,
+ acct: rootState.user.name
+ },
+ content: content,
+ created_at: new Date().getTime()
+ }
+
+ const updatedReports = state.fetchedReports.map(report => {
+ if (report.id === reportID) {
+ report.notes = [...report.notes, optimisticNote]
+ }
+
+ return report
+ })
+
+ commit('SET_REPORTS', updatedReports)
+ },
+ DeleteReportNote({ commit, getters, state }, { noteID, reportID }) {
+ deleteNote(noteID, reportID, getters.authHost, getters.token)
+
+ const updatedReports = state.fetchedReports.map(report => {
+ if (report.id === reportID) {
+ report.notes = report.notes.filter(note => note.id !== noteID)
+ }
+
+ return report
+ })
+
+ commit('SET_REPORTS', updatedReports)
+ },
+ SuccessMessage(text) {
+ return Message({
+ message: text,
+ type: 'success',
+ duration: 5 * 1000
+ })
}
}
}
diff --git a/src/styles/index.scss b/src/styles/index.scss
index 93f2157e..8cb31469 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -11,6 +11,8 @@ body {
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
+ background: #FFF;
+ color: #000;
}
label {
diff --git a/src/views/reports/components/NoteCard.vue b/src/views/reports/components/NoteCard.vue
new file mode 100644
index 00000000..fdc81d91
--- /dev/null
+++ b/src/views/reports/components/NoteCard.vue
@@ -0,0 +1,119 @@
+
+ {{ note.user.display_name }}
+