Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public function handle(Event $event): void {
}

$this->initialState->provideInitialState('canCreateGuests', $this->config->canCreateGuests());
Util::addScript('guests', 'guests-contactsmenu');

if (!$event->isLoggedIn() || $event->getResponse()->getTemplateName() !== 'index') {
return;
Expand Down
20 changes: 20 additions & 0 deletions src/contactsmenu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import AccountPlusOutlineSvg from '@mdi/svg/svg/account-plus-outline.svg?raw'
import { t } from '@nextcloud/l10n'

window.addEventListener('DOMContentLoaded', () => {
if (OC.ContactsMenu && OCA.Guests?.openGuestDialog) {
OC.ContactsMenu.addAction({
id: 'guests_addGuestAction',
icon: AccountPlusOutlineSvg,
label: t('guests', 'Add guest'),
onClick: () => {
OCA.Guests.openGuestDialog('core')
},
})
}
})
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default createAppConfig({
settings: 'src/settings.js',
talk: 'src/talk.js',
users: 'src/users.ts',
init: 'src/init.ts'
init: 'src/init.ts',
contactsmenu: 'src/contactsmenu.ts'
},
{
inlineCSS: {
Expand Down
Loading