Skip to content

Commit

Permalink
Merge pull request #126 from ebspark/hide-save-state
Browse files Browse the repository at this point in the history
  • Loading branch information
twhlynch authored Sep 24, 2024
2 parents c2dc550 + 3566eee commit 5eaf7cf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion website/src/components/CardLevel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default {
<div class="description">{{ item.description }}</div>
<VerifyLevelButton v-if="isVerifier && this.listType !== 'tab_deletion_queue'" :level-info="item"/>
<SkipLevelButton v-if="isVerifier && this.listType === 'tab_verify_queue'" :level-info="item"/>
<HideLevelButton v-show="!isHidden" v-if="!isHidden && isSuperModerator && !isModerationCell && this.listType !== 'tab_verify_queue' && this.listType !== 'tab_deletion_queue'" :level_id="item.identifier" @handled="didHandleCell" @hideBtn="hideState"/>
<HideLevelButton v-show="!isHidden" v-if="!isHidden && (isSuperModerator || isAdmin) && !isModerationCell && this.listType !== 'tab_verify_queue' && this.listType !== 'tab_deletion_queue'" :level_id="item.identifier" @handled="didHandleCell" @hideBtn="hideState"/>
<HideTipLevelButton v-if="isAdmin && !isModerationCell && !isHidden && this.listType !== 'tab_verify_queue'" :level_id="item.identifier" @handled="didHandleCell"/>
<UnhideLevelButton v-show="isHidden" v-if="isSuperModerator && !isModerationCell && this.listType !== 'tab_verify_queue'" :level_id="item.identifier" @handled="didHandleCell" @click="hideState"/>
<UnscheduleDeletionButton v-if="isSuperModerator && this.listType === 'tab_deletion_queue'" :level_id="item.identifier" @handled="didHandleCell"/>
Expand Down
19 changes: 13 additions & 6 deletions website/src/components/ScrollList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ export default {
const types = ['tab_reported_levels']
return types.includes(this.listType)
},
...mapState(useUserStore, ['isLoggedIn']),
...mapState(useUserStore, ['userID']),
...mapState(useUserStore, ['accessToken'])
...mapState(useUserStore, ['isLoggedIn', 'userID', 'accessToken', 'getProcessedList', 'pushProcessedList', 'isAdmin', 'isSuperModerator']),
},
watch: {
Expand Down Expand Up @@ -143,13 +141,16 @@ export default {
otherUserID: this.otherUserID
}
const levels = await this.loadLevels()
let levels = await this.loadLevels()
if(this.activeLoad.searchTerm !== this.searchTerm ||
this.activeLoad.listType !== this.listType ||
this.activeLoad.difficulty!== this.difficulty ||
this.activeLoad.tag!== this.tag ||
this.activeLoad.otherUserID!== this.otherUserID) return
const processedItems = this.getProcessedList(this.listType);
if (processedItems) levels = levels.filter(item => !processedItems.includes(item));
this.items = [...this.items, ...levels]
const userStore = useUserStore()
userStore.setList(this.items)
Expand Down Expand Up @@ -200,14 +201,20 @@ export default {
resetReportsRequest(this.$api_server_url, this.accessToken, userID)
]);
if (actionSuccess && reportsSuccess) {
this.pushProcessedList(this.listType, item);
}
const success = actionSuccess && reportsSuccess ? 1 : 0;
return { success };
});
const results = await Promise.all(promises);
const successes = results.reduce((total, result) => total + result.success, 0);
alert(successes + ' users punished');
this.items = [];
if(this.listType === "tab_reported_users"){
this.items = [];
}
}
},
Expand All @@ -223,7 +230,7 @@ export default {
<template>
<button v-if="listType == 'tab_reported_users'" id="punish-all-button" @click="punishAllUsers">Punish All</button>
<button v-if="listType == 'tab_reported_users' && (isAdmin || isSuperModerator)" id="punish-all-button" @click="punishAllUsers">Punish All</button>
<div class="grid-container" :style="listType == 'tab_audit' ? 'grid-template-columns: 1fr' : ''">
<div v-for="(item, index) in items" :key="index" class="grid-item">
<CardUser v-if="wantsUserCells" :item="'object_info' in item? item.object_info : item" :moderationItem="'object_info' in item? item : null" @profile="showOtherUserLevels" />
Expand Down
9 changes: 8 additions & 1 deletion website/src/stores/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export const useUserStore = defineStore('user', {
expires: 0,
favoriteLevels: [],
list: [],
listIndex: null
listIndex: null,
processedList: {}
}),

getters: {
Expand Down Expand Up @@ -84,6 +85,12 @@ export const useUserStore = defineStore('user', {
this.favoriteLevels.push(level_id);
}
},
getProcessedList(listType){ //reported levels, reported users just so it doesnt reshow
return this.processedList[listType];
},
pushProcessedList(listType, item){
this.processedList[listType].push(item);
},
getListItem(index) {
return this.list[index];
},
Expand Down

0 comments on commit 5eaf7cf

Please sign in to comment.