@@ -808,17 +808,27 @@ protected function unshareFromUser(IShare $share) {
808808 return ;
809809 }
810810
811+ if ($ share ->isExpired ()) {
812+ $ actionSharer = 'expired_user ' ;
813+ $ actionOwner = 'expired_user ' ;
814+ $ actionUser = 'expired ' ;
815+ } else {
816+ $ actionSharer = 'unshared_user_self ' ;
817+ $ actionOwner = 'unshared_user_by ' ;
818+ $ actionUser = 'unshared_by ' ;
819+ }
820+
811821 // User performing the share
812- $ this ->shareNotificationForSharer (' unshared_user_self ' , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
822+ $ this ->shareNotificationForSharer ($ actionSharer , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
813823
814824 // Owner
815825 if ($ this ->currentUser ->getUID () !== null ) {
816- $ this ->shareNotificationForOriginalOwners ($ this ->currentUser ->getUID (), ' unshared_user_by ' , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
826+ $ this ->shareNotificationForOriginalOwners ($ this ->currentUser ->getUID (), $ actionOwner , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
817827 }
818828
819829 // Recipient
820830 $ this ->addNotificationsForUser (
821- $ share ->getSharedWith (), ' unshared_by ' , [[$ share ->getNodeId () => $ share ->getTarget ()], $ this ->currentUser ->getUserIdentifier ()],
831+ $ share ->getSharedWith (), $ actionUser , [[$ share ->getNodeId () => $ share ->getTarget ()], $ this ->currentUser ->getUserIdentifier ()],
822832 $ share ->getNodeId (), $ share ->getTarget (), $ share ->getNodeType () === 'file ' ,
823833 $ this ->userSettings ->getUserSetting ($ share ->getSharedWith (), 'stream ' , Files_Sharing::TYPE_SHARED ),
824834 $ this ->userSettings ->getUserSetting ($ share ->getSharedWith (), 'email ' , Files_Sharing::TYPE_SHARED ) ? $ this ->userSettings ->getUserSetting ($ share ->getSharedWith (), 'setting ' , 'batchtime ' ) : false
@@ -854,16 +864,26 @@ protected function unshareFromGroup(IShare $share) {
854864 return ;
855865 }
856866
867+ if ($ share ->isExpired ()) {
868+ $ actionSharer = 'expired_group ' ;
869+ $ actionOwner = 'expired_group ' ;
870+ $ actionUser = 'expired ' ;
871+ } else {
872+ $ actionSharer = 'unshared_group_self ' ;
873+ $ actionOwner = 'unshared_group_by ' ;
874+ $ actionUser = 'unshared_by ' ;
875+ }
876+
857877 // User performing the share
858- $ this ->shareNotificationForSharer (' unshared_group_self ' , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
878+ $ this ->shareNotificationForSharer ($ actionSharer , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
859879 if ($ this ->currentUser ->getUID () !== null ) {
860- $ this ->shareNotificationForOriginalOwners ($ this ->currentUser ->getUID (), ' unshared_group_by ' , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
880+ $ this ->shareNotificationForOriginalOwners ($ this ->currentUser ->getUID (), $ actionOwner , $ share ->getSharedWith (), $ share ->getNodeId (), $ share ->getNodeType ());
861881 }
862882
863883 $ offset = 0 ;
864884 $ users = $ group ->searchUsers ('' , self ::USER_BATCH_SIZE , $ offset );
865885 while (!empty ($ users )) {
866- $ this ->addNotificationsForGroupUsers ($ users , ' unshared_by ' , $ share ->getNodeId (), $ share ->getNodeType (), $ share ->getTarget (), $ share ->getId ());
886+ $ this ->addNotificationsForGroupUsers ($ users , $ actionUser , $ share ->getNodeId (), $ share ->getNodeType (), $ share ->getTarget (), $ share ->getId ());
867887 $ offset += self ::USER_BATCH_SIZE ;
868888 $ users = $ group ->searchUsers ('' , self ::USER_BATCH_SIZE , $ offset );
869889 }
@@ -893,7 +913,8 @@ protected function unshareFromSelfGroup(IShare $share) {
893913 */
894914 protected function unshareLink (IShare $ share ) {
895915 $ owner = $ share ->getSharedBy ();
896- if ($ this ->currentUser ->getUID () === null ) {
916+
917+ if ($ share ->isExpired ()) {
897918 // Link expired
898919 $ actionSharer = 'link_expired ' ;
899920 $ actionOwner = 'link_by_expired ' ;
0 commit comments