77
88namespace OCA \Activity ;
99
10+ use OCA \Activity \Extension \Files ;
1011use OCP \Activity \ActivitySettings ;
1112use OCP \Activity \Exceptions \SettingNotFoundException ;
1213use OCP \Activity \IManager ;
@@ -173,9 +174,14 @@ public function getNotificationTypes() {
173174 $ return = array_map (function (ActivitySettings $ setting ) {
174175 return $ setting ->getIdentifier ();
175176 }, $ settings );
176- if (array_search ('file_changed ' , $ return ) !== false ) {
177- array_push ($ return , 'file_created ' , 'file_deleted ' , 'file_restored ' );
177+
178+ // TYPE_FILE_CHANGED is used to group all file changes together
179+ // But we still differentiate between file_created, file_deleted and file_restored
180+ // so let's add them to the list.
181+ if (array_search (Files::TYPE_FILE_CHANGED , $ return ) !== false ) {
182+ array_push ($ return , Files::TYPE_SHARE_CREATED , Files::TYPE_SHARE_DELETED , Files::TYPE_SHARE_RESTORED );
178183 }
184+
179185 return $ return ;
180186 }
181187
@@ -197,6 +203,11 @@ public function filterUsersBySetting($users, $method, $type) {
197203 return [];
198204 }
199205
206+ // file_created, file_deleted and file_restored are grouped under file_changed
207+ if ($ type === Files::TYPE_SHARE_CREATED || $ type === Files::TYPE_SHARE_DELETED || $ type === Files::TYPE_SHARE_RESTORED ) {
208+ $ type = Files::TYPE_FILE_CHANGED ;
209+ }
210+
200211 $ filteredUsers = [];
201212 $ potentialUsers = $ this ->config ->getUserValueForUsers ('activity ' , 'notify_ ' . $ method . '_ ' . $ type , $ users );
202213 foreach ($ potentialUsers as $ user => $ value ) {
0 commit comments