Skip to content

Commit

Permalink
fix(federation): Allow federated users to get the room name
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Feb 14, 2024
1 parent 6914b18 commit 4537bd7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCA\Talk\Events\RoomCreatedEvent;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Federation\Authenticator;
use OCA\Talk\Model\Attendee;
use OCA\Talk\Model\AttendeeMapper;
use OCA\Talk\Model\SelectHelper;
Expand All @@ -46,6 +47,7 @@
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IL10N;
use OCP\IRequest;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Security\IHasher;
Expand Down Expand Up @@ -73,6 +75,7 @@ public function __construct(
protected ITimeFactory $timeFactory,
protected IHasher $hasher,
protected IL10N $l,
protected Authenticator $federationAuthenticator,
) {
$this->commentsManager = $commentsManager;
}
Expand Down Expand Up @@ -1098,6 +1101,16 @@ public function resolveRoomDisplayName(Room $room, string $userId, bool $forceNa
return $room->getName();
}

if ($this->federationAuthenticator->isFederationRequest()) {
try {
$authenticatedRoom = $this->federationAuthenticator->getRoom();
if ($authenticatedRoom->getId() === $room->getId()) {
return $room->getName();
}
} catch (RoomNotFoundException) {
}
}

if ($userId === '' && $room->getType() !== Room::TYPE_PUBLIC) {
return $this->l->t('Private conversation');
}
Expand Down

0 comments on commit 4537bd7

Please sign in to comment.