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 d228a5769b..60b6b30515 100644 --- a/website/client/src/components/userMenu/profile.vue +++ b/website/client/src/components/userMenu/profile.vue @@ -58,6 +58,18 @@ v-html="icons.positive" > + + + 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 bb07735c43..5a1ff43278 100644 --- a/website/common/locales/en/generic.json +++ b/website/common/locales/en/generic.json @@ -222,5 +222,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 3717a9f713..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, }); } diff --git a/website/server/libs/slack.js b/website/server/libs/slack.js index d7736ec91e..3d8afb1eef 100644 --- a/website/server/libs/slack.js +++ b/website/server/libs/slack.js @@ -180,10 +180,11 @@ function sendProfileFlagNotification ({ reporter, flaggedUser, userComment, + source, }) { const title = 'User Profile Report'; - const titleLink = `${BASE_URL}/static/front/#?memberId=${flaggedUser._id}`; - let 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}`; }
+ {{ displayName }} + {{ username }} +
{{ username }}
+