Skip to content

Commit

Permalink
Merge pull request #13040 from nextcloud/backport/13037/stable30
Browse files Browse the repository at this point in the history
[stable30] fix: Fix some minor things found by stan
  • Loading branch information
nickvergessen authored Aug 22, 2024
2 parents bc77d0f + b0b89fb commit 4df5420
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/Chat/MessageParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ protected function getActorInformation(Message $message, string $actorType, stri
$actorId = MatterbridgeManager::BRIDGE_BOT_USERID;
} elseif ($actorType === Attendee::ACTOR_GUESTS
&& !in_array($actorId, [Attendee::ACTOR_ID_CLI, Attendee::ACTOR_ID_CHANGELOG], true)) {
if (isset($guestNames[$actorId])) {
if (isset($this->guestNames[$actorId])) {
$displayName = $this->guestNames[$actorId];
} else {
try {
$participant = $this->participantService->getParticipantByActor($message->getRoom(), Attendee::ACTOR_GUESTS, $actorId);
$displayName = $participant->getAttendee()->getDisplayName();
} catch (ParticipantNotFoundException $e) {
} catch (ParticipantNotFoundException) {
}
$this->guestNames[$actorId] = $displayName;
}
Expand Down
10 changes: 5 additions & 5 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1704,13 +1704,13 @@ public function joinFederatedRoom(string $token, ?string $sessionId): DataRespon
);
}

if ($sessionId != null) {
if ($sessionId !== null) {
$participant = $this->participantService->joinRoomAsFederatedUser($room, Attendee::ACTOR_FEDERATED_USERS, $this->federationAuthenticator->getCloudId(), $sessionId);
}

$session = $participant->getSession();
if ($session instanceof Session) {
$this->sessionService->updateLastPing($session, $this->timeFactory->getTime());
$session = $participant->getSession();
if ($session instanceof Session) {
$this->sessionService->updateLastPing($session, $this->timeFactory->getTime());
}
}

// Let the clients know if they need to reload capabilities
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/BotService.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ protected function getActor(Room $room): array {
return [
'type' => Attendee::ACTOR_GUESTS,
'id' => $actorId,
'name' => $user->getDisplayName(),
'name' => '',
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ public function updateCallFlags(Room $room, Participant $participant, int $flags

/**
* @param string[] $actorIds
* @param string[] $usersDirectlyMentioned
* @param string[] $actorsDirectlyMentioned
*/
public function markUsersAsMentioned(Room $room, string $actorType, array $actorIds, int $messageId, array $actorsDirectlyMentioned): void {
$update = $this->connection->getQueryBuilder();
Expand Down
2 changes: 1 addition & 1 deletion lib/Service/RoomService.php
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,12 @@ public function setActiveSince(Room $room, ?Participant $participant, \DateTime
return false;
}

$details = [];
if ($room->getActiveSince() instanceof \DateTime) {
// Call is already active, just someone upgrading the call flags
$event = new BeforeRoomModifiedEvent($room, ARoomModifiedEvent::PROPERTY_IN_CALL, $callFlag, $oldCallFlag, $participant);
$this->dispatcher->dispatchTyped($event);
} else {
$details = [];
if ($silent) {
$details[AParticipantModifiedEvent::DETAIL_IN_CALL_SILENT] = true;
}
Expand Down
5 changes: 0 additions & 5 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@
<code><![CDATA[NullCache]]></code>
</UndefinedClass>
</file>
<file src="lib/Chat/MessageParser.php">
<UndefinedVariable>
<code><![CDATA[$guestNames]]></code>
</UndefinedVariable>
</file>
<file src="lib/Chat/Parser/SystemMessage.php">
<UndefinedClass>
<code><![CDATA[\OC_Util]]></code>
Expand Down

0 comments on commit 4df5420

Please sign in to comment.