Skip to content

Feature/add live updates in ticket view#88

Merged
codebyNorthsteep merged 3 commits into
mainfrom
feature/addLiveUpdatesInTicketView
Apr 23, 2026
Merged

Feature/add live updates in ticket view#88
codebyNorthsteep merged 3 commits into
mainfrom
feature/addLiveUpdatesInTicketView

Conversation

@codebyNorthsteep

@codebyNorthsteep codebyNorthsteep commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

This pull request adds real-time updates for the activity log on the ticket detail page by implementing polling in the frontend and updating the UI to display the activity log. It also improves localization of date formatting for comments and activity entries.

Real-time activity log updates:

  • Added a new section in ticket-detail.html to display the activity log, which updates every 5 seconds.
  • Implemented polling in ticket-detail.js to fetch and update the activity log from the backend at regular intervals, with cleanup on page unload. [1] [2]
  • Added logic to render activity log entries in the DOM, including formatting and handling empty states.

Localization improvements:

  • Changed date formatting for comments and activity log entries to use Swedish locale (sv-SE) for better localization. [1] [2]

Summary by CodeRabbit

  • New Features
    • Ticket detail pages now include a dedicated activity log section that displays all ticket-related events, comments, and status changes as they occur. The activity log automatically refreshes every 5 seconds, allowing you to monitor ticket progress in real-time and stay informed without manually refreshing the page yourself.

@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@codebyNorthsteep has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 49 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 36 minutes and 49 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee28c863-a86c-4393-b28e-b2754236b238

📥 Commits

Reviewing files that changed from the base of the PR and between 21cfe2a and a05887c.

📒 Files selected for processing (2)
  • src/main/resources/static/js/ticket-detail.js
  • src/main/resources/static/pages/ticket-detail.html
📝 Walkthrough

Walkthrough

The ticket detail page now includes real-time activity log polling. When a ticket ID is present, the page fetches activity logs from the server every 5 seconds and displays them with localized timestamps. The activity log section is rendered on the page with a loading indicator and updates dynamically as new logs are available.

Changes

Cohort / File(s) Summary
Activity Log Polling
src/main/resources/static/js/ticket-detail.js
Introduces subscribeToActivityUpdates function that polls /tickets/{ticketId}/logs every 5 seconds, and updateActivityLog function to render activity logs with Swedish locale timestamps. Shows placeholder for empty logs.
Activity Log UI Section
src/main/resources/static/pages/ticket-detail.html
Adds HTML container for activity log display with loading message and 5-second refresh interval label.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 Hop, hop—the logs now dance and flow,
Polling quick in rhythms swift below,
Five-second whispers from the Swedish tongue,
Activity streams freshly spun,
Where timestamps bloom and histories are sung! 🌿✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main feature addition: implementing live updates in the ticket view. It accurately reflects the PR's primary objective of adding real-time activity log polling.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/addLiveUpdatesInTicketView

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/resources/static/js/ticket-detail.js`:
- Around line 160-176: The subscribeToActivityUpdates function allows
overlapping fetches and delays the first fetch; replace the setInterval pattern
with an await-driven loop that fetches immediately and only schedules the next
fetch after the previous one finishes to avoid concurrent requests and stale
renders. Inside subscribeToActivityUpdates, call
apiFetch(`/tickets/${ticketId}/logs`) once immediately, then run a loop (or
recursive setTimeout) that awaits each response before sleeping (5000ms) and
calls updateActivityLog(logs); keep a reference to the interval/stop flag so
window.addEventListener('beforeunload') can clear/stop the loop; ensure error
handling around apiFetch (console.error) still exists and that you reference
subscribeToActivityUpdates, apiFetch and updateActivityLog when making the
change.
- Around line 188-197: The render currently rebuilds the entire activity DOM
each poll via container.innerHTML = logs.map(...).join(''), which resets scroll;
preserve render stability by caching the last rendered payload (e.g., a
module-scoped lastRenderedLogs or lastRenderedKey) and compare it to the current
logs (use a stable serialisation like JSON.stringify(logs) or a
version/timestamp field) inside the polling handler before touching the DOM; if
unchanged, return early, otherwise update container.innerHTML and set the cache
to the new payload. Ensure you reference the existing container variable and the
logs array/parameter from the polling function when implementing the check.

In `@src/main/resources/static/pages/ticket-detail.html`:
- Around line 60-63: The activity log container with id "activityLog" is a
scrollable region but not keyboard focusable or exposed as a landmark; make it
reachable by adding keyboard focusability and an accessible label—set
tabindex="0" on the element with id "activityLog", add role="region" and either
aria-label="Aktivitetslogg" or aria-labelledby pointing to the <h2> to provide a
clear name, and ensure any focus styles remain visible so keyboard users can
scroll the container.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77b3801d-fcf1-4fe9-a341-d093c184adb8

📥 Commits

Reviewing files that changed from the base of the PR and between f693ef4 and 21cfe2a.

📒 Files selected for processing (2)
  • src/main/resources/static/js/ticket-detail.js
  • src/main/resources/static/pages/ticket-detail.html

Comment thread src/main/resources/static/js/ticket-detail.js
Comment thread src/main/resources/static/js/ticket-detail.js
Comment thread src/main/resources/static/pages/ticket-detail.html Outdated
@codebyNorthsteep
codebyNorthsteep merged commit 7b727c3 into main Apr 23, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant