Skip to content

Commit e9fa4a6

Browse files
committed
feat: populate state of ignored board checkboxes
1 parent 26ba539 commit e9fa4a6

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/components/settings/IgnoredBoardsPartial.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<input :id="board.id" @click="$emit('toggle-ignored-board', board.id)" :disabled="toggleSubmitted[board.id]" type="checkbox" />
2+
<input :id="board.id" :checked="allBoards[board.id]" @change="$emit('toggle-ignored-board', board.id)" :disabled="toggleSubmitted[board.id]" type="checkbox" />
33
<label :for="board.id">{{board.name}}</label>
44
<ul>
55
<li v-for="childboard in board.children" :key="childboard.id">

src/views/Settings.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
</template>
7878

7979
<script>
80-
import { inject, reactive, toRefs } from 'vue'
80+
import { inject, reactive, toRefs, watch } from 'vue'
8181
// import { AuthStore } from '@/composables/stores/auth'
8282
import { PreferencesStore } from '@/composables/stores/prefs'
8383
import IgnoredBoardsPartial from '@/components/settings/IgnoredBoardsPartial.vue'
@@ -94,6 +94,22 @@ export default {
9494
next()
9595
},
9696
setup() {
97+
/* Internal Methods */
98+
const initAllBoards = (boards, allBoards) => {
99+
if (!boards || !boards.length) return allBoards
100+
101+
for (let i = 0; i < boards.length; i++) {
102+
let curBoard = boards[i]
103+
allBoards = initAllBoards(curBoard.boards || [], allBoards)
104+
if (curBoard.category_id) {
105+
allBoards[curBoard.id] = $prefs.readonly.ignored_boards.indexOf(curBoard.id) > -1
106+
}
107+
}
108+
109+
return allBoards
110+
}
111+
112+
97113
/* View Methods */
98114
const resetLimitPrefs = () => {
99115
v.posts_per_page = $prefs.readonly.posts_per_page
@@ -176,6 +192,8 @@ export default {
176192
]
177193
})
178194
195+
watch(() => v.boards, () => v.allBoards = initAllBoards(v.boards, v.allBoards))
196+
179197
return { ...toRefs(v), resetLimitPrefs, saveLimitPrefs, resetTimezonePrefs, saveTimezonePrefs, timezonePrefsValid, togglePatroller, toggleIgnoredBoard }
180198
}
181199
}

0 commit comments

Comments
 (0)