@@ -102,15 +102,15 @@ public function prepare(INotification $notification, string $languageCode): INot
102102
103103 $ params = $ notification ->getSubjectParameters ();
104104 if ($ params [0 ] !== $ params [1 ] && $ params [1 ] !== null ) {
105+ $ remoteInitiator = $ this ->createRemoteUser ($ params [0 ]);
106+ $ remoteOwner = $ this ->createRemoteUser ($ params [1 ]);
107+ $ params [3 ] = $ remoteInitiator ['name ' ] . '@ ' . $ remoteInitiator ['server ' ];
108+ $ params [4 ] = $ remoteOwner ['name ' ] . '@ ' . $ remoteOwner ['server ' ];
109+
105110 $ notification ->setParsedSubject (
106111 $ l ->t ('You received "%3$s" as a remote share from %4$s (%1$s) (on behalf of %5$s (%2$s)) ' , $ params )
107112 );
108113
109- $ initiator = $ params [0 ];
110- $ initiatorDisplay = isset ($ params [3 ]) ? $ params [3 ] : null ;
111- $ owner = $ params [1 ];
112- $ ownerDisplay = isset ($ params [4 ]) ? $ params [4 ] : null ;
113-
114114 $ notification ->setRichSubject (
115115 $ l ->t ('You received {share} as a remote share from {user} (on behalf of {behalf}) ' ),
116116 [
@@ -119,17 +119,18 @@ public function prepare(INotification $notification, string $languageCode): INot
119119 'id ' => $ notification ->getObjectId (),
120120 'name ' => $ params [2 ],
121121 ],
122- 'user ' => $ this -> createRemoteUser ( $ initiator , $ initiatorDisplay ) ,
123- 'behalf ' => $ this -> createRemoteUser ( $ owner , $ ownerDisplay ) ,
122+ 'user ' => $ remoteInitiator ,
123+ 'behalf ' => $ remoteOwner ,
124124 ]
125125 );
126126 } else {
127+ $ remoteOwner = $ this ->createRemoteUser ($ params [0 ]);
128+ $ params [3 ] = $ remoteOwner ['name ' ] . '@ ' . $ remoteOwner ['server ' ];
129+
127130 $ notification ->setParsedSubject (
128131 $ l ->t ('You received "%3$s" as a remote share from %4$s (%1$s) ' , $ params )
129132 );
130133
131- $ owner = $ params [0 ];
132- $ ownerDisplay = isset ($ params [3 ]) ? $ params [3 ] : null ;
133134
134135 $ notification ->setRichSubject (
135136 $ l ->t ('You received {share} as a remote share from {user} ' ),
@@ -139,7 +140,7 @@ public function prepare(INotification $notification, string $languageCode): INot
139140 'id ' => $ notification ->getObjectId (),
140141 'name ' => $ params [2 ],
141142 ],
142- 'user ' => $ this -> createRemoteUser ( $ owner , $ ownerDisplay ) ,
143+ 'user ' => $ remoteOwner ,
143144 ]
144145 );
145146 }
@@ -213,17 +214,24 @@ protected function getDisplayName(ICloudId $cloudId) {
213214 }
214215
215216 try {
217+ // contains protocol in the ID
216218 return $ this ->getDisplayNameFromContact ($ cloudId ->getId ());
217219 } catch (\OutOfBoundsException $ e ) {
218220 }
219221
220222 try {
221- $ this ->getDisplayNameFromContact ($ user . '@http:// ' . $ server );
223+ // does not include protocol, as stored in addressbooks
224+ return $ this ->getDisplayNameFromContact ($ cloudId ->getDisplayId ());
225+ } catch (\OutOfBoundsException $ e ) {
226+ }
227+
228+ try {
229+ return $ this ->getDisplayNameFromContact ($ user . '@http:// ' . $ server );
222230 } catch (\OutOfBoundsException $ e ) {
223231 }
224232
225233 try {
226- $ this ->getDisplayNameFromContact ($ user . '@https:// ' . $ server );
234+ return $ this ->getDisplayNameFromContact ($ user . '@https:// ' . $ server );
227235 } catch (\OutOfBoundsException $ e ) {
228236 }
229237
0 commit comments