-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
Steps
- Create two users "alice" and "bob"
- Put both users into a group "named-users"
- Login as "alice"
- In the personal sharing settings, disable auto-accepting of shares
- Login as "bob"
- Share a folder with "named-users"
- Login as "alice"
- See that the notification is there, don't touch it
- Run
occ group:delete named-users - Refresh the page
Expected result
Notification disappears, no errors in log.
Ideally, the oc_share entries related to that group are deleted as well.
Actual result
Notification disappears, but each page refresh shows the same log error so the notification did not get discarded.
The oc_share entries for the deleted group still exist.
Versions
v21.0.5
Logs
{"reqId":"xg2X5kSL8CprDaZsPUaR","level":3,"time":"2021-12-15T13:01:28+00:00","remoteAddr":"127.0.0.1","user":"alice","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":{"Exception":"Exception","Message":"Call to a member function inGroup() on null","Code":0,"Trace":[{"file":"/srv/www/htdocs/server/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Notifications\\Controller\\EndpointController"},"listNotifications"]},{"file":"/srv/www/htdocs/server/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Notifications\\Controller\\EndpointController","listNotifications",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"apiVersion":"v2","_route":"ocs.notifications.Endpoint.listNotifications"}]},{"file":"/srv/www/htdocs/server/ocs/v1.php","line":63,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/notifications/api/v2/notifications"]},{"file":"/srv/www/htdocs/server/ocs/v2.php","line":24,"args":["/srv/www/htdocs/server/ocs/v1.php"],"function":"require_once"}],"File":"/srv/www/htdocs/server/lib/private/AppFramework/Http/Dispatcher.php","Line":159,"Previous":{"Exception":"Error","Message":"Call to a member function inGroup() on null","Code":0,"Trace":[{"file":"/srv/www/htdocs/server/apps/files_sharing/lib/Notification/Notifier.php","line":124,"function":"parseShareInvitation","class":"OCA\\Files_Sharing\\Notification\\Notifier","type":"->","args":[{"__class__":"OC\\Share20\\Share"},{"__class__":"OC\\Notification\\Notification"},{"__class__":"OC\\L10N\\LazyL10N"}]},{"file":"/srv/www/htdocs/server/lib/private/Notification/Manager.php","line":299,"function":"prepare","class":"OCA\\Files_Sharing\\Notification\\Notifier","type":"->","args":[{"__class__":"OC\\Notification\\Notification"},"en"]},{"file":"/srv/www/htdocs/server/apps/notifications/lib/Controller/EndpointController.php","line":106,"function":"prepare","class":"OC\\Notification\\Manager","type":"->","args":[{"__class__":"OC\\Notification\\Notification"},"en"]},{"file":"/srv/www/htdocs/server/lib/private/AppFramework/Http/Dispatcher.php","line":218,"function":"listNotifications","class":"OCA\\Notifications\\Controller\\EndpointController","type":"->","args":["v2"]},{"file":"/srv/www/htdocs/server/lib/private/AppFramework/Http/Dispatcher.php","line":127,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Notifications\\Controller\\EndpointController"},"listNotifications"]},{"file":"/srv/www/htdocs/server/lib/private/AppFramework/App.php","line":157,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Notifications\\Controller\\EndpointController"},"listNotifications"]},{"file":"/srv/www/htdocs/server/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Notifications\\Controller\\EndpointController","listNotifications",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"apiVersion":"v2","_route":"ocs.notifications.Endpoint.listNotifications"}]},{"file":"/srv/www/htdocs/server/ocs/v1.php","line":63,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/ocsapp/apps/notifications/api/v2/notifications"]},{"file":"/srv/www/htdocs/server/ocs/v2.php","line":24,"args":["/srv/www/htdocs/server/ocs/v1.php"],"function":"require_once"}],"File":"/srv/www/htdocs/server/apps/files_sharing/lib/Notification/Notifier.php","Line":196},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36","version":"21.0.5.1"}
The line in question is https://github.com/nextcloud/server/blob/v21.0.5/apps/files_sharing/lib/Notification/Notifier.php#L196
Notes
We need to add more code to prevent the error in case the group doesn't exist any more. There's already error handling for when the user is not found so we could extend it to the group also.
Then there's the question of share cleanup. I know from experience that when we delete a user, their shares are deleted.
So we'd need to delete the group as well and also its sub-entries.