matrix-react-sdk
matrix-react-sdk copied to clipboard
Make chat exports use ISO 8601/RFC 3339 dates and be more informative
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:
After:
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.
In what cases is "Element - Chat Export - […]" currently being used? Looking at the before screenshot
In what cases is "Element - Chat Export - […]" currently being used? Looking at the before screenshot
When a chat is exported as an HTML
I think the filename should be "
Element-<roomname>-<ISOdate>" in all cases. For example,Element-testroom-2022-05-12T12_00_00.735Z.jsonI 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 Yes, please implement. To confirm, filename should have the following order of preference:
Element-<roomname>-<ISOdate>- If some characters cannot be in the filename, drop those characters and use only ones that can be
- If that leaves no
<roomname>component, then drop back toElement-chat-export-<ISOdate>
@kittykat I have made adjustments based on your suggestions. Below images shows the result
tested room names
The following is the resulting filename
It works for all the exports
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 ofElement-Room-2022-05-18T10_28_10.032Z.zipinstead 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?
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 ofElement-Room-2022-05-18T10_28_10.032Z.zipinstead of ``Element-Room -2022-05-18T10_28_10.032Z.zip`.This means if the room name is say
Empty roomthen the filename should beElement-Emptyroom-2022-05-18T10_28_10.032Z.zipinstead ofElement-Empty room-2022-05-18T10_28_10.032Z.zipright? develop
Mid-string spaces would stay where they are so ideally:
Empty roomtoElement-Empty room-2022-05-18T10_28_10.032Z.zipEmpty room /toElement-Empty room-2022-05-18T10_28_10.032Z.zipas well
If this is not easy, then we can keep it as:
Empty room /toElement-Empty room -2022-05-18T10_28_10.032Z.zip
This PR contends with https://github.com/matrix-org/matrix-react-sdk/pull/7992
@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!
@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 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.
@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 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
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.