diff --git a/lib/Controller/BoardController.php b/lib/Controller/BoardController.php index 9d0b9fcaf..f33d08e41 100644 --- a/lib/Controller/BoardController.php +++ b/lib/Controller/BoardController.php @@ -73,10 +73,11 @@ class BoardController extends ApiController { * @param $title * @param $color * @param $archived + * @param $coverImages * @return \OCP\AppFramework\Db\Entity */ - public function update($id, $title, $color, $archived) { - return $this->boardService->update($id, $title, $color, $archived); + public function update($id, $title, $color, $archived, $coverImages) { + return $this->boardService->update($id, $title, $color, $archived, $coverImages); } /** diff --git a/lib/Db/Board.php b/lib/Db/Board.php index 6cf3c3206..0cdecf553 100644 --- a/lib/Db/Board.php +++ b/lib/Db/Board.php @@ -38,6 +38,7 @@ class Board extends RelationalEntity { protected $stacks = []; protected $deletedAt = 0; protected $lastModified = 0; + protected $coverImages = true; protected $settings = []; @@ -47,6 +48,7 @@ class Board extends RelationalEntity { $this->addType('archived', 'boolean'); $this->addType('deletedAt', 'integer'); $this->addType('lastModified', 'integer'); + $this->addType('coverImages', 'boolean'); $this->addRelation('labels'); $this->addRelation('acl'); $this->addRelation('shared'); diff --git a/lib/Migration/Version10400Date20210305.php b/lib/Migration/Version10400Date20210305.php new file mode 100644 index 000000000..3e298add8 --- /dev/null +++ b/lib/Migration/Version10400Date20210305.php @@ -0,0 +1,27 @@ +getTable('deck_boards'); + if (!$table->hasColumn('coverImages')) { + $table->addColumn('coverImages', 'boolean', [ + 'notnull' => false, + 'default' => true, + ]); + } + return $schema; + } +} diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index 1ee0a0cf2..2e49c4aa3 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -408,13 +408,14 @@ class BoardService { * @param $title * @param $color * @param $archived + * @param $coverImages * @return \OCP\AppFramework\Db\Entity * @throws DoesNotExistException * @throws \OCA\Deck\NoPermissionException * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException * @throws BadRequestException */ - public function update($id, $title, $color, $archived) { + public function update($id, $title, $color, $archived, $coverImages) { if (is_numeric($id) === false) { throw new BadRequestException('board id must be a number'); } @@ -431,12 +432,17 @@ class BoardService { throw new BadRequestException('archived must be a boolean'); } + if (is_bool($coverImages) === false) { + throw new BadRequestException('coverImages must be a boolean'); + } + $this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_MANAGE); $board = $this->find($id); $changes = new ChangeSet($board); $board->setTitle($title); $board->setColor($color); $board->setArchived($archived); + $board->setCoverImages($coverImages); $changes->setAfter($board); $this->boardMapper->update($board); // operate on clone so we can check for updated fields $this->boardMapper->mapOwner($board); diff --git a/src/components/cards/CardItem.vue b/src/components/cards/CardItem.vue index 3a0675792..2aba014dc 100644 --- a/src/components/cards/CardItem.vue +++ b/src/components/cards/CardItem.vue @@ -36,6 +36,7 @@

+ {{ attachments }} {{ card.title }}

@@ -121,6 +122,7 @@ export default { }), ...mapGetters([ 'isArchived', + ]), board() { return this.$store.getters.boardById(this?.stack?.boardId) @@ -128,6 +130,9 @@ export default { stack() { return this.$store.getters.stackById(this?.card?.stackId) }, + attachments() { + return [...this.$store.getters.attachmentsByCard(this.currentCard.id)].filter(attachment => attachment.deletedAt >= 0) + }, canEdit() { if (this.currentBoard) { return !this.currentBoard.archived && this.$store.getters.canEdit diff --git a/src/components/navigation/AppNavigationBoard.vue b/src/components/navigation/AppNavigationBoard.vue index e5ceaedf6..ddf77e6b2 100644 --- a/src/components/navigation/AppNavigationBoard.vue +++ b/src/components/navigation/AppNavigationBoard.vue @@ -111,7 +111,11 @@ @click="isDueSubmenuActive=true"> {{ dueDateReminderText }} - + + {{ t('deck', 'Show cover images') }} + diff --git a/src/store/main.js b/src/store/main.js index c157423bf..88676d464 100644 --- a/src/store/main.js +++ b/src/store/main.js @@ -311,6 +311,9 @@ export default new Vuex.Store({ Vue.delete(state.currentBoard.acl, removeIndex) } }, + toggleCoverImages(state) { + state.coverImages = !state.coverImages + }, }, actions: { @@ -497,5 +500,13 @@ export default new Vuex.Store({ dispatch('loadBoardById', acl.boardId) }) }, + toggleCoverImages({ commit }, board) { + const boardCopy = JSON.parse(JSON.stringify(board)) + boardCopy.coverImages = !boardCopy.coverImages + apiClient.updateBoard(boardCopy) + .then((board) => { + commit('toggleCoverImages', board) + }) + }, }, })