Share boards and assign cards (#1293)

Share boards and assign cards
This commit is contained in:
Julius Härtl
2019-10-22 10:09:21 +02:00
committed by GitHub
9 changed files with 73 additions and 25 deletions

View File

@@ -5,10 +5,6 @@
background-image: url('../img/deck-dark.svg'); background-image: url('../img/deck-dark.svg');
} }
.icon-group {
background-image: url('../../../settings/img/users.svg');
}
.icon-help { .icon-help {
background-image: url('../../../settings/img/help.svg'); background-image: url('../../../settings/img/help.svg');
} }

View File

@@ -262,6 +262,27 @@ class PermissionService {
$users[$user->getUID()] = new User($user); $users[$user->getUID()] = new User($user);
} }
} }
if ($this->circlesEnabled && $acl->getType() === Acl::PERMISSION_TYPE_CIRCLE) {
try {
$circle = \OCA\Circles\Api\v1\Circles::detailsCircle($acl->getParticipant(), true);
if ($circle === null) {
$this->logger->info('No circle found for acl rule ' . $acl->getId());
continue;
}
foreach ($circle->getMembers() as $member) {
$user = $this->userManager->get($member->getUserId());
if ($user === null) {
$this->logger->info('No user found for circle member ' . $member->getUserId());
} else {
$users[$member->getUserId()] = new User($user);
}
}
} catch (\Exception $e) {
$this->logger->info('Member not found in circle that was accessed. This should not happen.');
}
}
} }
$this->users[(string) $boardId] = $users; $this->users[(string) $boardId] = $users;
return $this->users[(string) $boardId]; return $this->users[(string) $boardId];

View File

@@ -90,14 +90,21 @@ export default {
}, },
methods: { methods: {
fetchData() { fetchData() {
this.boardApi.loadById(this.id)
this.$store.dispatch('loadBoardById', this.id).then(response => {
this.$store.dispatch('loadStacks', this.id).then(response => {
this.loading = false
})
})
/* this.boardApi.loadById(this.id)
.then((board) => { .then((board) => {
this.$store.dispatch('setCurrentBoard', board) this.$store.dispatch('setCurrentBoard', board)
this.$store.dispatch('loadStacks', board) this.$store.dispatch('loadStacks', board)
this.$store.dispatch('setAssignableUsers', board.users) this.$store.dispatch('setAssignableUsers', board.users)
this.loading = false this.loading = false
this.$store.state.labels = board.labels this.$store.state.labels = board.labels
}) }) */
}, },
onDropStack({ removedIndex, addedIndex }) { onDropStack({ removedIndex, addedIndex }) {
this.$store.dispatch('orderStack', { stack: this.stacksByBoard[removedIndex], removedIndex, addedIndex }) this.$store.dispatch('orderStack', { stack: this.stacksByBoard[removedIndex], removedIndex, addedIndex })

View File

@@ -27,11 +27,11 @@
@close="closeSidebar"> @close="closeSidebar">
<AppSidebarTab :order="0" name="Sharing" icon="icon-shared"> <AppSidebarTab :order="0" name="Sharing" icon="icon-shared">
<SharingTabSidebard :board="board" /> <SharingTabSidebar :board="board" />
</AppSidebarTab> </AppSidebarTab>
<AppSidebarTab :order="1" name="Tags" icon="icon-tag"> <AppSidebarTab :order="1" name="Tags" icon="icon-tag">
<TagsTabSidebard :board="board" /> <TagsTabSidebar :board="board" />
</AppSidebarTab> </AppSidebarTab>
<AppSidebarTab :order="2" name="Deleted items" icon="icon-delete"> <AppSidebarTab :order="2" name="Deleted items" icon="icon-delete">
@@ -39,7 +39,7 @@
</AppSidebarTab> </AppSidebarTab>
<AppSidebarTab :order="3" name="Timeline" icon="icon-activity"> <AppSidebarTab :order="3" name="Timeline" icon="icon-activity">
<TimelineTabSidebard :board="board" /> <TimelineTabSidebar :board="board" />
</AppSidebarTab> </AppSidebarTab>
</app-sidebar> </app-sidebar>
@@ -47,10 +47,10 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import SharingTabSidebard from './SharingTabSidebard' import SharingTabSidebar from './SharingTabSidebar'
import TagsTabSidebard from './TagsTabSidebard' import TagsTabSidebar from './TagsTabSidebar'
import DeletedTabSidebar from './DeletedTabSidebar' import DeletedTabSidebar from './DeletedTabSidebar'
import TimelineTabSidebard from './TimelineTabSidebard' import TimelineTabSidebar from './TimelineTabSidebar'
import { AppSidebar, AppSidebarTab } from 'nextcloud-vue' import { AppSidebar, AppSidebarTab } from 'nextcloud-vue'
export default { export default {
@@ -58,10 +58,10 @@ export default {
components: { components: {
AppSidebar, AppSidebar,
AppSidebarTab, AppSidebarTab,
SharingTabSidebard, SharingTabSidebar,
TagsTabSidebard, TagsTabSidebar,
DeletedTabSidebar, DeletedTabSidebar,
TimelineTabSidebard TimelineTabSidebar
}, },
props: { props: {
id: { id: {

View File

@@ -20,9 +20,13 @@
</span> </span>
</li> </li>
<li v-for="acl in board.acl" :key="acl.participant.uid"> <li v-for="acl in board.acl" :key="acl.participant.uid">
<avatar :user="acl.participant.uid" /> <avatar v-if="acl.type===0" :user="acl.participant.uid" />
<div v-if="acl.type===1" class="avatardiv icon icon-group" />
<div v-if="acl.type===7" class="avatardiv icon icon-circles" />
<span class="has-tooltip username"> <span class="has-tooltip username">
{{ acl.participant.displayname }} {{ acl.participant.displayname }}
<span v-if="acl.type===1">{{ t('deck', '(Group)') }}</span>
<span v-if="acl.type===7">{{ t('deck', '(Circle)') }}</span>
</span> </span>
<Actions> <Actions>
@@ -47,7 +51,7 @@ import { CollectionList } from 'nextcloud-vue-collections'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'SharingTabSidebard', name: 'SharingTabSidebar',
components: { components: {
Avatar, Avatar,
Actions, Actions,
@@ -97,9 +101,13 @@ export default {
}, },
unallocatedSharees() { unallocatedSharees() {
return this.sharees.filter((sharee) => { return this.sharees.filter((sharee) => {
return Object.values(this.board.acl).findIndex((acl) => { let foundIndex = this.board.acl.findIndex((acl) => {
return acl.participant.uid === sharee.value.shareWith return acl.participant.uid === sharee.value.shareWith
}) })
if (foundIndex === -1) {
return true
}
return false
}) })
} }
}, },
@@ -156,4 +164,10 @@ export default {
.avatarLabel { .avatarLabel {
padding: 6px padding: 6px
} }
.avatardiv {
background-color: #f5f5f5;
border-radius: 16px;
width: 32px;
height: 32px;
}
</style> </style>

View File

@@ -49,7 +49,7 @@ import { Compact } from 'vue-color'
import ColorPicker from '../ColorPicker' import ColorPicker from '../ColorPicker'
export default { export default {
name: 'TagsTabSidebard', name: 'TagsTabSidebar',
components: { components: {
ColorPicker, ColorPicker,
'compact-picker': Compact 'compact-picker': Compact

View File

@@ -13,7 +13,7 @@ import { mapState } from 'vuex'
import ActivityEntry from '../ActivityEntry' import ActivityEntry from '../ActivityEntry'
export default { export default {
name: 'TimelineTabSidebard', name: 'TimelineTabSidebar',
components: { components: {
ActivityEntry ActivityEntry
}, },

View File

@@ -235,6 +235,14 @@ export default new Vuex.Store({
} }
}, },
actions: { actions: {
loadBoardById({ commit }, boardId) {
apiClient.loadById(boardId)
.then((board) => {
commit('setCurrentBoard', board)
commit('setAssignableUsers', board.users)
})
},
toggleShowArchived({ commit }) { toggleShowArchived({ commit }) {
commit('toggleShowArchived') commit('toggleShowArchived')
}, },
@@ -376,11 +384,12 @@ export default new Vuex.Store({
}, },
// acl actions // acl actions
addAclToCurrentBoard({ commit }, newAcl) { addAclToCurrentBoard({ dispatch, commit }, newAcl) {
newAcl.boardId = this.state.currentBoard.id newAcl.boardId = this.state.currentBoard.id
apiClient.addAcl(newAcl) apiClient.addAcl(newAcl)
.then((returnAcl) => { .then((returnAcl) => {
commit('addAclToCurrentBoard', returnAcl) commit('addAclToCurrentBoard', returnAcl)
dispatch('loadBoardById', newAcl.boardId)
}) })
}, },
updateAclFromCurrentBoard({ commit }, acl) { updateAclFromCurrentBoard({ commit }, acl) {
@@ -390,11 +399,12 @@ export default new Vuex.Store({
commit('updateAclFromCurrentBoard', acl) commit('updateAclFromCurrentBoard', acl)
}) })
}, },
deleteAclFromCurrentBoard({ commit }, acl) { deleteAclFromCurrentBoard({ dispatch, commit }, acl) {
acl.boardId = this.state.currentBoard.id acl.boardId = this.state.currentBoard.id
apiClient.deleteAcl(acl) apiClient.deleteAcl(acl)
.then((acl) => { .then((acl) => {
commit('deleteAclFromCurrentBoard', acl) commit('deleteAclFromCurrentBoard', acl)
dispatch('loadBoardById', acl.boardId)
}) })
} }
} }

View File

@@ -88,13 +88,13 @@ export default {
commit('orderStack', { stack, addedIndex, removedIndex }) commit('orderStack', { stack, addedIndex, removedIndex })
}) })
}, },
loadStacks({ commit }, board) { loadStacks({ commit }, boardId) {
commit('clearCards') commit('clearCards')
let call = 'loadStacks' let call = 'loadStacks'
if (this.state.showArchived === true) { if (this.state.showArchived === true) {
call = 'loadArchivedStacks' call = 'loadArchivedStacks'
} }
apiClient[call](board.id) apiClient[call](boardId)
.then((stacks) => { .then((stacks) => {
for (let i in stacks) { for (let i in stacks) {
let stack = stacks[i] let stack = stacks[i]