Conversation
…lable The dialog is supposed to be shown only if the Notifications app is not available, and to know whether it is available or not it is checked if the header contains the Notifications button. However, in Nextcloud 25 the DOM of the Notifications app changed, so the button is no longer found and thus the dialog was always shown when there are pending shares. Even if the correct element query was used the dialog may be still shown anyway if "external.js" is loaded before the notifications button is added to the header. Therefore now it is checked if the Notifications app is available or not from the OC API. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
This was referenced Apr 15, 2024
susnux
reviewed
Apr 15, 2024
| this.processIncomingShareFromUrl(); | ||
|
|
||
| if (!$('#header').find('div.notifications').length) { | ||
| if (!('notifications' in OC.appswebroots)) { |
Contributor
There was a problem hiding this comment.
A bit hacky I think, but works and is better than the old version.
susnux
approved these changes
Apr 15, 2024
nfebe
approved these changes
Apr 15, 2024
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.
This fix is only for Nextcloud 27; in Nextcloud 28, even if the fix would also apply, the federated files plugin is currently not loaded due to the changes in the Files app, so additional fixes are needed for this one to have any effect.
Since Nextcloud 25, when a user opens the Files app a Remote share dialog is shown to accept each pending remote share. However, this is a regression rather than a feature.
The dialog has been there already for ages, but it was supposed to be shown only if the Notifications app is not available, and to know whether the app is available or not it is checked if the header contains the Notifications button. However, in Nextcloud 25 the DOM of the Notifications app changed, so the button is no longer found and thus the dialog is always shown when there are pending shares.
Even if the correct element query was used the dialog may be still shown anyway if external.js is loaded before the notifications button is added to the header. Therefore now it is checked if the Notifications app is available or not from the OC API.
Note that, with the fixed behaviour, it is possible to remove a notification about a pending share without accepting it, and once the notification is removed it will not appear again (unlike the Remote share dialog, which appears again and again whenever you open the Files app if there is a pending share; this is specially noticeable with group shares, as declined group shares are marked as pending rather than removed). Nevertheless, in that case the user could open the Pending shares entry in the Files app navigation and accept the share from there if needed (this would be possible in Nextcloud 27 and earlier; in Nextcloud 28 and later remote shares are not listed in share views due to a bug).
How to test
Result with this pull request
The "Remote share" dialog is not shown, but the share can be accepted from the notification
Result without this pull request
The "Remote share" dialog is shown, even if there is also a notification to accept the share