refactor: remove duplicate comment_on_linear_issue from webapp, import from utils (#996)

* refactor: remove duplicate comment_on_linear_issue from webapp, import from utils.linear

* linting
This commit is contained in:
Aran Yogesh 2026-03-03 14:35:24 -08:00 • committed by GitHub
parent 5bced68e72
commit 3dee480e82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,6 +17,7 @@ from langgraph_sdk import get_client
# Local import for encryption
from .encryption import encrypt_token
from .utils.comments import get_recent_comments
from .utils.linear import comment_on_linear_issue
from .utils.multimodal import dedupe_urls, extract_image_urls, fetch_image_block
logger = logging.getLogger(__name__)
@ -272,52 +273,6 @@ async def react_to_linear_comment(comment_id: str, emoji: str = "👀") -> bool:
return False
async def comment_on_linear_issue(issue_id: str, comment_body: str) -> bool:
"""Add a comment to a Linear issue.
Args:
issue_id: The Linear issue ID
comment_body: The comment text
Returns:
True if successful, False otherwise
"""
if not LINEAR_API_KEY:
return False
url = "https://api.linear.app/graphql"
mutation = """
mutation CommentCreate($issueId: String!, $body: String!) {
commentCreate(input: { issueId: $issueId, body: $body }) {
success
comment {
id
}
}
}
"""
async with httpx.AsyncClient() as client:
try:
response = await client.post(
url,
headers={
"Authorization": LINEAR_API_KEY,
"Content-Type": "application/json",
},
json={
"query": mutation,
"variables": {"issueId": issue_id, "body": comment_body},
},
)
response.raise_for_status()
result = response.json()
return bool(result.get("data", {}).get("commentCreate", {}).get("success"))
except Exception: # noqa: BLE001
return False
async def fetch_linear_issue_details(issue_id: str) -> dict[str, Any] | None:
"""Fetch full issue details from Linear API including description and comments.