Skip to content

Commit

Permalink
fix(chat): Fix infinite loading spinner when someone cleared the history
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Dec 2, 2024
1 parent 25f38cf commit 0d20e25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\Member;
use OCA\Talk\CachePrefix;
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Config;
use OCA\Talk\Events\AAttendeeRemovedEvent;
use OCA\Talk\Events\AParticipantModifiedEvent;
Expand Down Expand Up @@ -1407,7 +1408,7 @@ public function markUsersAsMentioned(Room $room, string $actorType, array $actor
public function resetChatDetails(Room $room): void {
$update = $this->connection->getQueryBuilder();
$update->update('talk_attendees')
->set('last_read_message', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('last_read_message', $update->createNamedParameter(ChatManager::UNREAD_FIRST_MESSAGE, IQueryBuilder::PARAM_INT))
->set('last_mention_message', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('last_mention_direct', $update->createNamedParameter(0, IQueryBuilder::PARAM_INT))
->set('last_attendee_activity', $update->createNamedParameter($this->timeFactory->getTime(), IQueryBuilder::PARAM_INT))
Expand Down
12 changes: 12 additions & 0 deletions tests/integration/features/chat-1/delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,19 @@ Feature: chat/delete
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| room1 | users | participant2 | participant2-displayname | Message 2 | [] |
| room1 | users | participant1 | participant1-displayname | Message 1 | [] |
Then user "participant1" is participant of room "room1" (v4)
| unreadMessages | lastReadMessage |
| 1 | Message 1 |
Then user "participant2" is participant of room "room1" (v4)
| unreadMessages | lastReadMessage |
| 0 | Message 2 |
And user "participant1" deletes chat history for room "room1" with 200
Then user "participant1" is participant of room "room1" (v4)
| unreadMessages | lastReadMessage |
| 1 | FIRST_MESSAGE_UNREAD |
Then user "participant2" is participant of room "room1" (v4)
| unreadMessages | lastReadMessage |
| 1 | FIRST_MESSAGE_UNREAD |
Then user "participant1" sees the following messages in room "room1" with 200
| room | actorType | actorId | actorDisplayName | message | messageParameters |
Then user "participant1" sees the following system messages in room "room1" with 200 (v1)
Expand Down

0 comments on commit 0d20e25

Please sign in to comment.