fix(subs): establish lock to prevent race condition

This commit is contained in:
SabreCat
2022-11-01 20:47:21 -05:00
parent a2d5211b00
commit aea0be3245
18 changed files with 1146 additions and 720 deletions
@@ -280,6 +280,7 @@ import markdownDirective from '@/directives/markdown';
import { userStateMixin } from '../../mixins/userState';
import { TAVERN_ID, MIN_SHORTNAME_SIZE_FOR_CHALLENGES, MAX_SUMMARY_SIZE_FOR_CHALLENGES } from '@/../../common/script/constants';
import CategoryOptions from '@/../../common/script/content/categoryOptions';
export default {
directives: {
@@ -288,64 +289,7 @@ export default {
mixins: [userStateMixin],
props: ['groupId'],
data () {
const categoryOptions = [
{
label: 'habitica_official',
key: 'habitica_official',
},
{
label: 'academics',
key: 'academics',
},
{
label: 'advocacy_causes',
key: 'advocacy_causes',
},
{
label: 'creativity',
key: 'creativity',
},
{
label: 'entertainment',
key: 'entertainment',
},
{
label: 'finance',
key: 'finance',
},
{
label: 'health_fitness',
key: 'health_fitness',
},
{
label: 'hobbies_occupations',
key: 'hobbies_occupations',
},
{
label: 'location_based',
key: 'location_based',
},
{
label: 'mental_health',
key: 'mental_health',
},
{
label: 'getting_organized',
key: 'getting_organized',
},
{
label: 'self_improvement',
key: 'self_improvement',
},
{
label: 'spirituality',
key: 'spirituality',
},
{
label: 'time_management',
key: 'time_management',
},
];
const categoryOptions = CategoryOptions;
const hashedCategories = {};
categoryOptions.forEach(category => {
hashedCategories[category.key] = category.label;
@@ -89,70 +89,14 @@
import throttle from 'lodash/throttle';
import FilterSidebar from '@/components/ui/filterSidebar';
import FilterGroup from '@/components/ui/filterGroup';
import CategoryOptions from '@/../../common/script/content/categoryOptions';
export default {
components: { FilterGroup, FilterSidebar },
data () {
return {
categoryFilters: [],
categoryOptions: [
{
label: 'habitica_official',
key: 'habitica_official',
},
{
label: 'academics',
key: 'academics',
},
{
label: 'advocacy_causes',
key: 'advocacy_causes',
},
{
label: 'creativity',
key: 'creativity',
},
{
label: 'entertainment',
key: 'entertainment',
},
{
label: 'finance',
key: 'finance',
},
{
label: 'health_fitness',
key: 'health_fitness',
},
{
label: 'hobbies_occupations',
key: 'hobbies_occupations',
},
{
label: 'location_based',
key: 'location_based',
},
{
label: 'mental_health',
key: 'mental_health',
},
{
label: 'getting_organized',
key: 'getting_organized',
},
{
label: 'self_improvement',
key: 'self_improvement',
},
{
label: 'spirituality',
key: 'spirituality',
},
{
label: 'time_management',
key: 'time_management',
},
],
categoryOptions: CategoryOptions,
membershipFilters: [],
membershipOptions: [
{
@@ -379,6 +379,7 @@ import informationIcon from '@/assets/svg/information.svg';
import { MAX_SUMMARY_SIZE_FOR_GUILDS } from '@/../../common/script/constants';
import { userStateMixin } from '../../mixins/userState';
import CategoryOptions from '@/../../common/script/content/categoryOptions';
// @TODO: Not sure the best way to pass party creating status
// Since we need the modal in the header, passing props doesn't work
@@ -410,64 +411,7 @@ export default {
allowGuildInvitationsFromNonMembers: true,
bannedWordsAllowed: null,
},
categoryOptions: [
{
label: 'habitica_official',
key: 'habitica_official',
},
{
label: 'academics',
key: 'academics',
},
{
label: 'advocacy_causes',
key: 'advocacy_causes',
},
{
label: 'creativity',
key: 'creativity',
},
{
label: 'entertainment',
key: 'entertainment',
},
{
label: 'finance',
key: 'finance',
},
{
label: 'health_fitness',
key: 'health_fitness',
},
{
label: 'hobbies_occupations',
key: 'hobbies_occupations',
},
{
label: 'location_based',
key: 'location_based',
},
{
label: 'mental_health',
key: 'mental_health',
},
{
label: 'getting_organized',
key: 'getting_organized',
},
{
label: 'recovery_support_groups',
key: 'recovery_support_groups',
},
{
label: 'spirituality',
key: 'spirituality',
},
{
label: 'time_management',
key: 'time_management',
},
],
categoryOptions: CategoryOptions,
showCategorySelect: false,
members: [],
inviteMembers: false,
@@ -86,6 +86,7 @@
import throttle from 'lodash/throttle';
import FilterSidebar from '@/components/ui/filterSidebar';
import FilterGroup from '@/components/ui/filterGroup';
import CategoryOptions from '@/../../common/script/content/categoryOptions';
// TODO use checkbox-component to add/remove entries to *Filters, but without the v-model binding
@@ -94,64 +95,7 @@ export default {
data () {
return {
categoryFilters: [],
categoryOptions: [
{
label: 'habitica_official',
key: 'habitica_official',
},
{
label: 'academics',
key: 'academics',
},
{
label: 'advocacy_causes',
key: 'advocacy_causes',
},
{
label: 'creativity',
key: 'creativity',
},
{
label: 'entertainment',
key: 'entertainment',
},
{
label: 'finance',
key: 'finance',
},
{
label: 'health_fitness',
key: 'health_fitness',
},
{
label: 'hobbies_occupations',
key: 'hobbies_occupations',
},
{
label: 'location_based',
key: 'location_based',
},
{
label: 'mental_health',
key: 'mental_health',
},
{
label: 'getting_organized',
key: 'getting_organized',
},
{
label: 'recovery_support_groups',
key: 'recovery_support_groups',
},
{
label: 'spirituality',
key: 'spirituality',
},
{
label: 'time_management',
key: 'time_management',
},
],
categoryOptions: CategoryOptions,
roleFilters: [],
roleOptions: [
{
@@ -31,6 +31,11 @@
class="svg-icon inline lock"
v-html="icons.lock"
></span>
<span
v-if="item.completed"
class="svg-icon inline check"
v-html="icons.check"
></span>
<span
v-if="item.isSuggested"
class="suggestedDot"
@@ -200,6 +205,16 @@
color: $gray-200;
}
span.svg-icon.inline.check {
height: 12px;
width: 10px;
position: absolute;
left: 8px;
top: 8px;
margin-top: 0;
color: $gray-200;
}
span.badge.badge-round.badge-item.badge-clock {
height: 24px;
width: 24px;
@@ -246,6 +261,7 @@ import svgGem from '@/assets/svg/gem.svg';
import svgGold from '@/assets/svg/gold.svg';
import svgHourglasses from '@/assets/svg/hourglass.svg';
import svgLock from '@/assets/svg/lock.svg';
import svgCheck from '@/assets/svg/check.svg';
import svgClock from '@/assets/svg/clock.svg';
import EquipmentAttributesPopover from '@/components/inventory/equipment/attributesPopover';
@@ -297,6 +313,7 @@ export default {
gems: svgGem,
gold: svgGold,
lock: svgLock,
check: svgCheck,
hourglasses: svgHourglasses,
clock: svgClock,
}),
@@ -350,6 +367,7 @@ export default {
'highlight-border': this.highlightBorder,
suggested: this.item.isSuggested,
locked: this.item.locked,
completed: this.item.completed,
};
},
countdownString () {