Skip to content

Conversation

@danxuliu
Copy link
Member

@danxuliu danxuliu commented Jun 23, 2022

This pull request fixes a regression introduced in f310b96 (not updating the usage on updates when no quota is set), as well as wrongly escaped text and not updating the quota when copying or moving files.

All issues were present already in Nextcloud 22. As it is a regression the fix will be backported to 22, 23 and 24.

How to reproduce (scenario 1)

  • Ensure that the default skeleton files for development are used, so only "Welcome.txt" is created in the user directory when a new user is created
  • Create a new user and set a quota of 1 GB
  • Log in as that user
  • Open the Files app
  • Create a folder
  • Delete the folder

Result with this pull request

The quota text in the navigation bar is updated and set to < 1 KB of 1 GB used

Result without this pull request

The quota text in the navigation bar is updated and set to &lt; 1 KB of 1 GB used

How to reproduce (scenario 2)

  • Create a new user with unlimited quota (the default)
  • Log in as that user
  • Open the Files app
  • Upload a file

Result with this pull request

The quota text in the navigation bar is updated

Result without this pull request

The quota text in the navigation bar is not updated

How to reproduce (scenario 3)

  • Open the Files app
  • Copy an existing file

Result with this pull request

The quota text in the navigation bar is updated

Result without this pull request

The quota text in the navigation bar is not updated

How to reproduce (scenario 4)

  • Share a folder with another user
  • Log in as that user
  • Open the Files app
  • Move an existing file to the shared folder

Result with this pull request

The quota text in the navigation bar is updated

Result without this pull request

The quota text in the navigation bar is not updated

danxuliu added 3 commits June 23, 2022 13:24
"t()" escapes and sanitizes the returned text by default, so strings
like "<" are converted to "&lt;". However, the "jQuery.text()" parameter
does not need to be escaped, as "&lt;" is shown literally as "&lt;"
rather than "<". Now "jQuery.html()" is used instead, which "unescapes"
the given text and sets it as a new text node (as the text in the
parameter does not contain markup for elements, only text).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The JavaScript code that updates the quota text expects the element to
have "quotatext" as id.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Note that the quota may change too when files are moved if the file is
moved, for example, to or from a folder shared by other user.

Besides the quota the storage statistics are also updated, similar to
what is done when a file is deleted.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu added this to the Nextcloud 25 milestone Jun 23, 2022
@danxuliu danxuliu requested review from a team, PVince81, artonge and szaimen and removed request for a team June 23, 2022 11:53
@danxuliu
Copy link
Member Author

/backport to stable24

@artonge artonge requested review from Pytal and skjnldsv June 27, 2022 10:07
@danxuliu danxuliu merged commit 79b6caa into master Jul 5, 2022
@danxuliu danxuliu deleted the fixes-for-quota-text-in-navigation-bar branch July 5, 2022 20:21
@danxuliu
Copy link
Member Author

danxuliu commented Jul 6, 2022

/backport to stable23

@danxuliu
Copy link
Member Author

danxuliu commented Jul 6, 2022

/backport to stable22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants