-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joas Schilling <coding@schilljs.com>
- Loading branch information
1 parent
9224eb5
commit c86943e
Showing
5 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2022 Joas Schilling <coding@schilljs.com> | ||
* | ||
* @author Joas Schilling <coding@schilljs.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
||
namespace OCA\Guests\Listener; | ||
|
||
use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; | ||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
use OCP\Util; | ||
|
||
class TalkIntegrationListener implements IEventListener { | ||
public function handle(Event $event): void { | ||
if (!$event instanceof BeforeTemplateRenderedEvent) { | ||
return; | ||
} | ||
if (!$event->isLoggedIn() || $event->getResponse()->getTemplateName() !== 'index') { | ||
return; | ||
} | ||
|
||
$params = $event->getResponse()->getParams(); | ||
if (!isset($params['app']) || $params['app'] !== 'spreed') { | ||
return; | ||
} | ||
|
||
Util::addScript('guests', 'guests-talk'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { validate } from 'email-validator' | ||
import Vue from 'vue' | ||
|
||
import GuestForm from './views/GuestForm.vue' | ||
import Nextcloud from './mixins/Nextcloud' | ||
|
||
Vue.mixin(Nextcloud) | ||
|
||
if (!OCA.Guests) { | ||
/** | ||
* @namespace OCA.Guests | ||
*/ | ||
OCA.Guests = {} | ||
} | ||
|
||
// Init guests modal | ||
const guestForm = new Vue(GuestForm) | ||
const guestRoot = document.createElement('div') | ||
guestRoot.setAttribute('id', 'guest-root') | ||
document.body.appendChild(guestRoot) | ||
guestForm.$mount('#guest-root') | ||
|
||
// await page loading and init ShareSearch | ||
window.addEventListener('DOMContentLoaded', () => { | ||
if (!window.OCA?.Talk?.registerParticipantSearchAction) { | ||
return | ||
} | ||
|
||
window.OCA.Talk.registerParticipantSearchAction({ | ||
icon: 'icon-guests', | ||
label: t('guests', 'Invite guest'), | ||
show: validate, | ||
async callback(query) { | ||
return guestForm.populate({ app: 'talk' }, query) | ||
}, | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters