Merge pull request #631 from h3poteto/iss-567
closes #567 Add reporting method and mute/block method on toot
This commit is contained in:
commit
1816a5a04b
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -222,6 +222,9 @@
|
|||
"view_toot_detail": "詳細",
|
||||
"open_in_browser": "ブラウザで開く",
|
||||
"copy_link_to_toot": "コピー",
|
||||
"mute": "ミュート",
|
||||
"block": "ブロック",
|
||||
"report": "通報",
|
||||
"delete": "削除する",
|
||||
"via": "{{application}} より",
|
||||
"reply": "返信",
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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ć",
|
||||
|
|
|
@ -94,7 +94,16 @@
|
|||
<li role="button" @click="copyLink(originalMessage(message))">
|
||||
{{ $t('cards.toot.copy_link_to_toot') }}
|
||||
</li>
|
||||
<li role="button" class="separate" @click="deleteToot(message)" v-show="isMyMessage(message)">
|
||||
<li role="button" class="separate" @click="confirmMute(message)">
|
||||
{{ $t('cards.toot.mute') }}
|
||||
</li>
|
||||
<li role="button" @click="block(message)">
|
||||
{{ $t('cards.toot.block') }}
|
||||
</li>
|
||||
<li role="button" @click="reportUser(message)" v-if="!isMyMessage(message)">
|
||||
{{ $t('cards.toot.report') }}
|
||||
</li>
|
||||
<li role="button" class="separate" @click="deleteToot(message)" v-if="isMyMessage(message)">
|
||||
{{ $t('cards.toot.delete') }}
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -266,6 +275,19 @@ 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()
|
||||
},
|
||||
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)
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<add-list-member></add-list-member>
|
||||
<mute-confirm></mute-confirm>
|
||||
<shortcut></shortcut>
|
||||
<report></report>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
:title="$t('modals.report.title')"
|
||||
:visible.sync="reportModal"
|
||||
width="400px"
|
||||
custom-class="report"
|
||||
>
|
||||
<el-input type="textarea" v-model="comment" :placeholder="$t('modals.report.comment')"></el-input>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeModal">{{ $t('modals.report.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="submit">{{ $t('modals.report.ok') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Report',
|
||||
data () {
|
||||
return {
|
||||
comment: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState('TimelineSpace/Modals/Report', {
|
||||
toot: state => state.message
|
||||
}),
|
||||
reportModal: {
|
||||
get () {
|
||||
return this.$store.state.TimelineSpace.Modals.Report.modalOpen
|
||||
},
|
||||
set (value) {
|
||||
this.$store.commit('TimelineSpace/Modals/Report/changeModalOpen', value)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
closeModal () {
|
||||
this.reportModal = false
|
||||
},
|
||||
async submit () {
|
||||
this.closeModal()
|
||||
await this.$store.dispatch('TimelineSpace/Modals/Report/submit', {
|
||||
account_id: this.toot.account.id,
|
||||
status_id: this.toot.id,
|
||||
comment: this.comment
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
|
@ -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`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue