Skip to content

Commit

Permalink
fix: issue with checkall uncheckall not working when submitting the b…
Browse files Browse the repository at this point in the history
…an form as admin
  • Loading branch information
akinsey committed May 6, 2021
1 parent 0857754 commit 57a995a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/modals/profile/ManageBans.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,18 @@ export default {
for (let i = 0; i < boards.length; i++) {
const curBoard = boards[i]
checkedBoardInputs = genBoardsObjFromArray(curBoard.boards || curBoard.children || [], checkedBoardInputs, checked)
if (curBoard.category_id || curBoard.parent_id) checkedBoardInputs[curBoard.id] = checked
if (checked && curBoard.category_id || curBoard.parent_id) checkedBoardInputs[curBoard.id] = true
}
return checkedBoardInputs
}
/* Template Methods */
const canGlobalBanUser = () => v.permUtils.hasPermission('bans.ban.allow')
const checkAll = checked => v.authedIsAdmin ? v.checkedBoardInputs = genBoardsObjFromArray(v.boards, {}, checked) : v.authedUser.moderating.forEach(bid => checked ? v.checkedBoardInputs[bid] = true : delete v.checkedBoardInputs[bid])
const checkAll = checked => {
if (v.authedIsAdmin) v.checkedBoardInputs = checked ? genBoardsObjFromArray(v.boards, {}, true) : {}
else v.authedUser.moderating.forEach(bid => checked ? v.checkedBoardInputs[bid] = true : delete v.checkedBoardInputs[bid])
}
const toggleIgnoredBoard = boardId => v.checkedBoardInputs[boardId] ? delete v.checkedBoardInputs[boardId] : v.checkedBoardInputs[boardId] = true
Expand All @@ -173,7 +176,6 @@ export default {
board_banned: Object.keys(v.checkedBoardInputs).length > 0
}
// Used for updating global bans
console.log(v.userCopy.banned_board_ids)
let globalBanParams = {
user_id: v.userCopy.id,
expiration: v.permanentBan ? undefined : v.banUntil,
Expand Down

0 comments on commit 57a995a

Please sign in to comment.