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

Pin messages #603

Open
pwFoo opened this issue Jan 16, 2021 · 6 comments
Open

Pin messages #603

pwFoo opened this issue Jan 16, 2021 · 6 comments

Comments

@pwFoo
Copy link

pwFoo commented Jan 16, 2021

Pin messages in chat groups for example link to rules or current polls / information.

@or-else
Copy link
Contributor

or-else commented Jan 16, 2021

I like the feature but it's a bit complicated on the server side.

Suppose, you pinned the message from Jan 1st, then you had 1000 more un-pinned messages. When someone joins the topic he fetches the last 20-30 messages. Currently the server side SELECT looks approximately like this:

SELECT * FROM messages WHERE topic='xxx' ORDER by seq DESC LIMIT 30;

Fetching the next page (assuming the oldest message received in the step above is 123):

SELECT * FROM messages WHERE topic='xxx' AND seq<123 ORDER BY seq DESC LIMIT 30;

With pinned messages we have to select pinned messages first and need to make sure we don't fetch them every time when we fetch messages. I.e. we need something like pinned_seq in addition to seq. It has tobe tracked on the server and on the client. Which complicates things a lot.

@or-else
Copy link
Contributor

or-else commented Jan 16, 2021

I just got an idea. We could technically just have a DB field pinned. In the very first fetch the sort would be ORDER BY pinned, seq DESC. All other fetches containing a constraint AND seq<x would sort on seq only. It would work fine as long as the number fo pinned messages is small.

@or-else
Copy link
Contributor

or-else commented Jan 16, 2021

It would still need a way to pin/unpin the message as well as to announce that a message was pinned/unpinned while the user was online or offline.

@pwFoo
Copy link
Author

pwFoo commented Jan 18, 2021

Announce pinned message maybe isn't important, because the user will see it next time he open the group chat.
Should be enough to just pin one message and optional replace the pinned message with the new one?

There is a dropdown with delete for each message, that should be the right place to un-/pin messages and later add features like anwer / quote or forward messages?

@or-else
Copy link
Contributor

or-else commented Jan 18, 2021

Announce pinned message maybe isn't important, because the user will see it next time he open the group chat.

I would rather do it right. Some people keep it open for days.

There is a dropdown with delete for each message

I'm not talking about the UI, I'm talking about the client-server communication.

@or-else
Copy link
Contributor

or-else commented Apr 7, 2023

This feature is planned for v0.23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants