Skip to content

Commit

Permalink
fix(dashboard): Fix dashboard when the last message of a chat expired
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed May 7, 2024
1 parent c139a64 commit caf3aa0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/Dashboard/TalkWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ protected function prepareRoom(Room $room, string $userId): WidgetItem {
);
$message = $this->messageParser->createMessageFromProxyCache($room, $participant, $cachedMessage, $this->l10n);
$subtitle = $this->getSubtitleFromMessage($message);
} catch (DoesNotExistException $e) {
} catch (DoesNotExistException) {
// Fallback to empty subtitle
}
} elseif ($room->getLastMessageId() && !$room->isFederatedConversation()) {
} elseif ($room->getLastMessageId() && $room->getLastMessage() && !$room->isFederatedConversation()) {
$message = $this->messageParser->createMessage($room, $participant, $room->getLastMessage(), $this->l10n);
$this->messageParser->parseMessage($message);
$subtitle = $this->getSubtitleFromMessage($message);
Expand Down
34 changes: 26 additions & 8 deletions tests/integration/features/integration/dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,30 @@ Feature: integration/dashboard
And user "participant2" starts breakout rooms in room "breakout room parent" with 200 (v1)
And user "participant2" broadcasts message "@participant1 hello" to room "breakout room parent" with 201 (v1)
Then user "participant1" sees the following entries for dashboard widgets "spreed" (v1)
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
Then user "participant1" sees the following entries for dashboard widgets "spreed" (v2)
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | Hello | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
And user "participant2" set the message expiration to 3 of room "one-to-one room" with 200 (v4)
And user "participant2" sends message "Message 3" to room "one-to-one room" with 201
And user "participant2" set the message expiration to 3 of room "group room" with 200 (v4)
And user "participant2" sends message "Message 2" to room "group room" with 201
And user "participant2" set the message expiration to 3 of room "call room" with 200 (v4)
And user "participant2" sends message "Message 3" to room "call room" with 201
And wait for 3 seconds
And force run "OCA\Talk\BackgroundJob\ExpireChatMessages" background jobs
Then user "participant1" sees the following entries for dashboard widgets "spreed" (v1)
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
Then user "participant1" sees the following entries for dashboard widgets "spreed" (v2)
| title | subtitle | link | iconUrl | sinceId | overlayIconUrl |
| call room | Call in progress | call room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| group room | You were mentioned | group room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |
| participant2-displayname | | one-to-one room | {$BASE_URL}ocs/v2.php/apps/spreed/api/v1/room/{token}/avatar{version} | | |

0 comments on commit caf3aa0

Please sign in to comment.