Merge branch 'sabrecat/cshop' into subs-private

This commit is contained in:
Sabe Jones
2024-04-23 10:52:05 -05:00
5 changed files with 18 additions and 9 deletions

View File

@@ -35,13 +35,9 @@
/>
</a>
<a
class="topbar-dropdown-item dropdown-item"
class="topbar-dropdown-item dropdown-item dropdown-separated"
@click="showAvatar('body', 'size')"
>{{ $t('editAvatar') }}</a>
<a
class="topbar-dropdown-item dropdown-item dropdown-separated"
@click="showAvatar('backgrounds', '2024')"
>{{ $t('backgrounds') }}</a>
<a
class="topbar-dropdown-item dropdown-item"
@click="showProfile('profile')"

View File

@@ -132,7 +132,7 @@ export default {
},
methods: {
getKeyProp (item) {
return this.keyProp ? item[this.keyProp] : item;
return this.keyProp ? item[this.keyProp] : item.key;
},
isDisabled (item) {
return typeof item[this.disabledProp] === 'undefined' ? false : item[this.disabledProp];

View File

@@ -24,7 +24,7 @@ function inListMatcher (list) {
};
}
const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [
export const ALWAYS_AVAILABLE_CUSTOMIZATIONS = [
'animalSkins',
'rainbowSkins',
'rainbowHairColors',
@@ -843,16 +843,23 @@ export function getScheduleMatchingGroup (type, date) {
const checkedDate = date || new Date();
if (cacheDate !== null && (getDay(checkedDate) !== getDay(cacheDate)
|| getMonth(checkedDate) !== getMonth(cacheDate))) {
// Clear cached matchers, since they are old
cacheDate = null;
cachedScheduleMatchers = null;
}
if (!cachedScheduleMatchers) {
// No matchers exist, make new ones
cacheDate = new Date();
cachedScheduleMatchers = {};
assembleScheduledMatchers(checkedDate).forEach(matcher => {
if (!cachedScheduleMatchers[matcher.type]) {
cachedScheduleMatchers[matcher.type] = makeMatcherClass();
}
let end = moment(checkedDate);
end.date(TYPE_SCHEDULE[type]);
if (end.date() <= moment(checkedDate).date()) {
end = moment(end).add(1, 'months');
}
cachedScheduleMatchers[matcher.type].end = end.toDate();
if (matcher.matcher instanceof Function) {
cachedScheduleMatchers[matcher.type].matchers.push(matcher.matcher);
@@ -862,6 +869,7 @@ export function getScheduleMatchingGroup (type, date) {
});
}
if (!cachedScheduleMatchers[type]) {
// No matchers exist for this type
return {
items: [],
match () {

View File

@@ -8,6 +8,8 @@ import isPinned from './isPinned';
import isFreeRebirth from './isFreeRebirth';
import getOfficialPinnedItems from './getOfficialPinnedItems';
import { ALWAYS_AVAILABLE_CUSTOMIZATIONS } from '../content/constants/schedule';
function lockQuest (quest, user) {
// checks series quests, including Masterclasser
if (quest.prereqQuests) {
@@ -490,8 +492,8 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang
throw new BadRequest(i18n.t('wrongItemType', { type }, language));
}
if (matcher) {
itemInfo.end = { matcher };
if (matcher && (!itemInfo.set || ALWAYS_AVAILABLE_CUSTOMIZATIONS.indexOf(itemInfo.set.key) === -1)) {
itemInfo.end = matcher.end;
}
return itemInfo;

View File

@@ -582,6 +582,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
bg,
officialPinnedItems,
language,
matchers,
);
backgroundCategory.items.push(item);
}
@@ -617,6 +618,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
hairStyle,
officialPinnedItems,
language,
hairType === 'color' ? customizationMatcher : null,
);
category.items.push(item);
}
@@ -642,6 +644,7 @@ shops.getCustomizationsShopCategories = function getCustomizationsShopCategories
appearance,
officialPinnedItems,
language,
type === 'skin' ? customizationMatcher : null,
);
category.items.push(item);
}