Conversation
58cd339 to
275463a
Compare
Signed-off-by: grnd-alt <git@belakkaf.net>
Signed-off-by: grnd-alt <git@belakkaf.net>
275463a to
30cad07
Compare
|
🐢 Performance warning. |
| if ($owner instanceof FederatedUser) { | ||
| return new FederatedUser($this->cloudIdManager->getCloudId($user['uid'], $owner->getCloudId()->getRemote())); | ||
| } | ||
| return null; |
There was a problem hiding this comment.
maybe throw an exception instead of return null? if the owner isnt federated here.
|
|
||
| public function localizeRemoteUsers(array $users, Board $localBoard) { | ||
| $localizedUsers = []; | ||
| foreach ($users as $i => $user) { |
There was a problem hiding this comment.
$i is not used here, was there a reason for keeping it?
| // local user for us = remote user for remote | ||
| $userId = $this->cloudIdManager->getCloudId($userId, null)->getId(); | ||
| $type = Assignment::TYPE_REMOTE; | ||
| } |
There was a problem hiding this comment.
if ($this->cloudIdManager->isValidCloudId($userId)) {
$cloudId = $this->cloudIdManager->resolveCloudId($userId);
// assignee's origin is the same as the board owner's origin: send as local user
if ($cloudId->getRemote() === $ownerCloudId->getRemote()) {
$userId = $cloudId->getUser();
$type = Assignment::TYPE_USER;
}
} else {
// local user for us = remote user for remote
$userId = $this->cloudIdManager->getCloudId($userId, null)->getId();
$type = Assignment::TYPE_REMOTE;
}
this code block is duplicated in both assignUserOnRemote and unAssignUserOnRemote. maybe extract it into a private helper like resolveUserIdForRemote() to avoid the duplication and make maintenance easier for later?
No description provided.