mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
fix(tests): post merge cleanup
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import { v4 as generateUUID } from 'uuid';
|
import { v4 as generateUUID } from 'uuid';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import nconf from 'nconf';
|
import nconf from 'nconf';
|
||||||
|
import { IncomingWebhook } from '@slack/webhook';
|
||||||
import {
|
import {
|
||||||
generateUser,
|
generateUser,
|
||||||
translate as t,
|
translate as t,
|
||||||
} from '../../../../helpers/api-integration/v3';
|
} from '../../../../helpers/api-integration/v3';
|
||||||
import { IncomingWebhook } from '@slack/webhook';
|
|
||||||
|
|
||||||
describe('POST /members/:memberId/flag', () => {
|
describe('POST /members/:memberId/flag', () => {
|
||||||
let reporter;
|
let reporter;
|
||||||
|
|||||||
@@ -197,14 +197,14 @@ describe('shared.ops.purchase', () => {
|
|||||||
|
|
||||||
it('purchases quest bundles', async () => {
|
it('purchases quest bundles', async () => {
|
||||||
const startingBalance = user.balance;
|
const startingBalance = user.balance;
|
||||||
// const clock = sandbox.useFakeTimers(moment('2019-05-20').valueOf());
|
const clock = sandbox.useFakeTimers(moment('2022-03-16').valueOf());
|
||||||
const type = 'bundles';
|
const type = 'bundles';
|
||||||
const key = 'featheredFriends';
|
const key = 'cuddleBuddies';
|
||||||
const price = 1.75;
|
const price = 1.75;
|
||||||
const questList = [
|
const questList = [
|
||||||
'falcon',
|
'bunny',
|
||||||
'harpy',
|
'ferret',
|
||||||
'owl',
|
'guineapig',
|
||||||
];
|
];
|
||||||
|
|
||||||
await purchase(user, { params: { type, key } });
|
await purchase(user, { params: { type, key } });
|
||||||
@@ -216,7 +216,7 @@ describe('shared.ops.purchase', () => {
|
|||||||
expect(user.balance).to.equal(startingBalance - price);
|
expect(user.balance).to.equal(startingBalance - price);
|
||||||
|
|
||||||
expect(pinnedGearUtils.removeItemByPath.notCalled).to.equal(true);
|
expect(pinnedGearUtils.removeItemByPath.notCalled).to.equal(true);
|
||||||
// clock.restore();
|
clock.restore();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -148,21 +148,6 @@ api.postChat = {
|
|||||||
const authorEmail = getUserInfo(user, ['email']).email;
|
const authorEmail = getUserInfo(user, ['email']).email;
|
||||||
const groupUrl = getGroupUrl(group);
|
const groupUrl = getGroupUrl(group);
|
||||||
|
|
||||||
const report = [
|
|
||||||
{ name: 'MESSAGE_TIME', content: (new Date()).toString() },
|
|
||||||
{ name: 'MESSAGE_TEXT', content: message },
|
|
||||||
|
|
||||||
{ name: 'AUTHOR_USERNAME', content: user.profile.name },
|
|
||||||
{ name: 'AUTHOR_UUID', content: user._id },
|
|
||||||
{ name: 'AUTHOR_EMAIL', content: authorEmail },
|
|
||||||
{ name: 'AUTHOR_MODAL_URL', content: `/profile/${user._id}` },
|
|
||||||
|
|
||||||
{ name: 'GROUP_NAME', content: group.name },
|
|
||||||
{ name: 'GROUP_TYPE', content: group.type },
|
|
||||||
{ name: 'GROUP_ID', content: group._id },
|
|
||||||
{ name: 'GROUP_URL', content: groupUrl },
|
|
||||||
];
|
|
||||||
|
|
||||||
// Slack the mods
|
// Slack the mods
|
||||||
slack.sendSlurNotification({
|
slack.sendSlurNotification({
|
||||||
authorEmail,
|
authorEmail,
|
||||||
@@ -223,21 +208,6 @@ api.postChat = {
|
|||||||
const authorEmail = getUserInfo(user, ['email']).email;
|
const authorEmail = getUserInfo(user, ['email']).email;
|
||||||
const groupUrl = getGroupUrl(group);
|
const groupUrl = getGroupUrl(group);
|
||||||
|
|
||||||
const report = [
|
|
||||||
{ name: 'MESSAGE_TIME', content: (new Date()).toString() },
|
|
||||||
{ name: 'MESSAGE_TEXT', content: message },
|
|
||||||
|
|
||||||
{ name: 'AUTHOR_USERNAME', content: user.profile.name },
|
|
||||||
{ name: 'AUTHOR_UUID', content: user._id },
|
|
||||||
{ name: 'AUTHOR_EMAIL', content: authorEmail },
|
|
||||||
{ name: 'AUTHOR_MODAL_URL', content: `/profile/${user._id}` },
|
|
||||||
|
|
||||||
{ name: 'GROUP_NAME', content: group.name },
|
|
||||||
{ name: 'GROUP_TYPE', content: group.type },
|
|
||||||
{ name: 'GROUP_ID', content: group._id },
|
|
||||||
{ name: 'GROUP_URL', content: groupUrl },
|
|
||||||
];
|
|
||||||
|
|
||||||
// Slack the mods
|
// Slack the mods
|
||||||
slack.sendShadowMutedPostNotification({
|
slack.sendShadowMutedPostNotification({
|
||||||
authorEmail,
|
authorEmail,
|
||||||
@@ -438,10 +408,6 @@ api.clearChatFlags = {
|
|||||||
message.flagCount = 0;
|
message.flagCount = 0;
|
||||||
await message.save();
|
await message.save();
|
||||||
|
|
||||||
const adminEmailContent = getUserInfo(user, ['email']).email;
|
|
||||||
const authorEmail = getAuthorEmailFromMessage(message);
|
|
||||||
const groupUrl = getGroupUrl(group);
|
|
||||||
|
|
||||||
res.respond(200, {});
|
res.respond(200, {});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default class GroupChatReporter extends ChatReporter {
|
|||||||
|
|
||||||
async notify (group, message, userComment, automatedComment = '') {
|
async notify (group, message, userComment, automatedComment = '') {
|
||||||
slack.sendFlagNotification({
|
slack.sendFlagNotification({
|
||||||
authorEmail: this.authorEmail,
|
authorEmail: this.user.auth.local.email,
|
||||||
flagger: this.user,
|
flagger: this.user,
|
||||||
group,
|
group,
|
||||||
message,
|
message,
|
||||||
|
|||||||
@@ -38,12 +38,6 @@ export default class InboxChatReporter extends ChatReporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async notify (message, userComment) {
|
async notify (message, userComment) {
|
||||||
const group = {
|
|
||||||
type: 'private messages',
|
|
||||||
name: 'N/A',
|
|
||||||
_id: 'N/A',
|
|
||||||
};
|
|
||||||
|
|
||||||
slack.sendInboxFlagNotification({
|
slack.sendInboxFlagNotification({
|
||||||
messageUserEmail: this.messageUserEmail,
|
messageUserEmail: this.messageUserEmail,
|
||||||
flagger: this.user,
|
flagger: this.user,
|
||||||
|
|||||||
Reference in New Issue
Block a user