From b4563531dcfa27183756c29764a4472a19304b7b Mon Sep 17 00:00:00 2001 From: ByteZen Date: Sat, 9 Nov 2024 12:28:50 +0100 Subject: [PATCH] Prevent user from chaning the pin state of 'fixed' items as per api spec --- website/client/src/components/tasks/column.vue | 12 ++++++++++++ website/common/script/libs/getItemInfo.js | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/website/client/src/components/tasks/column.vue b/website/client/src/components/tasks/column.vue index 85a21ba9acc..7f0e3b108a0 100644 --- a/website/client/src/components/tasks/column.vue +++ b/website/client/src/components/tasks/column.vue @@ -131,6 +131,7 @@ > @@ -157,6 +158,13 @@ display: none; } + .badge-top.disabled { + .badge-pin { + background-color: $gray-50; + cursor: default; + } + } + .item:hover .badge-pin { display: block; } @@ -790,6 +798,10 @@ export default { return; } + if (!item.pinTogglable) { + return; + } + try { if (!this.$store.dispatch('user:togglePinnedItem', { type: item.pinType, path: item.path })) { this.text(this.$t('unpinnedItem', { item: item.text })); diff --git a/website/common/script/libs/getItemInfo.js b/website/common/script/libs/getItemInfo.js index 1ee0406c147..29dff2b9147 100644 --- a/website/common/script/libs/getItemInfo.js +++ b/website/common/script/libs/getItemInfo.js @@ -37,6 +37,13 @@ function isItemSuggested (officialPinnedItems, itemInfo) { }) > -1; } +function pinIsTogglable (itemInfo) { + if (itemInfo.path === 'armoire' || itemInfo.path === 'potion' || itemInfo.type === 'debuffPotion') { + return false; + } + return true; +} + function getDefaultGearProps (item, language) { return { key: item.key, @@ -483,6 +490,7 @@ export default function getItemInfo (user, type, item, officialPinnedItems, lang if (itemInfo) { itemInfo.isSuggested = isItemSuggested(officialPinnedItems, itemInfo); itemInfo.pinned = isPinned(user, itemInfo, officialPinnedItems); + itemInfo.pinTogglable = pinIsTogglable(itemInfo); } else { throw new BadRequest(i18n.t('wrongItemType', { type }, language)); }