-
-
Couldn't load subscription status.
- Fork 4.6k
fix(files_versions): retrieve all display names with one request #51727
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(files_versions): retrieve all display names with one request #51727
Conversation
244e6e3 to
8fa16c6
Compare
|
/backport to stable31 |
|
/backport to stable30 |
|
/backport to stable29 |
8fa16c6 to
e5e0afc
Compare
e5e0afc to
4c6718f
Compare
|
/compile |
|
@susnux can I get a second review? |
|
/compile rebase |
4dc8bc4 to
9e0ef13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should work:
| 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] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| versions.forEach(version => { | ||
| const author = authors.data.users[version.author] | ||
| if (author) { | ||
| version.authorName = author | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 | |
| } | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but @provokateurin comment still makes sense!
9e0ef13 to
87bec0e
Compare
|
/compile rebase |
Signed-off-by: SebastianKrupinski <krupinskis05@gmail.com>
87bec0e to
5b02d11
Compare
|
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
|
Slight issue fixed in #54728 |
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