Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deletion of additional emails #31345

Merged
merged 1 commit into from
Jun 13, 2022
Merged

Conversation

Pytal
Copy link
Member

@Pytal Pytal commented Feb 24, 2022

Fix #31164

Using index as the key would cause data from a deleted email to persist into the additional email at the same index due to the component being reused, this is resolved by forcing component replacement with unique string keys

@Pytal Pytal added this to the Nextcloud 24 milestone Feb 24, 2022
@Pytal Pytal requested a review from a team February 24, 2022 20:58
@Pytal Pytal self-assigned this Feb 24, 2022
@Pytal Pytal requested review from PVince81, vanpertsch and szaimen and removed request for a team February 24, 2022 20:58
@Pytal Pytal force-pushed the fix/31164/delete-additional-email branch from 61c3f73 to 0e65613 Compare February 24, 2022 21:01
@Pytal
Copy link
Member Author

Pytal commented Feb 25, 2022

/backport to stable23

@Pytal
Copy link
Member Author

Pytal commented Feb 25, 2022

/backport to stable22

@Pytal Pytal force-pushed the fix/31164/delete-additional-email branch 2 times, most recently from e33efcd to 06cc34f Compare March 2, 2022 01:09
@Pytal
Copy link
Member Author

Pytal commented Mar 2, 2022

Now uses https://lodash.com/docs/4.17.15#uniqueId to generate the unique key

@Pytal
Copy link
Member Author

Pytal commented Mar 2, 2022

/compile amend /

@nextcloud-command nextcloud-command force-pushed the fix/31164/delete-additional-email branch from 06cc34f to cbf54fc Compare March 2, 2022 02:45
Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

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

Now uses lodash.com/docs/4.17.15#uniqueId to generate the unique key

I don't like the idea of using lodash. Relying on external libraries for things as simple as this isn't really the most efficient move I would say :)

Just doing any Math.random().toString(36).substring(2) like you did is enough imho.
Importing uniqueId doesn't adds much (82B vs 39B), but it's just a good pattern I thik. In the end we should move away from lodash, jQuery and other "tooling" libs that vanilla js can do noaways 😉

@PVince81
Copy link
Member

PVince81 commented Mar 2, 2022

Now uses lodash.com/docs/4.17.15#uniqueId to generate the unique key

I don't like the idea of using lodash. Relying on external libraries for things as simple as this isn't really the most efficient move I would say :)

Just doing any Math.random().toString(36).substring(2) like you did is enough imho. Importing uniqueId doesn't adds much (82B vs 39B), but it's just a good pattern I thik. In the end we should move away from lodash, jQuery and other "tooling" libs that vanilla js can do noaways wink

I thought it was already imported as we used it in other places. Let's not import it then.

My worry was more that more frontend developers will invent their own key algorithms in various places (with a certain risk of collisions), so perhaps we could add a method in the "OC." namespace that does the equivalent of what lodash does, so that every app dev can use it.
As far as I remember lodash uses a prefix + number and simply increments a number for every call, so it doesn't risk any collisions

@PVince81
Copy link
Member

PVince81 commented Mar 2, 2022

(the latter comment was provided to you by someone who's used to chase ghosts, aka bugs that seldom happen and still caused nasty issues, so I'm usually trying to be more careful about probabilities as I tend to be unlucky there)

@Pytal Pytal force-pushed the fix/31164/delete-additional-email branch from cbf54fc to 03aba3f Compare March 2, 2022 20:00
@Pytal
Copy link
Member Author

Pytal commented Mar 2, 2022

I don't like the idea of using lodash. Relying on external libraries for things as simple as this isn't really the most efficient move I would say :)

Yes I did Math.random().toString(36).substring(2) as this was my thinking as well, changed it back now

My worry was more that more frontend developers will invent their own key algorithms in various places (with a certain risk of collisions), so perhaps we could add a method in the "OC." namespace that does the equivalent of what lodash does, so that every app dev can use it.

This is a valid concern but as stated above by @skjnldsv something as simple as unique id generation without any business logic specific requirements does not warrant another abstraction. Whether we make a shared unique id generation method or not is outside the scope of this specific PR and any discussions should be started elsewhere

@skjnldsv skjnldsv mentioned this pull request Mar 24, 2022
@blizzz blizzz mentioned this pull request Mar 31, 2022
This was referenced Apr 7, 2022
@blizzz blizzz modified the milestones: Nextcloud 24, Nextcloud 25 Apr 21, 2022
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@PVince81
Copy link
Member

@Pytal please resolve the conflicts, not sure if rebasing is necessary considering possible recent changes on master

@Pytal Pytal force-pushed the fix/31164/delete-additional-email branch from 03aba3f to 2948c5e Compare June 10, 2022 20:15
@Pytal Pytal added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jun 10, 2022
@Pytal
Copy link
Member Author

Pytal commented Jun 10, 2022

/backport to stable24

@PVince81 PVince81 merged commit 4ecedff into master Jun 13, 2022
@PVince81 PVince81 deleted the fix/31164/delete-additional-email branch June 13, 2022 07:14
@backportbot-nextcloud
Copy link

backportbot-nextcloud bot commented Jun 13, 2022

The backport to stable23 failed. Please do this backport manually.

#33035

@backportbot-nextcloud
Copy link

backportbot-nextcloud bot commented Jun 13, 2022

The backport to stable22 failed. Please do this backport manually.

#33037

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug feature: emails feature: settings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Adding and removing additional e-mail adress
5 participants