Skip to content

Commit

Permalink
fix(participants): Don't try to load the CLI guest
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Sep 18, 2023
1 parent 3d78849 commit 321bbab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Chat/MessageParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ protected function setActor(Message $message): void {
} elseif ($comment->getActorType() === Attendee::ACTOR_BRIDGED) {
$displayName = $comment->getActorId();
$actorId = MatterbridgeManager::BRIDGE_BOT_USERID;
} elseif ($comment->getActorType() === Attendee::ACTOR_GUESTS
&& $comment->getActorId() === Attendee::ACTOR_CLI) {
$actorId = Attendee::ACTOR_CLI;
} elseif ($comment->getActorType() === Attendee::ACTOR_GUESTS) {
if (isset($guestNames[$comment->getActorId()])) {
$displayName = $this->guestNames[$comment->getActorId()];
Expand Down
4 changes: 4 additions & 0 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,10 @@ protected function getGuest(Room $room, string $actorType, string $actorId): arr
}

protected function getGuestName(Room $room, string $actorType, string $actorId): string {
if ($actorId === Attendee::ACTOR_CLI) {
return $this->l->t('Guest');
}

try {
$participant = $this->participantService->getParticipantByActor($room, $actorType, $actorId);
$name = $participant->getAttendee()->getDisplayName();
Expand Down
2 changes: 1 addition & 1 deletion lib/Chat/SystemMessage/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ protected function sendSystemMessage(Room $room, string $message, array $paramet
$actorId = $user->getUID();
} elseif (\OC::$CLI || $this->session->exists('talk-overwrite-actor-cli')) {
$actorType = Attendee::ACTOR_GUESTS;
$actorId = 'cli';
$actorId = Attendee::ACTOR_CLI;
} elseif ($this->session->exists('talk-overwrite-actor-type')) {
$actorType = $this->session->get('talk-overwrite-actor-type');
$actorId = $this->session->get('talk-overwrite-actor-id');
Expand Down
1 change: 1 addition & 0 deletions lib/Model/Attendee.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Attendee extends Entity {
public const ACTOR_BOTS = 'bots';
public const ACTOR_FEDERATED_USERS = 'federated_users';
public const ACTOR_BOT_PREFIX = 'bot-';
public const ACTOR_CLI = 'cli';

public const PERMISSIONS_DEFAULT = 0;
public const PERMISSIONS_CUSTOM = 1;
Expand Down

0 comments on commit 321bbab

Please sign in to comment.