99
1010use OCA \Deck \Db \Acl ;
1111use OCA \Deck \Service \CardService ;
12+ use OCA \Deck \Service \CirclesService ;
1213use OCP \Activity \IEvent ;
1314use OCP \Activity \IProvider ;
1415use OCP \Comments \IComment ;
@@ -38,7 +39,10 @@ class DeckProvider implements IProvider {
3839 /** @var CardService */
3940 private $ cardService ;
4041
41- public function __construct (IURLGenerator $ urlGenerator , ActivityManager $ activityManager , IUserManager $ userManager , ICommentsManager $ commentsManager , IFactory $ l10n , IConfig $ config , $ userId , CardService $ cardService ) {
42+ /** @var CirclesService */
43+ private $ circlesService ;
44+
45+ public function __construct (IURLGenerator $ urlGenerator , ActivityManager $ activityManager , IUserManager $ userManager , ICommentsManager $ commentsManager , IFactory $ l10n , IConfig $ config , $ userId , CardService $ cardService , CirclesService $ circlesService ) {
4246 $ this ->userId = $ userId ;
4347 $ this ->urlGenerator = $ urlGenerator ;
4448 $ this ->activityManager = $ activityManager ;
@@ -47,6 +51,7 @@ public function __construct(IURLGenerator $urlGenerator, ActivityManager $activi
4751 $ this ->l10nFactory = $ l10n ;
4852 $ this ->config = $ config ;
4953 $ this ->cardService = $ cardService ;
54+ $ this ->circlesService = $ circlesService ;
5055 }
5156
5257 /**
@@ -275,6 +280,17 @@ private function parseParamForAcl($subjectParams, $params) {
275280 'id ' => $ subjectParams ['acl ' ]['participant ' ],
276281 'name ' => $ user !== null ? $ user ->getDisplayName () : $ subjectParams ['acl ' ]['participant ' ]
277282 ];
283+ } elseif ($ subjectParams ['acl ' ]['type ' ] === Acl::PERMISSION_TYPE_CIRCLE ) {
284+ $ circle = $ this ->circlesService ->getCircle ($ subjectParams ['acl ' ]['participant ' ]);
285+
286+ // suppressing psalm because $circle is typed as Circle|null but psalm doesnt know about the OCA class
287+ // $circle->getName() will be defined when $circle is not null
288+ /** @psalm-suppress UndefinedMethod */
289+ $ params ['acl ' ] = [
290+ 'type ' => 'highlight ' ,
291+ 'id ' => $ subjectParams ['acl ' ]['participant ' ],
292+ 'name ' => $ circle ? $ circle ->getName () : $ subjectParams ['acl ' ]['participant ' ]
293+ ];
278294 } else {
279295 $ params ['acl ' ] = [
280296 'type ' => 'highlight ' ,
0 commit comments