Skip to content

Commit

Permalink
feat(MembersModal): Remove ties to Contacts app
Browse files Browse the repository at this point in the history
We have our own membership management in Collectives now.

Also show collective action to leave a collective to admins.

Fixes: #779

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Jul 25, 2023
1 parent f363ec3 commit 162bb32
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 66 deletions.
11 changes: 0 additions & 11 deletions cypress/e2e/apps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@
*/

describe('The apps', function() {
describe('Circles', function() {

it('shows circles in the contacts app', function() {
cy.login('jane', { route: '/apps/contacts' })
cy.get('.app-navigation')
.should('contain', 'Circles')
})

})

describe('Collectives', function() {

it('allows creating a new collective', function() {
Expand Down Expand Up @@ -65,5 +55,4 @@ describe('The apps', function() {
})

})

})
7 changes: 1 addition & 6 deletions src/Collectives.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>

<script>
import { showInfo, showError } from '@nextcloud/dialogs'
import { showInfo } from '@nextcloud/dialogs'
import { mapActions, mapGetters, mapState } from 'vuex'
import { GET_COLLECTIVES_FOLDER, GET_COLLECTIVES, GET_TRASH_COLLECTIVES } from './store/actions.js'
import displayError from './util/displayError.js'
Expand Down Expand Up @@ -66,11 +66,6 @@ export default {
this.getCollectivesFolder()
this.getTrashCollectives()
}
if (!this.isPublic && !('contacts' in this.OC.appswebroots)) {
console.error('The contacts app is required to manage members')
showError(t('collectives', 'The contacts app is required to manage members'))
}
},
methods: {
Expand Down
22 changes: 2 additions & 20 deletions src/components/Collective/CollectiveActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
</template>
{{ t('collectives', 'Manage members') }}
</NcActionButton>
<NcActionLink v-if="showManageMembers"
:href="circleLink">
<template #icon>
<CirclesIcon :size="20" />
</template>
{{ t('collectives', 'Manage members') }}
</NcActionLink>
<NcActionSeparator v-if="showManageMembers" />
<NcActionSeparator v-if="isCollectiveAdmin(collective)" />
<NcActionButton v-if="collectiveCanShare(collective)"
v-show="!isShared"
:close-after-click="false"
Expand Down Expand Up @@ -71,8 +64,7 @@
</template>
{{ t('collectives', 'Settings') }}
</NcActionButton>
<NcActionButton v-if="!isCollectiveAdmin(collective)"
:close-after-click="true"
<NcActionButton :close-after-click="true"
@click="leaveCollectiveWithUndo(collective)">
{{ t('collectives', 'Leave collective') }}
<template #icon>
Expand All @@ -89,7 +81,6 @@ import { showError, showUndo } from '@nextcloud/dialogs'
import { generateUrl } from '@nextcloud/router'
import AccountMultipleIcon from 'vue-material-design-icons/AccountMultiple.vue'
import CheckIcon from 'vue-material-design-icons/Check.vue'
import CirclesIcon from '../Icon/CirclesIcon.vue'
import CogIcon from 'vue-material-design-icons/Cog.vue'
import ContentPasteIcon from 'vue-material-design-icons/ContentPaste.vue'
import DownloadIcon from 'vue-material-design-icons/Download.vue'
Expand All @@ -111,7 +102,6 @@ export default {
components: {
AccountMultipleIcon,
CirclesIcon,
CheckIcon,
CogIcon,
ContentPasteIcon,
Expand Down Expand Up @@ -154,14 +144,6 @@ export default {
'loading',
]),
isContactsInstalled() {
return 'contacts' in this.OC.appswebroots
},
showManageMembers() {
return this.isCollectiveAdmin(this.collective) && this.isContactsInstalled
},
circleLink() {
return generateUrl('/apps/contacts/direct/circle/' + this.collective.circleId)
},
Expand Down
29 changes: 0 additions & 29 deletions src/components/Nav/CollectiveSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,6 @@
</div>
</NcAppSettingsSection>

<NcAppSettingsSection id="members" :title="t('collectives', 'Members')">
<div class="section-description">
{{ t('collectives', 'Members can be managed via the connected circle in the Contacts app.') }}
</div>
<div>
<NcButton v-tooltip="membersDisabledTooltip"
:aria-label="t('collectives', 'Open circle in Contacts')"
:disabled="!isContactsInstalled"
@click="openCircleLink">
{{ t('collectives', 'Open circle in Contacts') }}
</NcButton>
</div>
</NcAppSettingsSection>

<NcAppSettingsSection id="danger-zone" :title="t('collectives', 'Danger zone')">
<div>
<NcButton type="error" :aria-label="t('collectives', 'Delete collective')" @click="trashCollective()">
Expand All @@ -152,7 +138,6 @@ import { NcAppSettingsDialog, NcAppSettingsSection, NcButton, NcCheckboxRadioSwi
import AlertCircleOutlineIcon from 'vue-material-design-icons/AlertCircleOutline.vue'
import NcEmojiPicker from '@nextcloud/vue/dist/Components/NcEmojiPicker.js'
import EmoticonOutline from 'vue-material-design-icons/EmoticonOutline.vue'
import { generateUrl } from '@nextcloud/router'
import {
RENAME_CIRCLE,
UPDATE_COLLECTIVE,
Expand Down Expand Up @@ -198,7 +183,6 @@ export default {
computed: {
...mapState({
circles: (state) => state.circles.circles,
pages: (state) => state.pages.pages,
}),
Expand All @@ -219,15 +203,6 @@ export default {
: t('collectives', 'Renaming is limited to owners of the circle')
},
membersDisabledTooltip() {
return !this.isContactsInstalled
&& t('collectives', 'The contacts app is required to manage members')
},
isContactsInstalled() {
return 'contacts' in this.OC.appswebroots
},
isNameTooShort() {
return !!this.newCollectiveName && this.newCollectiveName.length < 3
},
Expand Down Expand Up @@ -361,10 +336,6 @@ export default {
this.done('renameCollective')
},
openCircleLink() {
window.open(generateUrl('/apps/contacts/direct/circle/' + this.collective.circleId), '_blank')
},
/**
* Trash a collective with the given name
*/
Expand Down

0 comments on commit 162bb32

Please sign in to comment.