-
Notifications
You must be signed in to change notification settings - Fork 448
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 <[email protected]>
- Loading branch information
1 parent
f9958b2
commit 852fe60
Showing
4 changed files
with
120 additions
and
11 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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\Talk\Listener; | ||
|
||
use OCA\Circles\Events\CircleEditedEvent; | ||
use OCA\Circles\Events\EditingCircleEvent; | ||
use OCA\Talk\Model\Attendee; | ||
use OCA\Talk\Service\ParticipantService; | ||
use OCP\EventDispatcher\Event; | ||
use OCP\EventDispatcher\IEventListener; | ||
|
||
/** | ||
* @template-implements IEventListener<Event> | ||
*/ | ||
class CircleEditedListener implements IEventListener { | ||
|
||
public function __construct( | ||
readonly private ParticipantService $participantService, | ||
) { | ||
} | ||
|
||
public function handle(Event $event): void { | ||
if (!$event instanceof EditingCircleEvent && !$event instanceof CircleEditedEvent) { | ||
Check failure on line 29 in lib/Listener/CircleEditedListener.php
|
||
// Unrelated | ||
return; | ||
} | ||
|
||
$displayName = $event->getCircle()->getDisplayName(); | ||
if ($event instanceof EditingCircleEvent) { | ||
// In the before event we need to cheat to get the name | ||
if ($event->getFederatedEvent()?->getData()?->hasKey('name')) { | ||
$displayName = $event->getFederatedEvent()->getData()->g('name'); | ||
} | ||
} | ||
|
||
$this->participantService->updateDisplayNameForActor( | ||
Attendee::ACTOR_CIRCLES, | ||
$event->getCircle()->getSingleId(), | ||
$displayName, | ||
); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
tests/integration/features/conversation-5/team-participants.feature
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,26 @@ | ||
Feature: conversation-5/team-participants | ||
Background: | ||
Given user "participant1" exists | ||
Given user "participant2" exists | ||
And User "participant1" creates team "Team A" | ||
And add user "participant2" to team "Team A" | ||
|
||
Scenario: Owner invites a team | ||
Given user "participant1" creates room "room" (v4) | ||
| roomType | 3 | | ||
| roomName | room | | ||
And user "participant1" sees the following attendees in room "room" with 200 (v4) | ||
| actorType | actorId | participantType | | ||
| users | participant1 | 1 | | ||
And user "participant1" adds team "Team A" to room "room" with 200 (v4) | ||
And user "participant1" sees the following attendees in room "room" with 200 (v4) | ||
| actorType | actorId | participantType | displayName | | ||
| users | participant1 | 1 | participant1-displayname | | ||
| circles | TEAM_ID(Team A) | 3 | Team A | | ||
| users | participant2 | 3 | participant2-displayname | | ||
And team "Team A" is renamed to "Team Alpha" | ||
And user "participant1" sees the following attendees in room "room" with 200 (v4) | ||
| actorType | actorId | participantType | displayName | | ||
| users | participant1 | 1 | participant1-displayname | | ||
| circles | TEAM_ID(Team A) | 3 | Team Alpha | | ||
| users | participant2 | 3 | participant2-displayname | |