fix(home): format issue/PR activity display when comment is empty #164

Merged
fuzzy merged 1 commit from fix/activity-types into main 2026-07-07 05:22:57 +00:00
Owner

What

Fix home panel display for activity events where the API returns Content as a JSON array [id, text] with empty comment text. Previously showed raw JSON like ["165",""]. Now shows human-readable fallbacks.

Changes

  • Issue events (close_issue, create_issue, comment_issue): parse JSON [issueNum, commentText], show comment if present, else Issue #N closed / Issue #N opened / Comment on #N
  • PR events (close_pull_request, approve_pull_request, reopen_pull_request): added to PR handler, show #N → text if comment present, else PR #N closed / PR #N approved / PR #N reopened
  • opTypeLabel: added labels for close/reopen/approve PR
  • activityColor: added new PR op types to existing PR color

Why

Raw JSON in the activity feed is unreadable. These op types exist in the Gitea/Forgejo API but were unhandled.

Testing

  • go build ./... passes
  • All pre-commit hooks pass

Breaking Changes

None

Notes

Follows existing pattern for PR events (parsing Content as []string JSON). The formatDesc function in homeview.go now covers all known issue and PR activity op types.

## What Fix home panel display for activity events where the API returns `Content` as a JSON array `[id, text]` with empty comment text. Previously showed raw JSON like `["165",""]`. Now shows human-readable fallbacks. ### Changes - **Issue events** (`close_issue`, `create_issue`, `comment_issue`): parse JSON `[issueNum, commentText]`, show comment if present, else `Issue #N closed` / `Issue #N opened` / `Comment on #N` - **PR events** (`close_pull_request`, `approve_pull_request`, `reopen_pull_request`): added to PR handler, show `#N → text` if comment present, else `PR #N closed` / `PR #N approved` / `PR #N reopened` - **opTypeLabel**: added labels for close/reopen/approve PR - **activityColor**: added new PR op types to existing PR color ## Why Raw JSON in the activity feed is unreadable. These op types exist in the Gitea/Forgejo API but were unhandled. ## Testing - [x] `go build ./...` passes - [x] All pre-commit hooks pass ## Breaking Changes None ## Notes Follows existing pattern for PR events (parsing `Content` as `[]string` JSON). The `formatDesc` function in `homeview.go` now covers all known issue and PR activity op types.
fix(home): format closed/opened issue display when comment is empty
All checks were successful
Test and Release / test (pull_request) Successful in 2m44s
Test and Release / lint (pull_request) Successful in 3m50s
ae063a4383
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Clean fix. Parses Content JSON array for issue events, shows comment text when present, falls back to friendly label (e.g. "Issue #165 closed") when empty. Follows existing pattern from PR event handling (lines 318-321).

Non-blocking suggestion: formatDesc is a closure inside renderActivities(), making it untestable. Extracting it would allow table-driven tests for this formatting logic. Filed as #165.

Checklist

  • Correctness: Solves stated problem. JSON parse + fallback logic correct.
  • Completeness: Covers close_issue, create_issue, comment_issue.
  • Test coverage: ⚠️ No tests added (pre-existing architectural limitation — noted in #165).
  • Error handling: Unmarshal failures fall through gracefully to Content fallback.
  • Performance: No regressions (single Unmarshal per activity).
  • Maintainability: Follows existing patterns, minimal diff.
  • Security: No concerns (display-only change).
## Review **Result: Approved** — no blocking issues. **Summary:** Clean fix. Parses `Content` JSON array for issue events, shows comment text when present, falls back to friendly label (e.g. "Issue #165 closed") when empty. Follows existing pattern from PR event handling (lines 318-321). **Non-blocking suggestion:** `formatDesc` is a closure inside `renderActivities()`, making it untestable. Extracting it would allow table-driven tests for this formatting logic. Filed as #165. ## Checklist - Correctness: ✅ Solves stated problem. JSON parse + fallback logic correct. - Completeness: ✅ Covers close_issue, create_issue, comment_issue. - Test coverage: ⚠️ No tests added (pre-existing architectural limitation — noted in #165). - Error handling: ✅ Unmarshal failures fall through gracefully to Content fallback. - Performance: ✅ No regressions (single Unmarshal per activity). - Maintainability: ✅ Follows existing patterns, minimal diff. - Security: ✅ No concerns (display-only change).
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 05:22:45 +00:00
fuzzy merged commit ae063a4383 into main 2026-07-07 05:22:57 +00:00
automation changed title from fix(home): format closed/opened issue display when comment is empty to fix(home): format issue/PR activity display when comment is empty 2026-07-07 05:26:24 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper!164
No description provided.