Upgrade to mongoose 7 (#14971)

* 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>
This commit is contained in:
Phillip Thelen
2024-01-16 22:18:47 +01:00
committed by GitHub
parent d0e4b533e3
commit f8d315ff6e
189 changed files with 2645 additions and 1423 deletions
+4 -2
View File
@@ -425,7 +425,8 @@ export default {
this.$store.state.isUserLoaded = true;
Analytics.setUser();
Analytics.updateUser();
return axios.get('/api/v4/i18n/browser-script',
return axios.get(
'/api/v4/i18n/browser-script',
{
language: this.user.preferences.language,
headers: {
@@ -433,7 +434,8 @@ export default {
Pragma: 'no-cache',
Expires: '0',
},
});
},
);
}).then(() => {
const i18nData = window && window['habitica-i18n'];
this.$loadLocale(i18nData);
@@ -1,6 +1,6 @@
import content from 'habitica/website/common/script/content/content';
import rightSidebar from '@/components/groups/rightSidebar';
import getters from '@/store/getters';
import content from '../../../../common/script/content';
export function createStory ({
template,
@@ -304,6 +304,7 @@
<script>
import orderBy from 'lodash/orderBy';
import * as quests from '@/../../common/script/content/quests';
import getItemInfo from '@/../../common/script/libs/getItemInfo';
import { mapState } from '@/libs/store';
import * as Analytics from '@/libs/analytics';
@@ -315,7 +316,6 @@ import questActionsMixin from './questActions.mixin';
import SelectTranslatedArray from '../tasks/modal-controls/selectTranslatedArray';
import QuestInfo from '../shops/quests/questInfo';
import Item from '@/components/inventory/item';
import getItemInfo from '../../../../common/script/libs/getItemInfo';
import CountBadge from '../ui/countBadge';
export default {
@@ -179,6 +179,7 @@
</style>
<script>
import { getClassName } from '@/../../common/script/libs/getClassName';
import { mapState } from '@/libs/store';
import svgClose from '@/assets/svg/close.svg';
@@ -193,7 +194,6 @@ import Avatar from '@/components/avatar';
import attributesGrid from '@/components/inventory/equipment/attributesGrid.vue';
import closeIcon from '@/components/shared/closeIcon';
// TODO @common/ path alias
import { getClassName } from '../../../../../common/script/libs/getClassName';
export default {
components: {
@@ -55,7 +55,7 @@ import {
UNEQUIP_EQUIPPED,
UNEQUIP_BACKGROUND,
UNEQUIP_PET_MOUNT,
} from '../../../../../common/script/ops/unequip';
} from '@/../../common/script/ops/unequip';
import unequipIcon from '@/assets/svg/unequip.svg';
@@ -149,10 +149,6 @@
color: $header-color;
}
.profile-name-character {
}
.character-name {
margin-bottom: 1px;
color: $white;
@@ -229,6 +225,7 @@
import { toNextLevel } from '@/../../common/script/statHelpers';
import statsComputed from '@/../../common/script/libs/statsComputed';
import percent from '@/../../common/script/libs/percent';
import { getClassName } from '@/../../common/script/libs/getClassName';
import Avatar from './avatar';
import ClassBadge from './members/classBadge';
import { mapState } from '@/libs/store';
@@ -240,7 +237,6 @@ import healthIcon from '@/assets/svg/health.svg';
import experienceIcon from '@/assets/svg/experience.svg';
import manaIcon from '@/assets/svg/mana.svg';
import InlineClassBadge from './members/inlineClassBadge';
import { getClassName } from '../../../common/script/libs/getClassName';
export default {
components: {
@@ -75,6 +75,7 @@
import _filter from 'lodash/filter';
import _orderBy from 'lodash/orderBy';
import shops from '@/../../common/script/libs/shops';
import { getClassName } from '@/../../common/script/libs/getClassName';
import { mapState } from '@/libs/store';
import LayoutSection from '@/components/ui/layoutSection';
import FilterDropdown from '@/components/ui/filterDropdown';
@@ -88,7 +89,6 @@ import svgRogue from '@/assets/svg/rogue.svg';
import svgHealer from '@/assets/svg/healer.svg';
import pinUtils from '../../../mixins/pinUtils';
import { getClassName } from '../../../../../common/script/libs/getClassName';
const sortGearTypes = [
'sortByType', 'sortByPrice', 'sortByCon',
@@ -351,6 +351,7 @@ import isPinned from '@/../../common/script/libs/isPinned';
import getOfficialPinnedItems from '@/../../common/script/libs/getOfficialPinnedItems';
import i18n from '@/../../common/script/i18n';
import shops from '@/../../common/script/libs/shops';
import { getClassName } from '@/../../common/script/libs/getClassName';
import { mapState } from '@/libs/store';
import Checkbox from '@/components/ui/checkbox';
@@ -369,7 +370,6 @@ import svgHealer from '@/assets/svg/healer.svg';
import SelectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
import FilterSidebar from '@/components/ui/filterSidebar';
import FilterGroup from '@/components/ui/filterGroup';
import { getClassName } from '../../../../../common/script/libs/getClassName';
import { worldStateMixin } from '@/mixins/worldState';
export default {
@@ -68,9 +68,9 @@
import debounce from 'lodash/debounce';
import find from 'lodash/find';
import { sleepAsync } from '@/../../common/script/libs/sleepAsync';
import { mapState } from '@/libs/store';
import notification from './notification';
import { sleepAsync } from '../../../../common/script/libs/sleepAsync';
import { getBannerHeight } from '@/libs/banner.func';
import { EVENTS } from '@/libs/events';
import { worldStateMixin } from '@/mixins/worldState';
@@ -448,8 +448,10 @@ export default {
this.$store.state.spellOptions.spellDrawOpen = newState;
if (newState) {
setLocalSetting(CONSTANTS.keyConstants.SPELL_DRAWER_STATE,
CONSTANTS.drawerStateValues.DRAWER_OPEN);
setLocalSetting(
CONSTANTS.keyConstants.SPELL_DRAWER_STATE,
CONSTANTS.drawerStateValues.DRAWER_OPEN,
);
return;
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Equivalent of jQuery's param
export default function (params) {
export default function encodeParams (params) {
return Object.keys(params).map(k => `${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`).join('&');
}
@@ -95,12 +95,12 @@
<script>
import axios from 'axios';
import moment from 'moment/moment';
import getUtcOffset from '@/../../common/script/fns/getUtcOffset';
import { mapState } from '@/libs/store';
import { InlineSettingMixin } from '../components/inlineSettingMixin';
import SaveCancelButtons from '../components/saveCancelButtons.vue';
import SelectList from '@/components/ui/selectList.vue';
import getUtcOffset from '../../../../../common/script/fns/getUtcOffset';
export default {
components: { SelectList, SaveCancelButtons },
@@ -139,6 +139,7 @@ input[type="number"] {
<script>
// import clone from 'lodash/clone';
import { MAX_LEVEL_HARD_CAP, MAX_FIELD_HARD_CAP } from '@/../../common/script/constants';
import SaveCancelButtons from '../components/saveCancelButtons.vue';
import { InlineSettingMixin } from '../components/inlineSettingMixin';
import healthIcon from '@/assets/svg/health.svg';
@@ -148,7 +149,6 @@ import svgGold from '@/assets/svg/gold.svg';
import level from '@/assets/svg/level.svg';
import streakIcon from '@/assets/svg/streak.svg';
import { mapState } from '@/libs/store';
import { MAX_LEVEL_HARD_CAP, MAX_FIELD_HARD_CAP } from '../../../../../common/script/constants';
export default {
components: { SaveCancelButtons },
@@ -45,9 +45,9 @@
<script>
import axios from 'axios';
import hello from 'hellojs';
import { SUPPORTED_SOCIAL_NETWORKS } from '@/../../common/script/constants';
import { buildAppleAuthUrl } from '@/libs/auth';
import { mapState } from '@/libs/store';
import { SUPPORTED_SOCIAL_NETWORKS } from '../../../../../common/script/constants';
import googleIcon from '@/assets/svg/google.svg';
import appleIcon from '@/assets/svg/apple_black.svg';
@@ -209,10 +209,10 @@ table {
<script>
import * as validator from 'validator';
import uuid from '@/../../common/script/libs/uuid';
import { mapState } from '@/libs/store';
import { InlineSettingMixin } from '../components/inlineSettingMixin';
import uuid from '../../../../../common/script/libs/uuid';
import positiveIcon from '@/assets/svg/positive.svg';
import ToggleSwitch from '@/components/ui/toggleSwitch.vue';
import menuIcon from '@/assets/svg/menu.svg';
+1 -1
View File
@@ -1,6 +1,6 @@
import { CONSTANTS, getLocalSetting, setLocalSetting } from '@/libs/userlocalManager';
export default function (to, from, next) {
export default function handleRedirect (to, from, next) {
const { redirect } = to.params;
switch (redirect) {
+7 -5
View File
@@ -5,10 +5,10 @@ import { togglePinnedItem as togglePinnedItemOp } from '@/../../common/script/op
import changeClassOp from '@/../../common/script/ops/changeClass';
import disableClassesOp from '@/../../common/script/ops/disableClasses';
import openMysteryItemOp from '@/../../common/script/ops/openMysteryItem';
import { unEquipByType } from '@/../../common/script/ops/unequip';
import markPMSRead from '@/../../common/script/ops/markPMSRead';
import updateStats from '@/../../common/script/fns/updateStats';
import { loadAsyncResource } from '@/libs/asyncResource';
import { unEquipByType } from '../../../../common/script/ops/unequip';
import markPMSRead from '../../../../common/script/ops/markPMSRead';
import updateStats from '../../../../common/script/fns/updateStats';
export function fetch (store, options = {}) { // eslint-disable-line no-shadow
return loadAsyncResource({
@@ -140,10 +140,12 @@ export async function rebirth () {
}
export async function togglePrivateMessagesOpt (store) {
const response = await axios.put('/api/v4/user',
const response = await axios.put(
'/api/v4/user',
{
'inbox.optOut': !store.state.user.data.inbox.optOut,
});
},
);
store.state.user.data.inbox.optOut = !store.state.user.data.inbox.optOut;
return response;
}
+1 -1
View File
@@ -43,7 +43,7 @@ if (i18nData) {
// always export the same route
let existingStore;
export default function () {
export default function clientStore () {
if (!IS_TEST && existingStore) return existingStore;
existingStore = new Store({