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>
125 lines
3.0 KiB
Vue
125 lines
3.0 KiB
Vue
<template>
|
|
<dropdown class="group-content-menu" :placement="placement" offset="5">
|
|
<template #default="{ toggleMenu }">
|
|
<slot name="button" :toggleMenu="toggleMenu">
|
|
<base-button
|
|
icon="ellipsis-v"
|
|
size="small"
|
|
circle
|
|
@click.prevent="toggleMenu()"
|
|
data-test="group-menu-button"
|
|
/>
|
|
</slot>
|
|
</template>
|
|
<template #popover="{ toggleMenu }">
|
|
<div class="group-menu-popover">
|
|
<ds-menu :routes="routes">
|
|
<template #menuitem="item">
|
|
{{ item.parents }}
|
|
<ds-menu-item
|
|
:route="item.route"
|
|
:parents="item.parents"
|
|
@click.stop.prevent="openItem(item.route, toggleMenu)"
|
|
>
|
|
<base-icon :name="item.route.icon" />
|
|
{{ item.route.label }}
|
|
</ds-menu-item>
|
|
</template>
|
|
</ds-menu>
|
|
</div>
|
|
</template>
|
|
</dropdown>
|
|
</template>
|
|
|
|
<script>
|
|
import Dropdown from '~/components/Dropdown'
|
|
|
|
export default {
|
|
name: 'GroupContentMenu',
|
|
components: {
|
|
Dropdown,
|
|
},
|
|
props: {
|
|
usage: {
|
|
type: String,
|
|
required: true,
|
|
validator: (value) => {
|
|
return value.match(/(groupTeaser|groupProfile)/)
|
|
},
|
|
},
|
|
group: { type: Object, required: true },
|
|
placement: { type: String, default: 'bottom-end' },
|
|
},
|
|
computed: {
|
|
routes() {
|
|
const routes = []
|
|
|
|
if (this.usage !== 'groupProfile') {
|
|
routes.push({
|
|
label: this.$t('group.contentMenu.visitGroupPage'),
|
|
icon: 'home',
|
|
path: `/groups/${this.group.id}`,
|
|
params: { id: this.group.id, slug: this.group.slug },
|
|
})
|
|
}
|
|
|
|
if (this.usage === 'groupProfile') {
|
|
if (this.group.isMutedByMe) {
|
|
routes.push({
|
|
label: this.$t('group.contentMenu.unmuteGroup'),
|
|
icon: 'volume-up',
|
|
callback: () => {
|
|
this.$emit('unmute', this.group.id)
|
|
},
|
|
})
|
|
} else {
|
|
routes.push({
|
|
label: this.$t('group.contentMenu.muteGroup'),
|
|
icon: 'volume-off',
|
|
callback: () => {
|
|
this.$emit('mute', this.group.id)
|
|
},
|
|
})
|
|
}
|
|
}
|
|
|
|
if (this.group.myRole === 'owner') {
|
|
routes.push({
|
|
label: this.$t('admin.settings.name'),
|
|
path: `/groups/edit/${this.group.id}`,
|
|
icon: 'edit',
|
|
})
|
|
routes.push({
|
|
label: this.$t('group.contentMenu.inviteLinks'),
|
|
path: `/groups/edit/${this.group.id}/invites`,
|
|
icon: 'link',
|
|
})
|
|
}
|
|
|
|
return routes
|
|
},
|
|
},
|
|
methods: {
|
|
openItem(route, toggleMenu) {
|
|
if (route.callback) {
|
|
route.callback()
|
|
} else {
|
|
this.$router.push(route)
|
|
}
|
|
toggleMenu()
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.group-menu-popover {
|
|
nav {
|
|
margin-top: -$space-xx-small;
|
|
margin-bottom: -$space-xx-small;
|
|
margin-left: -$space-x-small;
|
|
margin-right: -$space-x-small;
|
|
}
|
|
}
|
|
</style>
|