@@ -161,21 +161,19 @@ async def reconfigure(
161161 updated_events ['reconfigured' ] = cls ._prepare_event (actor )
162162 updates ['events' ] = updated_events
163163
164- if not is_admin_context (context ):
165- installation = await ConnectInstallation .retrieve (context .installation_id , client )
166-
167- description = data .get ('details' ) or '-'
168- helpdesk_case = await ConnectHelpdeskCase .create_from_db_document (
169- db_document ,
170- action = data ['action' ],
171- description = description ,
172- installation = installation ,
173- client = client ,
174- )
164+ installation = await ConnectInstallation .retrieve (context .installation_id , client )
165+ description = data .get ('details' ) or '-'
166+ helpdesk_case = await ConnectHelpdeskCase .create_from_db_document (
167+ db_document ,
168+ action = data ['action' ],
169+ description = description ,
170+ installation = installation ,
171+ client = client ,
172+ )
175173
176- cases = updated_db_document .get ('cases' , [])
177- cases .append (cls ._prepare_helpdesk_case (helpdesk_case ))
178- updates ['cases' ] = cases
174+ cases = updated_db_document .get ('cases' , [])
175+ cases .append (cls ._prepare_helpdesk_case (helpdesk_case ))
176+ updates ['cases' ] = cases
179177
180178 db_coll = db [cls .COLLECTION ]
181179 await db_coll .update_one (
@@ -412,20 +410,14 @@ async def _create_db_document(
412410 client : AsyncConnectClient ,
413411 config : dict ,
414412 ) -> dict :
415- is_admin_ctx = is_admin_context (context )
416- installation = None
417- if not is_admin_ctx :
418- installation = await ConnectInstallation .retrieve (context .installation_id , client )
413+ installation = await ConnectInstallation .retrieve (context .installation_id , client )
419414
420415 async with await db .client .start_session () as db_session :
421416 async with db_session .start_transaction ():
422417 db_document = await cls ._create_db_document_in_db (
423418 db_document , db_session , config , client .logger ,
424419 )
425420
426- if is_admin_ctx :
427- return db_document
428-
429421 helpdesk_case = await ConnectHelpdeskCase .create_from_db_document (
430422 db_document ,
431423 action = DBAction .CREATE ,
0 commit comments