mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
fix ci - revert reporter to user var
This commit is contained in:
@@ -47,7 +47,7 @@ describe('slack', () => {
|
||||
|
||||
expect(IncomingWebhook.prototype.send).to.be.calledOnce;
|
||||
expect(IncomingWebhook.prototype.send).to.be.calledWith({
|
||||
text: 'flagger (flagger-id; language: flagger-lang) flagged a message',
|
||||
text: 'flagger (flagger-id; language: flagger-lang) flagged a group message',
|
||||
attachments: [{
|
||||
fallback: 'Flag Message',
|
||||
color: 'danger',
|
||||
|
||||
@@ -39,6 +39,11 @@ const FLAG_REPORT_EMAILS = nconf.get('FLAG_REPORT_EMAIL').split(',').map((email)
|
||||
* @apiError (404) {badRequest} chatIdRequired A chat ID is required
|
||||
*/
|
||||
|
||||
/**
|
||||
* @apiDefine MessageIdRequired
|
||||
* @apiError (404) {badRequest} messageIdRequired A message ID is required
|
||||
*/
|
||||
|
||||
let api = {};
|
||||
|
||||
function textContainsBannedSlur (message) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class InboxChatReporter extends ChatReporter {
|
||||
constructor (req, res) {
|
||||
super(req, res);
|
||||
|
||||
this.reporter = res.locals.user;
|
||||
this.user = res.locals.user;
|
||||
this.inboxUser = res.locals.user;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export default class InboxChatReporter extends ChatReporter {
|
||||
let validationErrors = this.req.validationErrors();
|
||||
if (validationErrors) throw validationErrors;
|
||||
|
||||
if (this.reporter.contributor.admin && this.req.query.userId) {
|
||||
if (this.user.contributor.admin && this.req.query.userId) {
|
||||
this.inboxUser = await User.findOne({_id: this.req.query.userId});
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ export default class InboxChatReporter extends ChatReporter {
|
||||
|
||||
slack.sendInboxFlagNotification({
|
||||
authorEmail: this.authorEmail,
|
||||
flagger: this.reporter,
|
||||
flagger: this.user,
|
||||
message,
|
||||
userComment,
|
||||
});
|
||||
@@ -80,16 +80,16 @@ export default class InboxChatReporter extends ChatReporter {
|
||||
// Log user ids that have flagged the message
|
||||
if (!message.flags) message.flags = {};
|
||||
// TODO fix error type
|
||||
if (message.flags[this.reporter._id] && !this.reporter.contributor.admin) {
|
||||
if (message.flags[this.user._id] && !this.user.contributor.admin) {
|
||||
throw new NotFound(this.res.t('messageGroupChatFlagAlreadyReported'));
|
||||
}
|
||||
|
||||
return this.updateMessageAndSave(message, (m) => {
|
||||
m.flags[this.reporter._id] = true;
|
||||
m.flags[this.user._id] = true;
|
||||
|
||||
// Log total number of flags (publicly viewable)
|
||||
if (!m.flagCount) m.flagCount = 0;
|
||||
if (this.reporter.contributor.admin) {
|
||||
if (this.user.contributor.admin) {
|
||||
// Arbitrary amount, higher than 2
|
||||
m.flagCount = 5;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user