Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ async def slack_events(request: Request) -> JSONResponse:

try:
body: dict = await request.json()
logger.debug(f"Received Slack event: {body}")
logger.info(f"Received Slack event: {body}")

if request.headers.get("x-slack-retry-num"):
logger.info("SLACK EVENT: Ignoring Slack retry")
return JSONResponse({"status": "ignored"})

if request.headers.get("content-type") == "application/json":
if body.get("type") == "url_verification":
Expand All @@ -92,7 +96,7 @@ async def slack_events(request: Request) -> JSONResponse:

logger.info("SLACK EVENT: Requesting upload via dm!")

await asyncio.create_task(
asyncio.create_task(
slack.request_upload_via_dm(event.get("user", ""), cleaned_text)
)
except Exception as e:
Expand Down
12 changes: 6 additions & 6 deletions tests/src/core/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

def import_slack_module(monkeypatch) -> object:
"""
Helper function to import the slack module after setting the SLACK_API_TOKEN environment variable.

Args:
monkeypatch: The pytest monkeypatch fixture.
Helper function to import the slack module after setting the SLACK_API_TOKEN environment variable.

Returns:
object: The imported config module.
Args:
monkeypatch: The pytest monkeypatch fixture.

Returns:
object: The imported config module.
"""

monkeypatch.setenv("SLACK_API_TOKEN", "test-token")
Expand Down
Loading