Max ce1844e521
feat(webapp): several group and personal invitation links (#8504)
* invite codes refactor

typo

* lint fixes

* remove duplicate initeCodes on User

* fix typo

* clean permissionMiddleware

* dummy permissions

* separate validateInviteCode call

* permissions group & user

* test validateInviteCode + adjustments

* more validateInviteCode fixes

* missing test

* generatePersonalInviteCode

* generateGroupInviteCode

* old tests

* lint fixes

* more lint fixes

* fix validateInviteCode

* fix redeemInviteCode, fix signup

* fix all tests

* fix lint

* uniform types in config

* test & fix invalidateInviteCode

* cleanup test

* fix & test redeemInviteCode

* permissions

* fix Group->inviteCodes

* more cleanup

* improve tests

* fix code generation

* cleanup

* order inviteCodes result on User and Group

* lint

* test max invite codes + fix

* better description of collision

* tests: properly define group ids

* reused old group query

* reuse old Groupmembers query

* remove duplicate skip

* update comment

* fix uniqueInviteCode

* fix test

* fix lint

* Get invite codes

* Show invitation data in registration

* Add invitation list to menu (WIP)

* Add mutations, add CreateInvitation, some fixes

* Improve style, fix long comments

* Lock scrolling when popover is open, but prevent layout change

* small fixes

* instant updates

* Introduce config for link limit; add texts, layout changes

* Validate comment length

* Improve layout

* Add message to copied link

* Add invite link section to group settings

* Handle hidden groups

* Add menu entry for group invite links

* Fix locale

* hotfix invite codes

* Add copy messages

* More styling (WIP)

* Design update

* Don't forget user state

* Localize placeholder

* Add locale

* Instant updates for group invites

* fix registration with invite code

* Fix text overflow

* Fix instant updates

* Overhaul styles, add locales, add heading

* Add test and snapshot for CreateInvitation

* Improve accessability; add invitation test

* Add tests for InvitationList

* Fix locales

* Round plus button

* Fix tests

* Fix tests

* fix locales

* fix linting

* Don't show name of hidden group in invite message

* Add more tests

* Update webapp/locales/de.json

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>

* Update webapp/locales/de.json

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>

---------

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
2025-05-10 08:25:03 +00:00

81 lines
1.9 KiB
Vue

<template>
<div>
<ds-space margin="small">
<ds-heading tag="h1">{{ $t('group.editGroupSettings.title') }}</ds-heading>
<ds-heading tag="h2">
{{ $t('group.editGroupSettings.groupName', { name: group.name }) }}
</ds-heading>
</ds-space>
<ds-space margin="large" />
<ds-flex gutter="small">
<ds-flex-item :width="{ base: '100%', md: '200px' }">
<ds-menu :routes="routes" :is-exact="() => true" />
</ds-flex-item>
<ds-flex-item :width="{ base: '100%', md: 1 }">
<transition name="slide-up" appear>
<nuxt-child :group="group" @update-invite-codes="updateInviteCodes" />
</transition>
</ds-flex-item>
</ds-flex>
</div>
</template>
<script>
import { groupQuery } from '~/graphql/groups.js'
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters({
user: 'auth/user',
}),
routes() {
return [
{
name: this.$t('group.general'),
path: `/groups/edit/${this.group.id}`,
},
{
name: this.$t('group.members'),
path: `/groups/edit/${this.group.id}/members`,
},
{
name: this.$t('group.invite-links'),
path: `/groups/edit/${this.group.id}/invites`,
},
]
},
},
data() {
return {
group: {},
}
},
async asyncData(context) {
const {
app,
error,
params: { id },
} = context
const client = app.apolloProvider.defaultClient
const {
data: {
Group: [group],
},
} = await client.query({
query: groupQuery(), // "this.$i18n" is undefined here, so we use default lang
variables: { id },
})
if (group.myRole !== 'owner') {
error({ statusCode: 403, message: 'NONONNNO' })
}
return { group }
},
methods: {
updateInviteCodes(inviteCodes) {
this.group.inviteCodes = inviteCodes
},
},
}
</script>