Skip to content

Commit

Permalink
enh: remove usages of NAV_ENTRY_MODE_RECIPIENTS
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M. <[email protected]>
  • Loading branch information
enjeck committed Dec 30, 2024
1 parent f86c8c3 commit e0a2cd8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/modules/modals/CreateContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default {
isUser: true,
key: 'user-' + getCurrentUser().uid,
})
const displayMode = this.showInNavigation ? 'NAV_ENTRY_MODE_RECIPIENTS' : 'NAV_ENTRY_MODE_HIDDEN'
const displayMode = this.showInNavigation ? 'NAV_ENTRY_MODE_ALL' : 'NAV_ENTRY_MODE_HIDDEN'
const res = await this.$store.dispatch('insertNewContext', { data, previousReceivers: [], receivers: this.receivers, displayMode: NAV_ENTRY_MODE[displayMode] })
if (res) {
return res.id
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modals/EditContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default {
isUser: true,
key: 'user-' + getCurrentUser().uid,
})
const displayMode = this.showInNavigationDefault ? 'NAV_ENTRY_MODE_RECIPIENTS' : 'NAV_ENTRY_MODE_HIDDEN'
const displayMode = this.showInNavigationDefault ? 'NAV_ENTRY_MODE_ALL' : 'NAV_ENTRY_MODE_HIDDEN'
const res = await this.$store.dispatch('updateContext', { id: this.contextId, data, previousReceivers: Object.values(context.sharing), receivers: this.receivers, displayMode: NAV_ENTRY_MODE[displayMode] })
if (res) {
showSuccess(t('tables', 'Updated application "{contextTitle}".', { contextTitle: this.title }))
Expand Down
2 changes: 1 addition & 1 deletion src/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export const TYPE_USERGROUP = 'usergroup'

export const NAV_ENTRY_MODE = {
NAV_ENTRY_MODE_HIDDEN: 0, // no nav bar entry
NAV_ENTRY_MODE_RECIPIENTS: 1, // nav bar entry for share recipients, but not the owner
// NAV_ENTRY_MODE_RECIPIENTS: 1, // nav bar entry for share recipients, but not the owner. Currently unused.
NAV_ENTRY_MODE_ALL: 2, // nav bar entry for everybody
}
5 changes: 2 additions & 3 deletions src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { showError } from '@nextcloud/dialogs'
import '@nextcloud/dialogs/style.css'
import data from './data.js'
import displayError from '../shared/utils/displayError.js'
import { NODE_TYPE_TABLE, NODE_TYPE_VIEW, NAV_ENTRY_MODE } from '../shared/constants.js'
import { NODE_TYPE_TABLE, NODE_TYPE_VIEW } from '../shared/constants.js'
import { getCurrentUser } from '@nextcloud/auth'

Vue.use(Vuex)
Expand Down Expand Up @@ -364,9 +364,8 @@ export default new Vuex.Store({
if (createdShare?.data && createdShare?.data?.id) {
const shareId = createdShare.data.id
await dispatch('updateDisplayMode', { shareId, displayMode, target: 'default' })
// since we switch between NAV_ENTRY_MODE_HIDDEN and NAV_ENTRY_MODE_RECIPIENTS, we need to handle owner separately
if (receiver.id === getCurrentUser().uid) {
await dispatch('updateDisplayMode', { shareId, displayMode: displayMode === NAV_ENTRY_MODE.NAV_ENTRY_MODE_HIDDEN ? NAV_ENTRY_MODE.NAV_ENTRY_MODE_HIDDEN : NAV_ENTRY_MODE.NAV_ENTRY_MODE_ALL, target: 'self' })
await dispatch('updateDisplayMode', { shareId, displayMode, target: 'self' })
}
}
}
Expand Down

0 comments on commit e0a2cd8

Please sign in to comment.