Browse Source

fix(federation): Don't try to transfer membership in federated rooms

The host does not get notified and should not trust a server sending a
proxied invite for now.

Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/11950/head
Joas Schilling 2 years ago
parent
commit
521fdd2913
No known key found for this signature in database GPG Key ID: C400AAF20C1BB6FC
  1. 11
      lib/Command/User/TransferOwnership.php

11
lib/Command/User/TransferOwnership.php

@ -93,7 +93,7 @@ class TransferOwnership extends Base {
$includeNonModeratorRooms = $input->getOption('include-non-moderator');
$removeSourceUser = $input->getOption('remove-source-user');
$modified = 0;
$modified = $federatedRooms = 0;
$rooms = $this->manager->getRoomsForActor(Attendee::ACTOR_USERS, $sourceUID);
foreach ($rooms as $room) {
if ($room->getType() !== Room::TYPE_GROUP && $room->getType() !== Room::TYPE_PUBLIC) {
@ -101,6 +101,11 @@ class TransferOwnership extends Base {
continue;
}
if ($room->isFederatedConversation()) {
$federatedRooms++;
continue;
}
$sourceParticipant = $this->participantService->getParticipantByActor($room, Attendee::ACTOR_USERS, $sourceUID);
if ($sourceParticipant->getAttendee()->getParticipantType() === Participant::USER_SELF_JOINED) {
@ -141,6 +146,10 @@ class TransferOwnership extends Base {
}
}
if ($federatedRooms > 0) {
$output->writeln('<comment>Could not transfer membership in ' . $federatedRooms. ' federated rooms.</comment>');
}
$output->writeln('<info>Added or promoted user ' . $destinationUser->getUID() . ' in ' . $modified . ' rooms.</info>');
return 0;
}

Loading…
Cancel
Save