mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Fix mypy type errors in Jira integration (#13181)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -155,6 +155,9 @@ class JiraDcExistingConversationView(JiraDcViewInterface):
|
||||
self.conversation_id, conversation_init_data, user_id
|
||||
)
|
||||
|
||||
if agent_loop_info.event_store is None:
|
||||
raise StartingConvoException('Event store not available')
|
||||
|
||||
final_agent_observation = get_final_agent_observation(
|
||||
agent_loop_info.event_store
|
||||
)
|
||||
|
||||
@@ -601,6 +601,12 @@ async def get_current_workspace_link(request: Request):
|
||||
user_auth = cast(SaasUserAuth, await get_user_auth(request))
|
||||
user_id = await user_auth.get_user_id()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
user = await jira_manager.integration_store.get_user_by_active_workspace(
|
||||
user_id
|
||||
)
|
||||
@@ -654,6 +660,12 @@ async def unlink_workspace(request: Request):
|
||||
user_auth = cast(SaasUserAuth, await get_user_auth(request))
|
||||
user_id = await user_auth.get_user_id()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
user = await jira_manager.integration_store.get_user_by_active_workspace(
|
||||
user_id
|
||||
)
|
||||
|
||||
@@ -281,6 +281,12 @@ async def create_jira_dc_workspace(
|
||||
user_id = await user_auth.get_user_id()
|
||||
user_email = await user_auth.get_user_email()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
if JIRA_DC_ENABLE_OAUTH:
|
||||
# OAuth flow enabled - create session and redirect to OAuth
|
||||
state = str(uuid.uuid4())
|
||||
@@ -404,6 +410,12 @@ async def create_workspace_link(request: Request, link_data: JiraDcLinkCreate):
|
||||
user_id = await user_auth.get_user_id()
|
||||
user_email = await user_auth.get_user_email()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
target_workspace = link_data.workspace_name
|
||||
|
||||
if JIRA_DC_ENABLE_OAUTH:
|
||||
@@ -593,6 +605,12 @@ async def get_current_workspace_link(request: Request):
|
||||
user_auth = cast(SaasUserAuth, await get_user_auth(request))
|
||||
user_id = await user_auth.get_user_id()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
user = await jira_dc_manager.integration_store.get_user_by_active_workspace(
|
||||
user_id
|
||||
)
|
||||
@@ -645,6 +663,12 @@ async def unlink_workspace(request: Request):
|
||||
user_auth = cast(SaasUserAuth, await get_user_auth(request))
|
||||
user_id = await user_auth.get_user_id()
|
||||
|
||||
if not user_id:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||
detail='User ID not found',
|
||||
)
|
||||
|
||||
user = await jira_dc_manager.integration_store.get_user_by_active_workspace(
|
||||
user_id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user