Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

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

Closed
wants to merge 5 commits into from

Conversation

yaya-usman
Copy link
Contributor

@yaya-usman yaya-usman commented May 10, 2022

Fixes: vector-im/element-web#21812

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

Signed-off-by: Yaya Usman yaya-usman@users.noreply.github.com

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 yaya-usman requested a review from a team as a code owner May 10, 2022 20:17
@github-actions github-actions bot added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label May 10, 2022
Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! While I don't think the Product team cares about the date format as much, they might have thoughts on the file naming otherwise (such as the room name being awkward to look at when made filesafe, or the lack of brand variable to denote where the file came from).

Requesting review from the product team to determine if this assumption is true.

@@ -108,7 +108,7 @@ export default class JSONExporter extends Exporter {
this.addFile("export.json", new Blob([text]));
await this.downloadZIP();
} else {
const fileName = `matrix-export-${formatFullDateNoDay(new Date())}.json`;
const fileName = `${this.room.name}-${formatFullDateNoDayISO(new Date())}.json`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applies throughout: what if the room name contains characters that can't be translated into a file name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh i understand, i probably should check the room name first, if it contains characters that can't be used as a filename, then i default to the brand name or so, how about that?

@turt2live turt2live requested a review from a team May 10, 2022 20:21
@turt2live turt2live added T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements and removed T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems labels May 10, 2022
@turt2live turt2live changed the title Fixes the issue "Chat exports should use ISO 8601/RFC 3339 dates and be more informative" Make chat exports use ISO 8601/RFC 3339 dates and be more informative May 10, 2022
@kittykat kittykat self-assigned this May 12, 2022
@kittykat
Copy link
Contributor

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

@yaya-usman
Copy link
Contributor Author

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

When a chat is exported as an HTML

Copy link
Contributor

@kittykat kittykat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yaya-usman
Copy link
Contributor Author

yaya-usman commented May 12, 2022

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?

@kittykat
Copy link
Contributor

@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>

@yaya-usman
Copy link
Contributor Author

yaya-usman commented May 14, 2022

@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

Copy link
Contributor

@kittykat kittykat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

@kittykat kittykat requested a review from turt2live May 18, 2022 21:10
@yaya-usman
Copy link
Contributor Author

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?

@kittykat
Copy link
Contributor

kittykat commented May 19, 2022

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

@t3chguy
Copy link
Member

t3chguy commented May 20, 2022

This PR contends with #7992

@kittykat
Copy link
Contributor

@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!

@yaya-usman
Copy link
Contributor Author

@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.

@turt2live turt2live removed their request for review May 31, 2022 21:48
@MadLittleMods MadLittleMods added the Z-Community-PR Issue is solved by a community member's PR label Jun 1, 2022
@kittykat
Copy link
Contributor

@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
Copy link
Contributor Author

yaya-usman commented Jul 27, 2022

@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

@kittykat
Copy link
Contributor

@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

@turt2live
Copy link
Member

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 #9440 (which includes your other PR in it). Hopefully this means the code lands sooner - apologies for the delay here.

@turt2live turt2live closed this Oct 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements Z-Community-PR Issue is solved by a community member's PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Chat exports should use ISO 8601/RFC 3339 dates, be more informative
5 participants