tdesktop icon indicating copy to clipboard operation
tdesktop copied to clipboard

Add reactions to export chat history

Open BohdanTkachenko opened this issue 1 year ago • 2 comments

This should allow to export reactions in both JSON and HTML exports. Fixes #27971

Tested in a local environment.

Current limitations in HTML output:

  • Not rendering userpics. Only initials. As far as I understand, chat messages also don't render userpics.
  • Not rendering custom emojis. It looks like there is no existing way to render them in HTML output and in messages they are not rendered as well. But instead, simple emoji alternative is rendered. Unfortunately, for reactions there is no simplified emoji provided. Thus, it is not possible to render custom emojis. As a placeholder I added "(custom emoji)".

Example JSON message with reactions:

  {
   "id": 112233,
   "type": "message",

   ...

   "reactions": [
     {
      "type": "emoji",
      "count": 1,
      "emoji": "😁",
      "recent": [
       {
        "from": "Jane Smith",
        "from_id": "user54321",
        "date": "2023-11-08T10:10:30"
       }
      ]
     },
     {
      "type": "emoji",
      "count": 1,
      "emoji": "😢",
      "recent": [
       {
        "from": "John Doe",
        "from_id": "user12345",
        "date": "2023-11-08T10:20:30"
       }
      ]
     }
    ]
  },

Example generated HTML:

Example generated HTML

As you can see, custom emojis embedded into text_entries were properly serialized as a path to an image. I tried to follow the same code for serializing custom emojis in reactions, but somehow it is still different. I am definitely missing something, but cannot yet figure out exactly what.

BohdanTkachenko avatar Aug 07 '24 20:08 BohdanTkachenko

Nice! I'll try to look into that after the current release (that I'm building now).

john-preston avatar Aug 14 '24 17:08 john-preston

@BohdanTkachenko Please update to the latest code that should take care of paid reactions (star reactions),

john-preston avatar Aug 28 '24 16:08 john-preston

I have exported a couple channels for a test and I see reactions as a vertical list.

Screenshot image

23rd avatar Sep 04 '24 10:09 23rd

I have exported a couple channels for a test and I see reactions as a vertical list.

Screenshot image

Hmm... I don't see such issue. For me it shows them horizontally.

BohdanTkachenko avatar Sep 21 '24 21:09 BohdanTkachenko

I checked in Chrome and Firefox and in both it renders properly. I mean it still a bit ugly because I don't know what to do with custom emojis, but it renders them horizontally.

Screenshot from 2024-09-21 17-43-57

Would you mind sharing a bit more info about the issue? Like what OS and browser. Also, can you please try to reproduce it in some public channel, so I can reproduce it later on my machine. Also maybe you can share a snippet of generated HTML so I can take a look?

BohdanTkachenko avatar Sep 21 '24 21:09 BohdanTkachenko

I just fixed the rendering for paid reactions and also I decided to put waving hand emoji (👋) instead of (custom emoji) placeholder. This makes it look nice overall, however not really accurate. Please let me know if you have a better idea how to do this.

Here is what I have right now (tested on https://t.me/durov channel):

image

BohdanTkachenko avatar Sep 21 '24 22:09 BohdanTkachenko

Would you mind sharing a bit more info about the issue? Like what OS and browser. Also, can you please try to reproduce it in some public channel, so I can reproduce it later on my machine. Also maybe you can share a snippet of generated HTML so I can take a look?

I have tested the latest code and the issue seems to had gone away.

23rd avatar Sep 29 '24 01:09 23rd

Don’t forget to rebase.

23rd avatar Sep 29 '24 02:09 23rd

Don’t forget to rebase.

you an merge rebasing. :)

Aokromes avatar Sep 29 '24 09:09 Aokromes

Thanks for the hard work!

john-preston avatar Sep 30 '24 10:09 john-preston