fix(files_versions): retrieve all display names with one request#51727
Merged
SebastianKrupinski merged 2 commits intomasterfrom Aug 28, 2025
Merged
Conversation
artonge
approved these changes
Mar 26, 2025
244e6e3 to
8fa16c6
Compare
Contributor
Author
|
/backport to stable31 |
Contributor
Author
|
/backport to stable30 |
Contributor
Author
|
/backport to stable29 |
8fa16c6 to
e5e0afc
Compare
e5e0afc to
4c6718f
Compare
Contributor
Author
|
/compile |
Contributor
Author
|
@susnux can I get a second review? |
Member
|
/compile rebase |
4dc8bc4 to
9e0ef13
Compare
Member
provokateurin
left a comment
There was a problem hiding this comment.
Just a tiny perf suggestion.
| .filter(({ mime }) => mime !== '') | ||
| .map(version => formatVersion(version, fileInfo)) | ||
|
|
||
| const authors = await axios.post(generateUrl('/displaynames'), { users: [...versions.map(version => version.author)] }) |
Member
There was a problem hiding this comment.
Please make the list of requested authors unique, the backend doesn't do it automatically and thus would query the same user multiple times. You could also do this on the backend.
Contributor
There was a problem hiding this comment.
I think this should work:
Suggested change
| const authors = await axios.post(generateUrl('/displaynames'), { users: [...versions.map(version => version.author)] }) | |
| const authorIds = new Set(versions.map(version => version.author)) | |
| const authors = await axios.post(generateUrl('/displaynames'), { users: [...authorIds] }) |
Merged
susnux
reviewed
Aug 28, 2025
Comment on lines
55
to
60
| versions.forEach(version => { | ||
| const author = authors.data.users[version.author] | ||
| if (author) { | ||
| version.authorName = author | ||
| } | ||
| }) |
Contributor
There was a problem hiding this comment.
Suggested change
| versions.forEach(version => { | |
| const author = authors.data.users[version.author] | |
| if (author) { | |
| version.authorName = author | |
| } | |
| }) | |
| for(const version of versions) { | |
| const author = authors.data.users[version.author] | |
| if (author) { | |
| version.authorName = author | |
| } | |
| } |
susnux
approved these changes
Aug 28, 2025
Contributor
susnux
left a comment
There was a problem hiding this comment.
Looks good, but @provokateurin comment still makes sense!
9e0ef13 to
87bec0e
Compare
Contributor
Author
|
/compile rebase |
provokateurin
approved these changes
Aug 28, 2025
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
87bec0e to
5b02d11
Compare
Contributor
Author
|
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This was referenced Aug 28, 2025
Member
|
Slight issue fixed in #54728 |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modified UI logic to only make one request for all author names, instead of one request per author and re-requesting the same author name for multiple versions for the same author.
Checklist