summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-19 20:32:15 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-10-21 20:21:19 +0200
commit449349e9010714e55e2667a7a84956720806581a (patch)
treebd63b81cb791582146a8f76fd566c09692c69524 /apps/files_sharing/js
parent543c8634340607c5dd088b9cbdcd85700222ee0b (diff)
downloadnextcloud-server-449349e9010714e55e2667a7a84956720806581a.tar.gz
nextcloud-server-449349e9010714e55e2667a7a84956720806581a.zip
Fix opening a section again in the Files app
When a section is open in the Files app a "show" event is triggered. File list objects handle that event by reloading themselves, but only if the file list was shown at least once. However, the file list objects of plugins are created when the "show" event is triggered for the first time for their section; as the file list objects register their handler for the "show" event when they are created they never handle the first triggered "show" event, as the handler is set while that event is being already handled. Therefore, from the point of view of the handler, the second time that a "show" event was triggered it was seen as if the file list was shown for the first time, and thus it was not reloaded. Now the "shown" property is explicitly set for those file lists that are created while handling a "show" event, which causes them to be reloaded as expected when opening their section again. Note that it is not possible to just reload the file list whenever it is shown; the file list is reloaded also when the directory changes, and this can happen when the web page is initially loaded and the URL is parsed. In that case, if file lists were reloaded when shown for the first time then it could be reloaded twice, one with the default parameters due to the "show" event and another one with the proper parameters once the URL was parsed, and the files that appeard in the list would depend on which response from the server was received the last. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/app.js30
1 files changed, 25 insertions, 5 deletions
diff --git a/apps/files_sharing/js/app.js b/apps/files_sharing/js/app.js
index 750f66236ae..b6ca71e15d1 100644
--- a/apps/files_sharing/js/app.js
+++ b/apps/files_sharing/js/app.js
@@ -34,7 +34,11 @@ OCA.Sharing.App = {
id: 'shares.self',
sharedWithUser: true,
fileActions: this._createFileActions(),
- config: OCA.Files.App.getFilesConfig()
+ config: OCA.Files.App.getFilesConfig(),
+ // The file list is created when a "show" event is handled, so
+ // it should be marked as "shown" like it would have been done
+ // if handling the event with the file list already created.
+ shown: true
}
);
@@ -56,7 +60,11 @@ OCA.Sharing.App = {
id: 'shares.others',
sharedWithUser: false,
fileActions: this._createFileActions(),
- config: OCA.Files.App.getFilesConfig()
+ config: OCA.Files.App.getFilesConfig(),
+ // The file list is created when a "show" event is handled, so
+ // it should be marked as "shown" like it would have been done
+ // if handling the event with the file list already created.
+ shown: true
}
);
@@ -78,7 +86,11 @@ OCA.Sharing.App = {
id: 'shares.link',
linksOnly: true,
fileActions: this._createFileActions(),
- config: OCA.Files.App.getFilesConfig()
+ config: OCA.Files.App.getFilesConfig(),
+ // The file list is created when a "show" event is handled, so
+ // it should be marked as "shown" like it would have been done
+ // if handling the event with the file list already created.
+ shown: true
}
);
@@ -101,7 +113,11 @@ OCA.Sharing.App = {
showDeleted: true,
sharedWithUser: true,
fileActions: this._restoreShareAction(),
- config: OCA.Files.App.getFilesConfig()
+ config: OCA.Files.App.getFilesConfig(),
+ // The file list is created when a "show" event is handled, so
+ // it should be marked as "shown" like it would have been done
+ // if handling the event with the file list already created.
+ shown: true
}
);
@@ -122,7 +138,11 @@ OCA.Sharing.App = {
{
id: 'shares.overview',
config: OCA.Files.App.getFilesConfig(),
- isOverview: true
+ isOverview: true,
+ // The file list is created when a "show" event is handled, so
+ // it should be marked as "shown" like it would have been done
+ // if handling the event with the file list already created.
+ shown: true
}
);