From ccf7148420cbf934b17a4dbf3fbfb1e975b4ee8b Mon Sep 17 00:00:00 2001 From: EB25Ball Date: Tue, 24 Sep 2024 09:54:02 -0400 Subject: [PATCH] hide punished users --- website/src/components/CardLevel.vue | 2 +- website/src/components/ScrollList.vue | 19 +++++++++++++------ website/src/stores/user.js | 9 ++++++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/website/src/components/CardLevel.vue b/website/src/components/CardLevel.vue index 4490987..664dc6e 100644 --- a/website/src/components/CardLevel.vue +++ b/website/src/components/CardLevel.vue @@ -205,7 +205,7 @@ export default {
{{ item.description }}
- + diff --git a/website/src/components/ScrollList.vue b/website/src/components/ScrollList.vue index 94aeeb9..312dfab 100644 --- a/website/src/components/ScrollList.vue +++ b/website/src/components/ScrollList.vue @@ -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: { @@ -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) @@ -200,6 +201,10 @@ 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 }; }); @@ -207,7 +212,9 @@ export default { 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 = []; + } } }, @@ -223,7 +230,7 @@ export default {