Add report button to status ellipsis menu
This commit is contained in:
parent
3e7d1fbf23
commit
65dbf7b85d
7 changed files with 34 additions and 9 deletions
|
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Added Report button to status ellipsis menu for easier reporting
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Follows/Followers tabs on user profiles now display the content properly.
|
- Follows/Followers tabs on user profiles now display the content properly.
|
||||||
- Handle punycode in screen names
|
- Handle punycode in screen names
|
||||||
|
|
|
@ -35,7 +35,7 @@ const AccountActions = {
|
||||||
this.$store.dispatch('unblockUser', this.user.id)
|
this.$store.dispatch('unblockUser', this.user.id)
|
||||||
},
|
},
|
||||||
reportUser () {
|
reportUser () {
|
||||||
this.$store.dispatch('openUserReportingModal', this.user.id)
|
this.$store.dispatch('openUserReportingModal', { userId: this.user.id })
|
||||||
},
|
},
|
||||||
openChat () {
|
openChat () {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
faExternalLinkAlt
|
faExternalLinkAlt
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import {
|
import {
|
||||||
faBookmark as faBookmarkReg
|
faBookmark as faBookmarkReg,
|
||||||
|
faFlag
|
||||||
} from '@fortawesome/free-regular-svg-icons'
|
} from '@fortawesome/free-regular-svg-icons'
|
||||||
|
|
||||||
library.add(
|
library.add(
|
||||||
|
@ -19,7 +20,8 @@ library.add(
|
||||||
faEyeSlash,
|
faEyeSlash,
|
||||||
faThumbtack,
|
faThumbtack,
|
||||||
faShareAlt,
|
faShareAlt,
|
||||||
faExternalLinkAlt
|
faExternalLinkAlt,
|
||||||
|
faFlag
|
||||||
)
|
)
|
||||||
|
|
||||||
const ExtraButtons = {
|
const ExtraButtons = {
|
||||||
|
@ -66,6 +68,9 @@ const ExtraButtons = {
|
||||||
this.$store.dispatch('unbookmark', { id: this.status.id })
|
this.$store.dispatch('unbookmark', { id: this.status.id })
|
||||||
.then(() => this.$emit('onSuccess'))
|
.then(() => this.$emit('onSuccess'))
|
||||||
.catch(err => this.$emit('onError', err.error.error))
|
.catch(err => this.$emit('onError', err.error.error))
|
||||||
|
},
|
||||||
|
reportStatus () {
|
||||||
|
this.$store.dispatch('openUserReportingModal', { userId: this.status.user.id, statusIds: [this.status.id] })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -109,6 +109,16 @@
|
||||||
icon="external-link-alt"
|
icon="external-link-alt"
|
||||||
/><span>{{ $t("status.external_source") }}</span>
|
/><span>{{ $t("status.external_source") }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
<button
|
||||||
|
class="button-default dropdown-item dropdown-item-icon"
|
||||||
|
@click.prevent="reportStatus"
|
||||||
|
@click="close"
|
||||||
|
>
|
||||||
|
<FAIcon
|
||||||
|
fixed-width
|
||||||
|
:icon="['far', 'flag']"
|
||||||
|
/><span>{{ $t("user_card.report") }}</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -48,7 +48,7 @@ const UserReportingModal = {
|
||||||
// Reset state
|
// Reset state
|
||||||
this.comment = ''
|
this.comment = ''
|
||||||
this.forward = false
|
this.forward = false
|
||||||
this.statusIdsToReport = []
|
this.statusIdsToReport = this.$store.state.reports.preTickedIds
|
||||||
this.processing = false
|
this.processing = false
|
||||||
this.error = false
|
this.error = false
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,12 +4,14 @@ const reports = {
|
||||||
state: {
|
state: {
|
||||||
userId: null,
|
userId: null,
|
||||||
statuses: [],
|
statuses: [],
|
||||||
|
preTicked: [],
|
||||||
modalActivated: false
|
modalActivated: false
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
openUserReportingModal (state, { userId, statuses }) {
|
openUserReportingModal (state, { userId, statuses, preTickedIds }) {
|
||||||
state.userId = userId
|
state.userId = userId
|
||||||
state.statuses = statuses
|
state.statuses = statuses
|
||||||
|
state.preTickedIds = preTickedIds
|
||||||
state.modalActivated = true
|
state.modalActivated = true
|
||||||
},
|
},
|
||||||
closeUserReportingModal (state) {
|
closeUserReportingModal (state) {
|
||||||
|
@ -17,9 +19,15 @@ const reports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
openUserReportingModal ({ rootState, commit }, userId) {
|
openUserReportingModal ({ rootState, commit }, { userId, statusIds = [] }) {
|
||||||
const statuses = filter(rootState.statuses.allStatuses, status => status.user.id === userId)
|
const preTickedStatuses = statusIds.map(id => rootState.statuses.allStatusesObject[id])
|
||||||
commit('openUserReportingModal', { userId, statuses })
|
const preTickedIds = statusIds
|
||||||
|
const statuses = preTickedStatuses.concat(
|
||||||
|
filter(rootState.statuses.allStatuses,
|
||||||
|
status => status.user.id === userId && !preTickedIds.includes(status.id)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
commit('openUserReportingModal', { userId, statuses, preTickedIds })
|
||||||
},
|
},
|
||||||
closeUserReportingModal ({ commit }) {
|
closeUserReportingModal ({ commit }) {
|
||||||
commit('closeUserReportingModal')
|
commit('closeUserReportingModal')
|
||||||
|
|
|
@ -201,7 +201,6 @@ export const parseUser = (data) => {
|
||||||
// Convert punycode to unicode
|
// Convert punycode to unicode
|
||||||
if (output.screen_name.includes('@')) {
|
if (output.screen_name.includes('@')) {
|
||||||
const parts = output.screen_name.split('@')
|
const parts = output.screen_name.split('@')
|
||||||
console.log(parts)
|
|
||||||
let unicodeDomain = punycode.toUnicode(parts[1])
|
let unicodeDomain = punycode.toUnicode(parts[1])
|
||||||
if (unicodeDomain !== parts[1]) {
|
if (unicodeDomain !== parts[1]) {
|
||||||
// Add some identifier so users can potentially spot spoofing attempts:
|
// Add some identifier so users can potentially spot spoofing attempts:
|
||||||
|
|
Loading…
Reference in a new issue