-
Notifications
You must be signed in to change notification settings - Fork 61
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: Louis Chemineau <louis@chmn.me>
- Loading branch information
Showing
6 changed files
with
126 additions
and
72 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
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,38 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2023, Louis Chmn <louis@chmn.me> | ||
* | ||
* @author Louis Chmn <louis@chmn.me> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* 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, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
namespace OCA\Activity\Event; | ||
|
||
use OCP\EventDispatcher\Event; | ||
|
||
/** | ||
* @since 28.0.0 Dispatched as a typed event | ||
*/ | ||
class LoadAdditionalScriptsEvent extends Event { | ||
/** | ||
* @deprecated 28.0.0 - Listen to the typed event instead. | ||
*/ | ||
public const EVENT_ENTITY = 'OCA\Activity::loadAdditionalScripts'; | ||
|
||
public function __construct(public readonly string $filter) { | ||
parent::__construct(); | ||
} | ||
} |
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,64 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2023, Louis Chmn <louis@chmn.me> | ||
* | ||
* @author Louis Chmn <louis@chmn.me> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* 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, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
|
||
namespace OCA\Activity; | ||
|
||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
use OCP\Share\Events\BeforeShareDeletedEvent; | ||
use OCP\Share\Events\ShareDeletedFromSelfEvent; | ||
|
||
/** | ||
* The class to handle the share events | ||
*/ | ||
class ShareEventListener implements IEventListener { | ||
|
||
public function __construct ( | ||
private FilesHooks $fileHooks, | ||
) {} | ||
|
||
public function handle(Event $event): void { | ||
if ($event instanceof BeforeShareDeletedEvent) { | ||
$this->unShare($event); | ||
} | ||
|
||
if ($event instanceof ShareDeletedFromSelfEvent) { | ||
$this->unShareSelf($event); | ||
} | ||
} | ||
|
||
/** | ||
* Unsharing event | ||
*/ | ||
public function unShare(BeforeShareDeletedEvent $event): void { | ||
$share = $event->getShare(); | ||
$this->fileHooks->unShare($share); | ||
} | ||
|
||
/** | ||
* "Unsharing a share from self only" event | ||
*/ | ||
public function unShareSelf(ShareDeletedFromSelfEvent $event): void { | ||
$share = $event->getShare(); | ||
$this->fileHooks->unShareSelf($share); | ||
} | ||
} |
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