From ede18f50a2937631a893055f64045ff462ada5cc Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 30 Sep 2018 23:01:40 +0900
Subject: [PATCH 1/3] refs #567 Add reporting method on toot
---
package-lock.json | 41 +++++---------
src/config/locales/en/translation.json | 9 +++
.../TimelineSpace/Contents/Cards/Toot.vue | 9 ++-
.../components/TimelineSpace/Modals.vue | 5 +-
.../TimelineSpace/Modals/Report.vue | 56 +++++++++++++++++++
src/renderer/store/TimelineSpace/Modals.js | 7 ++-
.../store/TimelineSpace/Modals/Report.js | 34 +++++++++++
7 files changed, 129 insertions(+), 32 deletions(-)
create mode 100644 src/renderer/components/TimelineSpace/Modals/Report.vue
create mode 100644 src/renderer/store/TimelineSpace/Modals/Report.js
diff --git a/package-lock.json b/package-lock.json
index f235892a..1438961b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -6995,14 +6995,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -7017,20 +7015,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"core-util-is": {
"version": "1.0.2",
@@ -7147,8 +7142,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"ini": {
"version": "1.3.5",
@@ -7160,7 +7154,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@@ -7175,7 +7168,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7183,14 +7175,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"minipass": {
"version": "2.2.4",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"safe-buffer": "^5.1.1",
"yallist": "^3.0.0"
@@ -7209,7 +7199,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"minimist": "0.0.8"
}
@@ -7290,8 +7279,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
- "dev": true,
- "optional": true
+ "dev": true
},
"object-assign": {
"version": "4.1.1",
@@ -7303,7 +7291,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"wrappy": "1"
}
@@ -7425,7 +7412,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
- "optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@@ -15914,13 +15900,8 @@
"resolved": "https://registry.npmjs.org/system-font-families/-/system-font-families-0.4.1.tgz",
"integrity": "sha512-XQK5qAYsbEI6SkCEwezRDsPV44T2G4NNQ/xcx7D/8XM3S+rqYlNxsGcLT7vO6vdT4hc/mlRef7S6+KGIetTwdg==",
"requires": {
- "babel-polyfill": "^6.23.0"
- },
- "dependencies": {
- "ttfinfo": {
- "version": "git+https://github.com/rBurgett/ttfinfo.git#f00e43e2a6d4c8a12a677df20b7804492d50863c",
- "from": "git+https://github.com/rBurgett/ttfinfo.git#f00e43e2a6d4c8a12a677df20b7804492d50863c"
- }
+ "babel-polyfill": "^6.23.0",
+ "ttfinfo": "git+https://github.com/rBurgett/ttfinfo.git#f00e43e2a6d4c8a12a677df20b7804492d50863c"
}
},
"table": {
@@ -16339,6 +16320,10 @@
"integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==",
"dev": true
},
+ "ttfinfo": {
+ "version": "git+https://github.com/rBurgett/ttfinfo.git#f00e43e2a6d4c8a12a677df20b7804492d50863c",
+ "from": "git+https://github.com/rBurgett/ttfinfo.git"
+ },
"tty-browserify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json
index 578c574e..1b38d4e5 100644
--- a/src/config/locales/en/translation.json
+++ b/src/config/locales/en/translation.json
@@ -212,6 +212,12 @@
"i": "Open the images",
"x": "Show/hide CW and NSFW",
"esc": "Close current page"
+ },
+ "report": {
+ "title": "Reporting this user",
+ "comment": "Additional comments",
+ "cancel": "Cancel",
+ "ok": "Report"
}
},
"cards": {
@@ -222,6 +228,9 @@
"view_toot_detail": "View Toot Detail",
"open_in_browser": "Open in Browser",
"copy_link_to_toot": "Copy Link to Toot",
+ "mute": "Mute",
+ "block": "Block",
+ "report": "Report",
"delete": "Delete",
"via": "via {{application}}",
"reply": "Reply",
diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
index 77ab6ca7..0b2ef506 100644
--- a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
+++ b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
@@ -94,7 +94,10 @@
{{ $t('cards.toot.copy_link_to_toot') }}
-
+
+ {{ $t('cards.toot.report') }}
+
+
{{ $t('cards.toot.delete') }}
@@ -266,6 +269,10 @@ export default {
clipboard.writeText(message.url, 'toot-link')
this.$refs.popper.doClose()
},
+ reportUser (message) {
+ this.$store.dispatch('TimelineSpace/Modals/Report/openReport', this.originalMessage(message))
+ this.$refs.popper.doClose()
+ },
changeReblog (message) {
if (message.reblogged) {
this.$store.dispatch('TimelineSpace/Contents/Cards/Toot/unreblog', message)
diff --git a/src/renderer/components/TimelineSpace/Modals.vue b/src/renderer/components/TimelineSpace/Modals.vue
index c30c75b5..591d2429 100644
--- a/src/renderer/components/TimelineSpace/Modals.vue
+++ b/src/renderer/components/TimelineSpace/Modals.vue
@@ -7,6 +7,7 @@
+
@@ -18,6 +19,7 @@ import ListMembership from './Modals/ListMembership'
import AddListMember from './Modals/AddListMember'
import MuteConfirm from './Modals/MuteConfirm'
import Shortcut from './Modals/Shortcut'
+import Report from './Modals/Report'
export default {
name: 'modals',
@@ -28,7 +30,8 @@ export default {
ListMembership,
AddListMember,
MuteConfirm,
- Shortcut
+ Shortcut,
+ Report
}
}
diff --git a/src/renderer/components/TimelineSpace/Modals/Report.vue b/src/renderer/components/TimelineSpace/Modals/Report.vue
new file mode 100644
index 00000000..82ad6d5d
--- /dev/null
+++ b/src/renderer/components/TimelineSpace/Modals/Report.vue
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/renderer/store/TimelineSpace/Modals.js b/src/renderer/store/TimelineSpace/Modals.js
index 07041f52..9afe0d2e 100644
--- a/src/renderer/store/TimelineSpace/Modals.js
+++ b/src/renderer/store/TimelineSpace/Modals.js
@@ -5,6 +5,7 @@ import ListMembership from './Modals/ListMembership'
import AddListMember from './Modals/AddListMember'
import MuteConfirm from './Modals/MuteConfirm'
import Shortcut from './Modals/Shortcut'
+import Report from './Modals/Report'
const Modals = {
namespaced: true,
@@ -15,7 +16,8 @@ const Modals = {
ListMembership,
AddListMember,
MuteConfirm,
- Shortcut
+ Shortcut,
+ Report
},
getters: {
modalOpened: (state, getters, rootState) => {
@@ -26,7 +28,8 @@ const Modals = {
const addListMember = rootState.TimelineSpace.Modals.AddListMember.modalOpen
const shortcut = rootState.TimelineSpace.Modals.Shortcut.modalOpen
const muteConfirm = rootState.TimelineSpace.Modals.MuteConfirm.modalOpen
- return imageViewer || newToot || jump || listMembership || addListMember || shortcut || muteConfirm
+ const report = rootState.TimelineSpace.Modals.Report.modalOpen
+ return imageViewer || newToot || jump || listMembership || addListMember || shortcut || muteConfirm || report
}
}
}
diff --git a/src/renderer/store/TimelineSpace/Modals/Report.js b/src/renderer/store/TimelineSpace/Modals/Report.js
new file mode 100644
index 00000000..73a526f6
--- /dev/null
+++ b/src/renderer/store/TimelineSpace/Modals/Report.js
@@ -0,0 +1,34 @@
+import Mastodon from 'megalodon'
+
+export default {
+ namespaced: true,
+ state: {
+ modalOpen: false,
+ message: {}
+ },
+ mutations: {
+ changeModalOpen (state, value) {
+ state.modalOpen = value
+ },
+ changeMessage (state, value) {
+ state.message = value
+ }
+ },
+ actions: {
+ openReport ({ commit }, message) {
+ commit('changeMessage', message)
+ commit('changeModalOpen', true)
+ },
+ submit ({ rootState }, payload) {
+ const client = new Mastodon(
+ rootState.TimelineSpace.account.accessToken,
+ rootState.TimelineSpace.account.baseURL + '/api/v1'
+ )
+ return client.post(`/reports`, {
+ account_id: payload.account_id,
+ status_ids: [payload.status_id],
+ comment: payload.comment
+ })
+ }
+ }
+}
From 7f800f6ad45b1bff9a7d01247632f75dd0b87eb1 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 30 Sep 2018 23:55:33 +0900
Subject: [PATCH 2/3] refs #567 Add mute/block menu on toot
---
.../TimelineSpace/Contents/Cards/Toot.vue | 17 ++++++++++++++++-
.../store/TimelineSpace/Contents/Cards/Toot.js | 7 +++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
index 0b2ef506..8a12b274 100644
--- a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
+++ b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue
@@ -94,7 +94,13 @@
{{ $t('cards.toot.copy_link_to_toot') }}
-
+
+ {{ $t('cards.toot.mute') }}
+
+
+ {{ $t('cards.toot.block') }}
+
+
{{ $t('cards.toot.report') }}
@@ -273,6 +279,15 @@ export default {
this.$store.dispatch('TimelineSpace/Modals/Report/openReport', this.originalMessage(message))
this.$refs.popper.doClose()
},
+ confirmMute (message) {
+ this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeAccount', this.originalMessage(message).account)
+ this.$store.dispatch('TimelineSpace/Modals/MuteConfirm/changeModal', true)
+ this.$refs.popper.doClose()
+ },
+ block (message) {
+ this.$store.dispatch('TimelineSpace/Contents/Cards/Toot/block', this.originalMessage(message).account)
+ this.$refs.popper.doClose()
+ },
changeReblog (message) {
if (message.reblogged) {
this.$store.dispatch('TimelineSpace/Contents/Cards/Toot/unreblog', message)
diff --git a/src/renderer/store/TimelineSpace/Contents/Cards/Toot.js b/src/renderer/store/TimelineSpace/Contents/Cards/Toot.js
index 4276169b..bbf2ee2a 100644
--- a/src/renderer/store/TimelineSpace/Contents/Cards/Toot.js
+++ b/src/renderer/store/TimelineSpace/Contents/Cards/Toot.js
@@ -54,6 +54,13 @@ const Toot = {
.then(() => {
return message
})
+ },
+ block ({ rootState, commit }, account) {
+ const client = new Mastodon(
+ rootState.TimelineSpace.account.accessToken,
+ rootState.TimelineSpace.account.baseURL + '/api/v1'
+ )
+ return client.post(`/accounts/${account.id}/block`)
}
}
}
From c53407b05af0741d7569a5cd875ce463901412b5 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Mon, 1 Oct 2018 00:10:20 +0900
Subject: [PATCH 3/3] refs #567 Update translations
---
src/config/locales/de/translation.json | 3 +++
src/config/locales/fr/translation.json | 3 +++
src/config/locales/ja/translation.json | 3 +++
src/config/locales/ko/translation.json | 5 ++++-
src/config/locales/pl/translation.json | 3 +++
5 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/config/locales/de/translation.json b/src/config/locales/de/translation.json
index 08283b40..7cbb9f4e 100644
--- a/src/config/locales/de/translation.json
+++ b/src/config/locales/de/translation.json
@@ -222,6 +222,9 @@
"view_toot_detail": "Zeige Toot-Details",
"open_in_browser": "Im Browser öffnen",
"copy_link_to_toot": "Link zum Toot kopieren",
+ "mute": "Mute",
+ "block": "Block",
+ "report": "Report",
"delete": "Löschen",
"via": "via {{application}}",
"reply": "Antworten",
diff --git a/src/config/locales/fr/translation.json b/src/config/locales/fr/translation.json
index 372b2050..4f4e5811 100644
--- a/src/config/locales/fr/translation.json
+++ b/src/config/locales/fr/translation.json
@@ -222,6 +222,9 @@
"view_toot_detail": "Voir les détails du pouet",
"open_in_browser": "Ouvrir dans un navigateur",
"copy_link_to_toot": "Copier le lien du pouet",
+ "mute": "Mute",
+ "block": "Block",
+ "report": "Report",
"delete": "Effacer",
"via": "par {{application}}",
"reply": "Répondre",
diff --git a/src/config/locales/ja/translation.json b/src/config/locales/ja/translation.json
index 8dcfc7a7..d4b52901 100644
--- a/src/config/locales/ja/translation.json
+++ b/src/config/locales/ja/translation.json
@@ -222,6 +222,9 @@
"view_toot_detail": "詳細",
"open_in_browser": "ブラウザで開く",
"copy_link_to_toot": "コピー",
+ "mute": "ミュート",
+ "block": "ブロック",
+ "report": "通報",
"delete": "削除する",
"via": "{{application}} より",
"reply": "返信",
diff --git a/src/config/locales/ko/translation.json b/src/config/locales/ko/translation.json
index c956779d..037b4389 100644
--- a/src/config/locales/ko/translation.json
+++ b/src/config/locales/ko/translation.json
@@ -222,6 +222,9 @@
"view_toot_detail": "툿 자세히 보기",
"open_in_browser": "브라우저에서 열기",
"copy_link_to_toot": "툿 링크 복사하기",
+ "mute": "뮤트",
+ "block": "차단",
+ "report": "Report",
"delete": "삭제",
"via": "{{application}} 에서",
"reply": "답장하기",
@@ -251,7 +254,7 @@
},
"hashtag": {
"tag_name": "태그 이름",
- "delete_tag": "태그 삭제",
+ "delete_tag": "태그 삭제",
"save_tag": "태그 저장"
},
"search": {
diff --git a/src/config/locales/pl/translation.json b/src/config/locales/pl/translation.json
index bfe143e6..41e40218 100644
--- a/src/config/locales/pl/translation.json
+++ b/src/config/locales/pl/translation.json
@@ -222,6 +222,9 @@
"view_toot_detail": "Wyświetl szczegoły wpisu",
"open_in_browser": "Otwórz w przeglądarce",
"copy_link_to_toot": "Skopiuj odnośnik do wpisu",
+ "mute": "Mute",
+ "block": "Block",
+ "report": "Report",
"delete": "Usuń",
"via": "przez {{application}}",
"reply": "Odpowiadać",