Compare commits
1 Commits
backport/6
...
enh/option
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d6faf65e6 |
@@ -17,7 +17,7 @@
|
||||
- 🚀 Get your project organized
|
||||
|
||||
</description>
|
||||
<version>1.4.0-alpha1</version>
|
||||
<version>1.4.0</version>
|
||||
<licence>agpl</licence>
|
||||
<author>Julius Härtl</author>
|
||||
<namespace>Deck</namespace>
|
||||
|
||||
@@ -73,10 +73,11 @@ class BoardController extends ApiController {
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @param $archived
|
||||
* @param $upcoming_show_only_assigned_cards
|
||||
* @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, $upcoming_show_only_assigned_cards) {
|
||||
return $this->boardService->update($id, $title, $color, $archived, $upcoming_show_only_assigned_cards);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ class Board extends RelationalEntity {
|
||||
protected $stacks = [];
|
||||
protected $deletedAt = 0;
|
||||
protected $lastModified = 0;
|
||||
protected $upcoming_show_only_assigned_cards = true;
|
||||
|
||||
protected $settings = [];
|
||||
|
||||
@@ -45,6 +46,7 @@ class Board extends RelationalEntity {
|
||||
$this->addType('archived', 'boolean');
|
||||
$this->addType('deletedAt', 'integer');
|
||||
$this->addType('lastModified', 'integer');
|
||||
$this->addType('upcoming_show_only_assigned_cards', 'boolean');
|
||||
$this->addRelation('labels');
|
||||
$this->addRelation('acl');
|
||||
$this->addRelation('shared');
|
||||
|
||||
@@ -66,7 +66,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
* @throws DoesNotExistException
|
||||
*/
|
||||
public function find($id, $withLabels = false, $withAcl = false) {
|
||||
$sql = 'SELECT id, title, owner, color, archived, deleted_at, last_modified FROM `*PREFIX*deck_boards` ' .
|
||||
$sql = 'SELECT id, title, owner, color, archived, deleted_at, last_modified, upcoming_show_only_assigned_cards FROM `*PREFIX*deck_boards` ' .
|
||||
'WHERE `id` = ?';
|
||||
$board = $this->findEntity($sql, [$id]);
|
||||
|
||||
@@ -105,12 +105,12 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
*/
|
||||
public function findAllByUser($userId, $limit = null, $offset = null, $since = -1, $includeArchived = true) {
|
||||
// FIXME: One moving to QBMapper we should allow filtering the boards probably by method chaining for additional where clauses
|
||||
$sql = 'SELECT id, title, owner, color, archived, deleted_at, 0 as shared, last_modified FROM `*PREFIX*deck_boards` WHERE owner = ? AND last_modified > ?';
|
||||
$sql = 'SELECT id, title, owner, color, archived, deleted_at, 0 as shared, last_modified, upcoming_show_only_assigned_cards FROM `*PREFIX*deck_boards` WHERE owner = ? AND last_modified > ?';
|
||||
if (!$includeArchived) {
|
||||
$sql .= ' AND NOT archived AND deleted_at = 0';
|
||||
}
|
||||
$sql .= ' UNION ' .
|
||||
'SELECT boards.id, title, owner, color, archived, deleted_at, 1 as shared, last_modified FROM `*PREFIX*deck_boards` as boards ' .
|
||||
'SELECT boards.id, title, owner, color, archived, deleted_at, 1 as shared, last_modified, upcoming_show_only_assigned_cards FROM `*PREFIX*deck_boards` as boards ' .
|
||||
'JOIN `*PREFIX*deck_board_acl` as acl ON boards.id=acl.board_id WHERE acl.participant=? AND acl.type=? AND boards.owner != ? AND last_modified > ?';
|
||||
if (!$includeArchived) {
|
||||
$sql .= ' AND NOT archived AND deleted_at = 0';
|
||||
@@ -142,7 +142,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
if (count($groups) <= 0) {
|
||||
return [];
|
||||
}
|
||||
$sql = 'SELECT boards.id, title, owner, color, archived, deleted_at, 2 as shared, last_modified FROM `*PREFIX*deck_boards` as boards ' .
|
||||
$sql = 'SELECT boards.id, title, owner, color, archived, deleted_at, 2 as shared, last_modified, upcoming_show_only_assigned_cards FROM `*PREFIX*deck_boards` as boards ' .
|
||||
'INNER JOIN `*PREFIX*deck_board_acl` as acl ON boards.id=acl.board_id WHERE owner != ? AND type=? AND (';
|
||||
for ($i = 0, $iMax = count($groups); $i < $iMax; $i++) {
|
||||
$sql .= 'acl.participant = ? ';
|
||||
@@ -174,7 +174,7 @@ class BoardMapper extends DeckMapper implements IPermissionMapper {
|
||||
return [];
|
||||
}
|
||||
|
||||
$sql = 'SELECT boards.id, title, owner, color, archived, deleted_at, 2 as shared, last_modified FROM `*PREFIX*deck_boards` as boards ' .
|
||||
$sql = 'SELECT boards.id, title, owner, color, archived, deleted_at, 2 as shared, last_modified, upcoming_show_only_assigned_cards FROM `*PREFIX*deck_boards` as boards ' .
|
||||
'INNER JOIN `*PREFIX*deck_board_acl` as acl ON boards.id=acl.board_id WHERE owner != ? AND type=? AND (';
|
||||
for ($i = 0, $iMax = count($circles); $i < $iMax; $i++) {
|
||||
$sql .= 'acl.participant = ? ';
|
||||
|
||||
26
lib/Migration/Version010404Date20210305.php
Normal file
26
lib/Migration/Version010404Date20210305.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace OCA\Deck\Migration;
|
||||
|
||||
use Closure;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
||||
class Version010404Date20210305 extends SimpleMigrationStep {
|
||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('deck_boards');
|
||||
if (!$table->hasColumn('upcoming_show_only_assigned_cards')) {
|
||||
$table->addColumn('upcoming_show_only_assigned_cards', 'boolean', [
|
||||
'notnull' => false,
|
||||
'default' => true
|
||||
]);
|
||||
}
|
||||
return $schema;
|
||||
}
|
||||
}
|
||||
@@ -422,13 +422,14 @@ class BoardService {
|
||||
* @param $title
|
||||
* @param $color
|
||||
* @param $archived
|
||||
* @param $upcoming_show_only_assigned_cards
|
||||
* @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, $upcoming_show_only_assigned_cards) {
|
||||
if (is_numeric($id) === false) {
|
||||
throw new BadRequestException('board id must be a number');
|
||||
}
|
||||
@@ -445,12 +446,17 @@ class BoardService {
|
||||
throw new BadRequestException('archived must be a boolean');
|
||||
}
|
||||
|
||||
if (is_bool($upcoming_show_only_assigned_cards) === false) {
|
||||
throw new BadRequestException('upcoming_show_only_assigned_cards 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->setUpcoming_show_only_assigned_cards($upcoming_show_only_assigned_cards);
|
||||
$changes->setAfter($board);
|
||||
$this->boardMapper->update($board); // operate on clone so we can check for updated fields
|
||||
$this->boardMapper->mapOwner($board);
|
||||
|
||||
@@ -112,6 +112,12 @@
|
||||
{{ dueDateReminderText }}
|
||||
</ActionButton>
|
||||
|
||||
<ActionCheckbox v-if="canManage"
|
||||
:checked="board.upcoming_show_only_assigned_cards"
|
||||
@change="actionToggleUpcoming_show_only_assigned_cards">
|
||||
{{ t('deck', 'Show only cards assigned to me in upcoming view') }}
|
||||
</ActionCheckbox>
|
||||
|
||||
<ActionButton v-if="canManage && !isDueSubmenuActive"
|
||||
icon="icon-delete"
|
||||
:close-after-click="true"
|
||||
@@ -133,7 +139,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { AppNavigationIconBullet, AppNavigationCounter, AppNavigationItem, ColorPicker, Actions, ActionButton } from '@nextcloud/vue'
|
||||
import { AppNavigationIconBullet, AppNavigationCounter, AppNavigationItem, ColorPicker, Actions, ActionButton, ActionCheckbox } from '@nextcloud/vue'
|
||||
import ClickOutside from 'vue-click-outside'
|
||||
|
||||
export default {
|
||||
@@ -145,6 +151,7 @@ export default {
|
||||
ColorPicker,
|
||||
Actions,
|
||||
ActionButton,
|
||||
ActionCheckbox,
|
||||
},
|
||||
directives: {
|
||||
ClickOutside,
|
||||
@@ -311,6 +318,9 @@ export default {
|
||||
this.isDueSubmenuActive = false
|
||||
this.updateDueSetting = null
|
||||
},
|
||||
actionToggleUpcoming_show_only_assigned_cards() {
|
||||
this.$store.dispatch('toggleUpcoming_show_only_assigned_cards', this.board)
|
||||
},
|
||||
},
|
||||
inject: [
|
||||
'boardApi',
|
||||
|
||||
@@ -308,6 +308,13 @@ export default new Vuex.Store({
|
||||
Vue.delete(state.currentBoard.acl, removeIndex)
|
||||
}
|
||||
},
|
||||
toggleUpcoming_show_only_assigned_cards(state, board) {
|
||||
let currentBoard = state.boards.filter((b) => {
|
||||
return board.id === b.id
|
||||
})
|
||||
currentBoard = currentBoard[0]
|
||||
Vue.set(currentBoard, 'upcoming_show_only_assigned_cards', board.upcoming_show_only_assigned_cards)
|
||||
},
|
||||
|
||||
},
|
||||
actions: {
|
||||
@@ -490,5 +497,13 @@ export default new Vuex.Store({
|
||||
dispatch('loadBoardById', acl.boardId)
|
||||
})
|
||||
},
|
||||
toggleUpcoming_show_only_assigned_cards({ commit }, board) {
|
||||
const boardCopy = JSON.parse(JSON.stringify(board))
|
||||
boardCopy.upcoming_show_only_assigned_cards = !boardCopy.upcoming_show_only_assigned_cards
|
||||
apiClient.updateBoard(boardCopy)
|
||||
.then((board) => {
|
||||
commit('toggleUpcoming_show_only_assigned_cards', board)
|
||||
})
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user