Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable26] fix(polls): Remove polls also when deleting the chat history #8991

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/Chat/ChatManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,8 @@ public function clearHistory(Room $chat, string $actorType, string $actorId): IC

$this->participantService->resetChatDetails($chat);

$this->pollService->deleteByRoomId($chat->getId());

return $this->addSystemMessage(
$chat,
$actorType,
Expand Down
18 changes: 18 additions & 0 deletions tests/integration/features/chat-2/poll.feature
Original file line number Diff line number Diff line change
Expand Up @@ -715,3 +715,21 @@ Feature: chat-2/poll
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" |
| room | users | participant2 | participant2-displayname | Message deleted by you | "IGNORE" |

Scenario: Deleting the chat history also deletes polls
Given user "participant1" creates room "room" (v4)
| roomType | 2 |
| roomName | room |
And user "participant1" adds user "participant2" to room "room" with 200 (v4)
And user "participant2" creates a poll in room "room" with 201
| question | What is the question? |
| options | ["Where are you?","How much is the fish?"] |
| resultMode | public |
| maxVotes | unlimited |
And user "participant1" sees the following messages in room "room" with 200 (v1)
| room | actorType | actorId | actorDisplayName | message | messageParameters |
| room | users | participant2 | participant2-displayname | {object} | "IGNORE" |
And user "participant1" deletes chat history for room "room" with 200
Then user "participant1" sees poll "What is the question?" in room "room" with 404
Then user "participant2" sees poll "What is the question?" in room "room" with 404
And user "participant1" sees the following messages in room "room" with 200 (v1)