matrix-react-sdk icon indicating copy to clipboard operation
matrix-react-sdk copied to clipboard

Make chat exports use ISO 8601/RFC 3339 dates and be more informative

Open yaya-usman opened this issue 3 years ago • 13 comments

Fixes: vector-im/element-web#21812

it also includes the room name in the file export name.

Signed-off-by: Yaya Usman [email protected]

Before: htmlexport json plaintext

After:

htmlexport json plaintext


Here's what your changelog entry will look like:

✨ Features

  • Make chat exports use ISO 8601/RFC 3339 dates and be more informative (#8558). Contributed by @yaya-usman.

yaya-usman avatar May 10 '22 20:05 yaya-usman

In what cases is "Element - Chat Export - […]" currently being used? Looking at the before screenshot

kittykat avatar May 12 '22 09:05 kittykat

In what cases is "Element - Chat Export - […]" currently being used? Looking at the before screenshot

When a chat is exported as an HTML

yaya-usman avatar May 12 '22 09:05 yaya-usman

I think the filename should be "Element-<roomname>-<ISOdate>" in all cases. For example, Element-testroom-2022-05-12T12_00_00.735Z.json

I will leave it to the technical review on what exactly should happen with room names that can't be translated to filenames, but please feel welcome to ask for my input if needed.

Ok thanks, so should i go ahead and implement your suggestion? also concerning the room names that can't be translated to filenames, i already made a suggestion up there like we can check if the room name has some characters that's not acceptable in a filename with regex or so, if it does, we just ignore it and default to the brand name like Element-Chat Export-2022-05-12T12_00_00.735Z.json what do you think?

yaya-usman avatar May 12 '22 11:05 yaya-usman

@yaya-usman Yes, please implement. To confirm, filename should have the following order of preference:

  1. Element-<roomname>-<ISOdate>
  2. If some characters cannot be in the filename, drop those characters and use only ones that can be
  3. If that leaves no <roomname> component, then drop back to Element-chat-export-<ISOdate>

kittykat avatar May 13 '22 08:05 kittykat

@kittykat I have made adjustments based on your suggestions. Below images shows the result

tested room names

testroom

slashroom

emptyroom

The following is the resulting filename zip

zipSlash

empty

It works for all the exports

yaya-usman avatar May 14 '22 00:05 yaya-usman

LGTM.

One improvement could be to drop any leading and trailing whitespace in room name when the filename is put together. E.g. Room / / could give a filename of Element-Room-2022-05-18T10_28_10.032Z.zip instead of ``Element-Room -2022-05-18T10_28_10.032Z.zip`.

This means if the room name is say Empty room then the filename should be Element-Emptyroom-2022-05-18T10_28_10.032Z.zip instead of Element-Empty room-2022-05-18T10_28_10.032Z.zip right?

yaya-usman avatar May 18 '22 21:05 yaya-usman

LGTM. One improvement could be to drop any leading and trailing whitespace in room name when the filename is put together. E.g. Room / / could give a filename of Element-Room-2022-05-18T10_28_10.032Z.zip instead of ``Element-Room -2022-05-18T10_28_10.032Z.zip`.

This means if the room name is say Empty room then the filename should be Element-Emptyroom-2022-05-18T10_28_10.032Z.zip instead of Element-Empty room-2022-05-18T10_28_10.032Z.zip right? develop

Mid-string spaces would stay where they are so ideally:

  • Empty room to Element-Empty room-2022-05-18T10_28_10.032Z.zip
  • Empty room / to Element-Empty room-2022-05-18T10_28_10.032Z.zip as well

If this is not easy, then we can keep it as:

  • Empty room / to Element-Empty room -2022-05-18T10_28_10.032Z.zip

kittykat avatar May 19 '22 08:05 kittykat

This PR contends with https://github.com/matrix-org/matrix-react-sdk/pull/7992

t3chguy avatar May 20 '22 15:05 t3chguy

@yaya-usman Sorry to follow up again but because of the conflicting PR, can you please split out changing date format into its own PR and tag me in it for product signoff? We can merge that one as soon as possible, and then figure out how to handle the naming conflicts separately :+1:

Thank you!

kittykat avatar May 20 '22 15:05 kittykat

@yaya-usman Sorry to follow up again but because of the conflicting PR, can you please split out changing date format into its own PR and tag me in it for product signoff? We can merge that one as soon as possible, and then figure out how to handle the naming conflicts separately 👍

Thank you!

Sure no problem, Sorry for the late response. I will be back fully when I am done with exams in school next weekend.

yaya-usman avatar May 21 '22 06:05 yaya-usman

@yaya-usman could you please split out this PR into two? We would like to merge the update to the date format on top of #7992 and then review the other changes to naming separately.

kittykat avatar Jul 26 '22 13:07 kittykat

@yaya-usman could you please split out this PR into two? We would like to merge the update to the date format on top of #7992 and then review the other changes to naming separately.

Sorry for the late response, i thought this PR has been resolved or rather has been fixed by another person, i deleted the branch from my local but i guess i can still get it back. Also how do i split the PR, i don't really understand that part

yaya-usman avatar Jul 27 '22 07:07 yaya-usman

@yaya-usman could you please split out this PR into two? We would like to merge the update to the date format on top of #7992 and then review the other changes to naming separately.

Sorry for the late response, i thought this PR has been resolved or rather has been fixed by another person, i deleted the branch from my local but i guess i can still get it back. Also how do i split the PR, i don't really understand that part

Here's a guide you could have a look at for splitting a PR and to split a commit, I would use an interactive rebase, edit the commit, then do an interactive add

kittykat avatar Jul 27 '22 10:07 kittykat

Thanks for the PR! After asking for things to be split up we talked about it more as a group and came to a slightly different conclusion on the file naming. That conclusion is now documented as https://github.com/matrix-org/matrix-react-sdk/pull/9440 (which includes your other PR in it). Hopefully this means the code lands sooner - apologies for the delay here.

turt2live avatar Oct 17 '22 23:10 turt2live