File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ public function index(): TemplateResponse {
158158 $ accountsJson = [];
159159 foreach ($ mailAccounts as $ mailAccount ) {
160160 $ json = $ mailAccount ->jsonSerialize ();
161+ $ json ['isDelegated ' ] = false ;
161162 $ json ['aliases ' ] = $ this ->aliasesService ->findAll ($ mailAccount ->getId (),
162163 $ this ->currentUserId );
163164 try {
@@ -172,6 +173,26 @@ public function index(): TemplateResponse {
172173 }
173174 $ accountsJson [] = $ json ;
174175 }
176+
177+ $ delegatedAccounts = $ this ->accountService ->findDelegatedAccounts ($ this ->currentUserId );
178+ foreach ($ delegatedAccounts as $ delegatedAccount ) {
179+ $ json = $ delegatedAccount ->jsonSerialize ();
180+ $ json ['isDelegated ' ] = true ;
181+ $ json ['aliases ' ] = $ this ->aliasesService ->findAll ($ delegatedAccount ->getId (),
182+ $ delegatedAccount ->getUserId ());
183+ try {
184+ $ mailboxes = $ this ->mailManager ->getMailboxes ($ delegatedAccount );
185+ $ json ['mailboxes ' ] = $ mailboxes ;
186+ } catch (Throwable $ ex ) {
187+ $ this ->logger ->critical ('Could not load delegated account mailboxes: ' . $ ex ->getMessage (), [
188+ 'exception ' => $ ex ,
189+ ]);
190+ $ json ['mailboxes ' ] = [];
191+ $ json ['error ' ] = true ;
192+ }
193+ $ accountsJson [] = $ json ;
194+ }
195+
175196 $ this ->initialStateService ->provideInitialState (
176197 'accounts ' ,
177198 $ accountsJson
You can’t perform that action at this time.
0 commit comments