yuya373 / emacs-slack

slack client for emacs
1.1k stars 117 forks source link

Cannot "load more" any more #577

Open Konubinix opened 1 year ago

Konubinix commented 1 year ago

When clicking on "load more" in a conversation, nothing changes in the buffer.

By digging into the code, I can see that the function slack-conversations-view gets 100 messages from https://slack.com/api/conversations.view, using a cursor to get back to old messages

When running load more, it is simply called with the cursor to get 100 more.

But slack now sends back the same 100 messages. The code of slack-buffer-insert-messages filters out the messages already in the buffer. In that case, it filters all the messages out.

Konubinix commented 1 year ago

Based on what is done in slack-conversations-view, I think that the content of the conversations.view api call is now in two methods: conversations.info and conversations.history.

I guess that the code should now use new API and make calls to those two methods.

Is it a good guess or am I wrong?

Konubinix commented 1 year ago

For now, I changed the default value from 100 to 300, because I only needed messages not very old.

Konubinix commented 1 year ago

Using (setq request-message-level 'debug), I could get the curl command line issued and try it interactively.

I indeed have the mentionned behavior on the command line. Even when passing the cursor, the messages are still the same.

This is quite simple to check manually, using count=1 at first and doing the same request with cursor=thevalueofthepreviouscall.

Doing so, the same message is given, while I would expect the next one to be shown.

Konubinix commented 1 year ago

Doing the same interactive experience with conversations.history, I can get the messages one by one, as expected.

But it looks like the thread messages are not returned :thinking:

jumper047 commented 1 year ago

@Konubinix thank you for your investigation! There is the thing I adore in that package - almost every time I wanted to add something to it, it appears that this thing is already implemented, but undocumented. So, digging through code I realized we already have method to work with history andpoint. I replaced view method by history method and voila - it works like a charm. You can check my PR - please let me know if it will work for you too!

Konubinix commented 1 year ago

Thank you. I merged your code and it works well for me.