mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
* 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>
82 lines
2.4 KiB
Vue
82 lines
2.4 KiB
Vue
<template>
|
|
<div>
|
|
<base-card>
|
|
<ds-heading tag="h3">{{ $t('invite-codes.group-invite-links') }}</ds-heading>
|
|
<ds-space margin="large" />
|
|
<invitation-list
|
|
@generate-invite-code="generateGroupInviteCode"
|
|
@invalidate-invite-code="invalidateInviteCode"
|
|
:inviteCodes="group.inviteCodes"
|
|
:copy-message="
|
|
group.type === 'hidden'
|
|
? $T('invite-codes.invite-link-message-hidden-group', {
|
|
network: $env.NETWORK_NAME,
|
|
})
|
|
: $t('invite-codes.invite-link-message-group', {
|
|
groupName: group.name,
|
|
network: $env.NETWORK_NAME,
|
|
})
|
|
"
|
|
/>
|
|
</base-card>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import InvitationList from '~/components/_new/features/Invitations/InvitationList.vue'
|
|
import { generateGroupInviteCode, invalidateInviteCode } from '~/graphql/InviteCode'
|
|
|
|
export default {
|
|
components: {
|
|
InvitationList,
|
|
},
|
|
props: {
|
|
group: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
},
|
|
methods: {
|
|
async generateGroupInviteCode(comment) {
|
|
try {
|
|
await this.$apollo.mutate({
|
|
mutation: generateGroupInviteCode(),
|
|
variables: {
|
|
comment,
|
|
groupId: this.group.id,
|
|
},
|
|
update: (_, { data: { generateGroupInviteCode } }) => {
|
|
this.$emit('update-invite-codes', [...this.group.inviteCodes, generateGroupInviteCode])
|
|
},
|
|
})
|
|
this.$toast.success(this.$t('invite-codes.create-success'))
|
|
} catch (error) {
|
|
this.$toast.error(this.$t('invite-codes.create-error', { error: error.message }))
|
|
}
|
|
},
|
|
async invalidateInviteCode(code) {
|
|
try {
|
|
await this.$apollo.mutate({
|
|
mutation: invalidateInviteCode(),
|
|
variables: {
|
|
code,
|
|
},
|
|
update: (_, { data: { _invalidateInviteCode } }) => {
|
|
this.$emit(
|
|
'update-invite-codes',
|
|
this.group.inviteCodes.map((inviteCode) => ({
|
|
...inviteCode,
|
|
isValid: inviteCode.code === code ? false : inviteCode.isValid,
|
|
})),
|
|
)
|
|
},
|
|
})
|
|
this.$toast.success(this.$t('invite-codes.invalidate-success'))
|
|
} catch (error) {
|
|
this.$toast.error(this.$t('invite-codes.invalidate-error', { error: error.message }))
|
|
}
|
|
},
|
|
},
|
|
}
|
|
</script>
|