mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
* remove some unused dependencies * update mongoose version * make common tests pass * Make unit tests pass * make api v3 integration tests pass * fix lint issues * fix issue with package-lock * fix(lint): we don't need no .js * fix(lint): update to latest config-habitrpg * chore(npm): update package locks * fix(test): replace deprecated fn * chore(package): update eslint-habitrpg again * fix(lint): server linting * fix(lint): client linting * fix(client): correct mangled common imports * chore(npm): update package-locks * fix(lint): punctuation, module --------- Co-authored-by: SabreCat <sabrecat@gmail.com> Co-authored-by: SabreCat <sabe@habitica.com>
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import nconf from 'nconf';
|
|
import { convertVariableObjectToArray, sendTxn } from './email';
|
|
|
|
export async function bugReportLogic (user, userEmail, message, BROWSER_UA, question) {
|
|
const emailData = {
|
|
USER_ID: user._id,
|
|
USER_EMAIL: userEmail,
|
|
USER_USERNAME: user.auth.local.username,
|
|
USER_LEVEL: user.stats.lvl,
|
|
USER_CLASS: user.stats.class,
|
|
USER_DAILIES_PAUSED: user.preferences.sleep ? 'true' : 'false',
|
|
USER_COSTUME: user.preferences.costume ? 'true' : 'false',
|
|
USER_CUSTOM_DAY: user.preferences.dayStart,
|
|
USER_TIMEZONE_OFFSET: user.preferences.timezoneOffset,
|
|
USER_SUBSCRIPTION: user.purchased.plan.planId,
|
|
USER_PAYMENT_PLATFORM: user.purchased.plan.paymentMethod,
|
|
USER_CUSTOMER_ID: user.purchased.plan.customerId,
|
|
USER_CONSECUTIVE_MONTHS: user.purchased.plan.consecutive.count,
|
|
USER_OFFSET_MONTHS: user.purchased.plan.consecutive.offset,
|
|
USER_HOURGLASSES: user.purchased.plan.consecutive.trinkets,
|
|
REPORT_MSG: message,
|
|
BROWSER_UA,
|
|
};
|
|
|
|
const adminMail = { email: nconf.get('ADMIN_EMAIL') };
|
|
|
|
const sendMailResult = await sendTxn(
|
|
adminMail,
|
|
question ? 'ask-a-question' : 'report-a-bug',
|
|
convertVariableObjectToArray(emailData),
|
|
);
|
|
|
|
return {
|
|
sendMailResult,
|
|
emailData,
|
|
};
|
|
}
|