mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
fix(scheduled): Fix attendee has_scheduled_messages
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
ef3265c9c7
commit
92a9e51991
6 changed files with 64 additions and 15 deletions
|
|
@ -315,6 +315,7 @@ class AttendeeMapper extends QBMapper {
|
|||
'has_unread_thread_mentions' => (bool)$row['has_unread_thread_mentions'],
|
||||
'has_unread_thread_directs' => (bool)$row['has_unread_thread_directs'],
|
||||
'hidden_pinned_id' => (int)$row['hidden_pinned_id'],
|
||||
'has_scheduled_messages' => (bool)$row['has_scheduled_messages'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,8 @@ class SelectHelper {
|
|||
$alias . 'has_unread_threads',
|
||||
$alias . 'has_unread_thread_mentions',
|
||||
$alias . 'has_unread_thread_directs',
|
||||
$alias . 'hidden_pinned_id'
|
||||
$alias . 'hidden_pinned_id',
|
||||
$alias . 'has_scheduled_messages',
|
||||
])->selectAlias($alias . 'id', 'a_id');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2385,6 +2385,7 @@ class ParticipantService {
|
|||
public function setHasScheduledMessages(Participant $participant, bool $hasScheduledMessages): void {
|
||||
$attendee = $participant->getAttendee();
|
||||
$attendee->setHasScheduledMessages($hasScheduledMessages);
|
||||
$attendee->setLastAttendeeActivity($this->timeFactory->getTime());
|
||||
$this->attendeeMapper->update($attendee);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -514,6 +514,9 @@ class FeatureContext implements Context, SnippetAcceptingContext {
|
|||
if (!empty($expectedRoom['lobbyTimer'])) {
|
||||
$data['lobbyTimer'] = (int)$room['lobbyTimer'];
|
||||
}
|
||||
if (!empty($expectedRoom['hasScheduledMessages'])) {
|
||||
$data['hasScheduledMessages'] = $room['hasScheduledMessages'] ? 'true' : 'false';
|
||||
}
|
||||
if (isset($expectedRoom['hiddenPinnedId'])) {
|
||||
if ($room['hiddenPinnedId'] === 0) {
|
||||
$data['hiddenPinnedId'] = 'EMPTY';
|
||||
|
|
@ -2020,11 +2023,13 @@ class FeatureContext implements Context, SnippetAcceptingContext {
|
|||
);
|
||||
$this->assertStatusCode($this->response, $statusCode);
|
||||
|
||||
if ($statusCode === 304) {
|
||||
$expected = $formData?->getColumnsHash();
|
||||
$data = $this->getDataFromResponse($this->response);
|
||||
if (empty($expected)) {
|
||||
Assert::assertEmpty($data);
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->getDataFromResponse($this->response);
|
||||
foreach ($data as &$message) {
|
||||
Assert::assertArrayHasKey('createdAt', $message);
|
||||
Assert::assertIsInt($message['createdAt']);
|
||||
|
|
|
|||
|
|
@ -9,12 +9,18 @@ Feature: chat-4/scheduling
|
|||
And user "participant2" sends message "Message" to room "room" with 201
|
||||
|
||||
Scenario: Schedule a message
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | false |
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
| message | Message 1 |
|
||||
| sendAt | 1985514582 |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 | room | users | participant1 | 0 | null | Message 1 | comment | 1985514582 | {"threadTitle":"","silent":false,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule a silent message
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
|
|
@ -22,8 +28,11 @@ Feature: chat-4/scheduling
|
|||
| sendAt | 1985514582 |
|
||||
| silent | true |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 2 | room | users | participant1 | 0 | null | Message 2 | comment | 1985514582 | {"threadTitle":"","silent":true,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule a message reply
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
|
|
@ -31,8 +40,11 @@ Feature: chat-4/scheduling
|
|||
| sendAt | 1985514582 |
|
||||
| replyTo | Message |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | parent | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | parent | message | messageType | sendAt | metaData |
|
||||
| Message 3 | room | users | participant1 | 0 | Message | Message |Message 3 | comment | 1985514582 | {"threadTitle":"","silent":false,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule a thread
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
|
|
@ -40,8 +52,11 @@ Feature: chat-4/scheduling
|
|||
| sendAt | 1985514582 |
|
||||
| threadTitle | Scheduled Thread |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 4 | room | users | participant1 | -1 | null | Message 4 | comment | 1985514582 | {"threadTitle":"Scheduled Thread","silent":false,"threadId":-1} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule a thread reply
|
||||
Given user "participant1" sends thread "Thread 1" with message "Message 0" to room "room" with 201
|
||||
|
|
@ -50,8 +65,11 @@ Feature: chat-4/scheduling
|
|||
| sendAt | 1985514582 |
|
||||
| threadId | Thread 1 |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 5 | room | users | participant1 | Thread 1 | null | Message 5 | comment | 1985514582 | {"threadTitle":"Thread 1","silent":false,"threadId":"Thread 1"} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule a quoted thread reply
|
||||
Given user "participant1" sends thread "Thread 1" with message "Message 0" to room "room" with 201
|
||||
|
|
@ -61,8 +79,11 @@ Feature: chat-4/scheduling
|
|||
| replyTo | Message 0 |
|
||||
| threadId | Thread 1 |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | parent | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | parent | message | messageType | sendAt | metaData |
|
||||
| Message 5 | room | users | participant1 | Thread 1 | Message 0 | Message 0 | Message 5 | comment | 1985514582 | {"threadTitle":"Thread 1","silent":false,"threadId":"Thread 1"} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
|
||||
Scenario: Schedule two messages and delete the first
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
|
|
@ -74,38 +95,55 @@ Feature: chat-4/scheduling
|
|||
| sendAt |1985514584 |
|
||||
| silent | true |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 | room | users | participant1 | 0 | null | Message 1 | comment | 1985514582 | {"threadTitle":"","silent":false,"threadId":0} |
|
||||
| Message 2 | room | users | participant1 | 0 | null | Message 2 | comment | 1985514584 | {"threadTitle":"","silent":true,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
When user "participant1" deletes scheduled message "Message 1" from room "room" with 200
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 2 | room | users | participant1 | 0 | null | Message 2 | comment | 1985514584 | {"threadTitle":"","silent":true,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
When user "participant1" deletes scheduled message "Message 2" from room "room" with 200
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | false |
|
||||
|
||||
Scenario: edit a scheduled message
|
||||
When user "participant1" schedules a message to room "room" with 201
|
||||
| message | Message 1 |
|
||||
| sendAt | 1985514582 |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 | room | users | participant1 | 0 | null | Message 1 | comment | 1985514582 | {"threadTitle":"","silent":false,"threadId":0} |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
When user "participant1" updates scheduled message "Message 1" in room "room" with 202
|
||||
| message | Message 1 edited |
|
||||
| sendAt | 1985514582 |
|
||||
Then user "participant1" is participant of the following rooms (v4)
|
||||
| id | type | hasScheduledMessages |
|
||||
| room | 2 | true |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 edited | room | users | participant1 | 0 | null | Message 1 edited | comment | 1985514582 | {"threadTitle":"","silent":false,"threadId":0,"lastEditedTime":0} |
|
||||
When user "participant1" updates scheduled message "Message 1" in room "room" with 202
|
||||
| message | Message 1 edited |
|
||||
| sendAt | 1985514582 |
|
||||
| silent | true |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 edited | room | users | participant1 | 0 | null | Message 1 edited | comment | 1985514582 | {"threadTitle":"","silent":true,"threadId":0,"lastEditedTime":0} |
|
||||
When user "participant1" updates scheduled message "Message 1" in room "room" with 400
|
||||
| message | Message 1 edited |
|
||||
| sendAt | 1985514582 |
|
||||
| threadTitle | Abcd |
|
||||
Then user "participant1" sees the following scheduled messages in room "room" with 200
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| id | roomId | actorType | actorId | threadId | parentId | message | messageType | sendAt | metaData |
|
||||
| Message 1 edited | room | users | participant1 | 0 | null | Message 1 edited | comment | 1985514582 | {"threadTitle":"","silent":true,"threadId":0,"lastEditedTime":0} |
|
||||
|
|
|
|||
|
|
@ -443,6 +443,7 @@ class ChatManagerTest extends TestCase {
|
|||
'has_unread_thread_mentions' => false,
|
||||
'has_unread_thread_directs' => false,
|
||||
'hidden_pinned_id' => 0,
|
||||
'has_scheduled_messages' => false,
|
||||
]);
|
||||
$chat = $this->createMock(Room::class);
|
||||
$chat->expects($this->any())
|
||||
|
|
@ -512,6 +513,7 @@ class ChatManagerTest extends TestCase {
|
|||
'has_unread_thread_mentions' => false,
|
||||
'has_unread_thread_directs' => false,
|
||||
'hidden_pinned_id' => 0,
|
||||
'has_scheduled_messages' => false,
|
||||
]);
|
||||
$chat = $this->createMock(Room::class);
|
||||
$chat->expects($this->any())
|
||||
|
|
@ -603,6 +605,7 @@ class ChatManagerTest extends TestCase {
|
|||
'has_unread_thread_mentions' => false,
|
||||
'has_unread_thread_directs' => false,
|
||||
'hidden_pinned_id' => 0,
|
||||
'has_scheduled_messages' => false,
|
||||
]);
|
||||
$chat = $this->createMock(Room::class);
|
||||
$chat->expects($this->any())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue