-
Notifications
You must be signed in to change notification settings - Fork 503
📌 Pinned messages - API #16239
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
📌 Pinned messages - API #16239
Conversation
|
If I understand it correctly:
right? Expected? |
|
Should the pin be reset when the message expires ? |
yes
Most likely not, but the additional effort needed to cover this, storing Users×PinnedMessages in a new database table is not worth the effort from my POV. |
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
c0f74ad to
134b096
Compare
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
134b096 to
4449271
Compare
Signed-off-by: Joas Schilling <[email protected]>
| // Message most likely expired, reset the last_pinned_id if matching | ||
| if ($room->getLastPinnedId() === $messageId) { | ||
| $newLastPinned = 0; | ||
| $attachments = $this->attachmentService->getAttachmentsByType($room, Attachment::TYPE_PINNED, 0, 1); | ||
| if (isset($attachments[0])) { | ||
| $newLastPinned = $attachments[0]->getMessageId(); | ||
| } | ||
| $this->roomService->setLastPinnedId($room, $newLastPinned); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that only works for messages that have a unpin set, i.e. have a unpin job. I would have expected it to be in https://github.com/nextcloud/spreed/blob/main/lib/BackgroundJob/ExpireChatMessages.php, but I see that it's a db operation there. So we might end up in a situation were it's set on room, but still expired?
Also, just to mention it, this code part is identical to the chatmanager.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that only works for messages that have a unpin set, i.e. have a unpin job.
Which will be the case going forward. At the moment of pinning I will set pinUntil when the message expires at some point
Also, just to mention it, this code part is identical to the chatmanager.
Yeah just renamed variables…
Signed-off-by: Joas Schilling <[email protected]>
SystemKeeper
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my side, besides the failing test.
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
aad45a7 to
1918a39
Compare
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
67f536f to
f9ef8f7
Compare
🛠️ API Checklist
🚧 Tasks
On hide we should a message that you can still see them in shared items unless unpinned$message['metaData']['pinnedByType']and so on🏁 Checklist
docs/has been updated or is not required