mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +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>
156 lines
3.4 KiB
Vue
156 lines
3.4 KiB
Vue
<template>
|
|
<li class="invitation">
|
|
<div class="column1">
|
|
<div class="code">
|
|
{{ inviteCode.code }}
|
|
<span v-if="inviteCode.comment" class="mdash">—</span>
|
|
<span v-if="inviteCode.comment" class="comment">{{ inviteCode.comment }}</span>
|
|
</div>
|
|
<div>
|
|
<span v-if="inviteCode.redeemedByCount === 0">
|
|
{{ $t('invite-codes.redeemed-count-0') }}
|
|
</span>
|
|
<span v-else>
|
|
{{ $t('invite-codes.redeemed-count', { count: inviteCode.redeemedByCount }) }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="actions">
|
|
<base-button
|
|
circle
|
|
class="copy-button"
|
|
icon="copy"
|
|
@click="copyInviteCode(inviteCode.copy)"
|
|
:disabled="!canCopy"
|
|
:aria-label="$t('invite-codes.copy-code')"
|
|
/>
|
|
<base-button
|
|
circle
|
|
class="invalidate-button"
|
|
icon="trash"
|
|
@click="openDeleteModal"
|
|
:aria-label="$t('invite-codes.invalidate')"
|
|
/>
|
|
</div>
|
|
</li>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapMutations } from 'vuex'
|
|
import BaseButton from '~/components/_new/generic/BaseButton/BaseButton.vue'
|
|
|
|
export default {
|
|
name: 'Invitation',
|
|
components: {
|
|
BaseButton,
|
|
},
|
|
props: {
|
|
inviteCode: {
|
|
type: Object,
|
|
required: true,
|
|
},
|
|
copyMessage: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
computed: {
|
|
inviteLink() {
|
|
return `${window.location.origin}/registration?method=invite-code&inviteCode=${this.inviteCode.code}`
|
|
},
|
|
inviteMessageAndLink() {
|
|
return this.copyMessage ? `${this.copyMessage} ${this.inviteLink}` : this.inviteLink
|
|
},
|
|
},
|
|
data() {
|
|
return {
|
|
canCopy: false,
|
|
}
|
|
},
|
|
created() {
|
|
this.canCopy = !!navigator.clipboard
|
|
},
|
|
methods: {
|
|
...mapMutations({
|
|
commitModalData: 'modal/SET_OPEN',
|
|
}),
|
|
async copyInviteCode() {
|
|
await navigator.clipboard.writeText(this.inviteMessageAndLink)
|
|
this.$toast.success(this.$t('invite-codes.copy-success'))
|
|
},
|
|
openDeleteModal() {
|
|
this.commitModalData({
|
|
name: 'confirm',
|
|
data: {
|
|
type: '',
|
|
resource: { id: '' },
|
|
modalData: {
|
|
titleIdent: this.$t('invite-codes.delete-modal.title'),
|
|
messageIdent: this.$t('invite-codes.delete-modal.message'),
|
|
buttons: {
|
|
confirm: {
|
|
danger: true,
|
|
icon: 'trash',
|
|
textIdent: 'actions.delete',
|
|
callback: () => {
|
|
this.$emit('invalidate-invite-code', this.inviteCode.code)
|
|
},
|
|
},
|
|
cancel: {
|
|
icon: 'close',
|
|
textIdent: 'actions.cancel',
|
|
callback: () => {},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.invitation {
|
|
display: flex;
|
|
padding: calc($space-base / 2);
|
|
border-bottom: 1px dotted #e5e3e8;
|
|
align-items: center;
|
|
}
|
|
|
|
.invitation:nth-child(odd) {
|
|
background-color: $color-neutral-90;
|
|
}
|
|
|
|
.invitation:nth-child(even) {
|
|
background-color: white;
|
|
}
|
|
|
|
.column1 {
|
|
flex: auto;
|
|
display: flex;
|
|
flex-flow: column;
|
|
gap: $space-xx-small;
|
|
}
|
|
|
|
.code {
|
|
display: inline-flex;
|
|
max-width: 73%;
|
|
}
|
|
|
|
.comment {
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.actions {
|
|
display: inline-flex;
|
|
gap: $space-x-small;
|
|
}
|
|
|
|
.mdash {
|
|
margin-inline: $space-x-small;
|
|
}
|
|
</style>
|