diff --git a/website/client/src/components/header/menu.vue b/website/client/src/components/header/menu.vue index dcc471f41f..4a249b107e 100644 --- a/website/client/src/components/header/menu.vue +++ b/website/client/src/components/header/menu.vue @@ -3,6 +3,7 @@ + + +
+

{{ $t('reportPlayer') }}

+ +
+
+
+ {{ displayName }} +

{{ username }}

+
+
+ {{ $t('whyReportingPlayer') }} + +
+

+

+
+ +
+ + + + + + + diff --git a/website/client/src/components/userMenu/profile.vue b/website/client/src/components/userMenu/profile.vue index cb6baec74c..e22284ea9e 100644 --- a/website/client/src/components/userMenu/profile.vue +++ b/website/client/src/components/userMenu/profile.vue @@ -828,7 +828,6 @@ } .info-item-value { - display: inline-block; float: right; } } @@ -1322,6 +1321,13 @@ export default { this.isOpened = true; this.$emit('toggled', this.isOpened); }, + reportPlayer () { + this.$root.$emit('habitica::report-profile', { + memberId: this.user._id, + displayName: this.user.profile.name, + username: this.user.auth.local.username, + }); + }, }, }; diff --git a/website/client/src/store/actions/members.js b/website/client/src/store/actions/members.js index 85e44251a2..fcf18bc0d3 100644 --- a/website/client/src/store/actions/members.js +++ b/website/client/src/store/actions/members.js @@ -114,3 +114,13 @@ export async function getPurchaseHistory (store, payload) { const response = await axios.get(`${apiv4Prefix}/members/${payload.memberId}/purchase-history`); return response.data.data; } + +export async function reportMember (store, payload) { + const url = `${apiv4Prefix}/members/${payload.memberId}/flag`; + const data = { + comment: payload.comment, + source: payload.source, + }; + const response = await axios.post(url, data); + return response.data.data; +} diff --git a/website/common/locales/en/generic.json b/website/common/locales/en/generic.json index 88d7a400f1..843b6ed277 100644 --- a/website/common/locales/en/generic.json +++ b/website/common/locales/en/generic.json @@ -230,5 +230,9 @@ "question": "Question", "questionDescriptionText": "It's okay to ask your questions in your primary language if you aren't comfortable speaking in English.", "questionPlaceholder": "Ask your question here", - "submitQuestion": "Submit Question" + "submitQuestion": "Submit Question", + "reportPlayer": "Report Player", + "whyReportingPlayer": "Why are you reporting this player?", + "whyReportingPlayerPlaceholder": "Reason for report", + "playerReportModalBody": "You should only report a player who violates the <%= firstLinkStart %>Community Guidelines<%= linkEnd %> and/or <%= secondLinkStart %>Terms of Service<%= linkEnd %>. Submitting a false report is a violation of Habitica’s Community Guidelines." } diff --git a/website/server/libs/chatReporting/profileReporter.js b/website/server/libs/chatReporting/profileReporter.js index e30f1b8099..aa56846abd 100644 --- a/website/server/libs/chatReporting/profileReporter.js +++ b/website/server/libs/chatReporting/profileReporter.js @@ -82,7 +82,7 @@ export default class ProfileReporter extends ChatReporter { return timestamp; } - notify (flaggedUser, comment) { + notify (flaggedUser, comment, source) { let emailVariables = this.getEmailVariables(flaggedUser); emailVariables = emailVariables.concat([ { name: 'REPORTER_COMMENT', content: comment || '' }, @@ -93,7 +93,8 @@ export default class ProfileReporter extends ChatReporter { slack.sendProfileFlagNotification({ reporter: this.user, flaggedUser, - comment, + userComment: comment, + source, }); } @@ -111,4 +112,4 @@ export default class ProfileReporter extends ChatReporter { } return flaggedUser; } -} \ No newline at end of file +} diff --git a/website/server/libs/slack.js b/website/server/libs/slack.js index 71dd019217..3d8afb1eef 100644 --- a/website/server/libs/slack.js +++ b/website/server/libs/slack.js @@ -180,14 +180,15 @@ function sendProfileFlagNotification ({ reporter, flaggedUser, userComment, + source, }) { const title = 'User Profile Report'; - const titleLink = `${BASE_URL}/static/front/#?memberId=${flaggedUser._id}`; - const text = `@${reporter.auth.local.username} (${reporter._id}; language: ${reporter.preferences.language}) flagged @${flaggedUser.auth.local.username}'s profile`; + const titleLink = `${BASE_URL}/profile/${flaggedUser._id}`; + let text = `@${reporter.auth.local.username} (${reporter._id}; language: ${reporter.preferences.language}) flagged @${flaggedUser.auth.local.username}'s profile from ${source}`; if (userComment) { text += ` and commented: ${userComment}`; } - const profileData = `Bio: ${flaggedUser.profile.blurb}`; + let profileData = `Bio: ${flaggedUser.profile.blurb}`; if (flaggedUser.profile.imageUrl) { profileData += `\n\nImage URL: ${flaggedUser.profile.imageUrl}`; }