Fix edit ticket: form submit, s3key column mapping, and audit log con…#140
Fix edit ticket: form submit, s3key column mapping, and audit log con…#140viktorlindell12 wants to merge 2 commits into
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR contains three distinct changes: a JPA column mapping adjustment for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/resources/db/migration/V10__update_audit_log_action_constraint.sql (1)
4-4: Add trailing newline at end of file.SQL files should end with a newline character for consistency with standard text file conventions and to avoid issues with certain version control systems and tools.
📝 Proposed fix
- CHECK (action IN ('CASE_CREATED', 'CASE_ASSIGNED', 'CASE_STATUS_CHANGED', 'COMMENT_ADDED', 'FILE_UPLOADED', 'USER_ROLE_CHANGED', 'CASE_UPDATED')); + CHECK (action IN ('CASE_CREATED', 'CASE_ASSIGNED', 'CASE_STATUS_CHANGED', 'COMMENT_ADDED', 'FILE_UPLOADED', 'USER_ROLE_CHANGED', 'CASE_UPDATED')); +🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/resources/db/migration/V10__update_audit_log_action_constraint.sql` at line 4, The SQL file ends without a trailing newline on the CHECK constraint line ("CHECK (action IN ('CASE_CREATED', 'CASE_ASSIGNED', 'CASE_STATUS_CHANGED', 'COMMENT_ADDED', 'FILE_UPLOADED', 'USER_ROLE_CHANGED', 'CASE_UPDATED'));"); open that migration file and add a single newline character at the end of the file so the file terminates with a trailing newline, then save and commit the change.
🤖 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/templates/edit_ticket.html`:
- Line 33: The uploadNewFile() handler in script.js currently hardcodes
submitBtn.innerText = "Create Ticket" on multiple completion/error paths which
causes the Edit page button (id="submitBtn") to flip from "Save Changes" to
"Create Ticket"; fix by capturing the button's original text at the start of
uploadNewFile() (e.g., const originalLabel = submitBtn.innerText) and restore
originalLabel instead of the hardcoded string in all places where
submitBtn.innerText is reset (references: uploadNewFile(), submitBtn variable
and the lines that set submitBtn.innerText = "Create Ticket"); ensure the
originalLabel is used on success, error, and finally paths so Create and Edit
pages keep their correct labels.
---
Nitpick comments:
In `@src/main/resources/db/migration/V10__update_audit_log_action_constraint.sql`:
- Line 4: The SQL file ends without a trailing newline on the CHECK constraint
line ("CHECK (action IN ('CASE_CREATED', 'CASE_ASSIGNED', 'CASE_STATUS_CHANGED',
'COMMENT_ADDED', 'FILE_UPLOADED', 'USER_ROLE_CHANGED', 'CASE_UPDATED'));"); open
that migration file and add a single newline character at the end of the file so
the file terminates with a trailing newline, then save and commit the change.
🪄 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: 08971a11-e233-4799-b2b0-27386ef2186a
📒 Files selected for processing (3)
src/main/java/org/example/untitled/usercase/UploadedFile.javasrc/main/resources/db/migration/V10__update_audit_log_action_constraint.sqlsrc/main/resources/templates/edit_ticket.html
| <footer class="ticket-footer"> | ||
| <div class="ticket-button"> | ||
| <button onclick="uploadNewFile()" type="button">Save Changes</button> | ||
| <button onclick="uploadNewFile()" type="button" id="submitBtn">Save Changes</button> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm the hardcoded "Create Ticket" reset in uploadNewFile and that submitBtn id is also used by the create page.
rg -nP -C2 '"Create Ticket"|getElementById\(\s*[\x27"]submitBtn'
fd -t f -e html | xargs rg -nP -C1 'id\s*=\s*"submitBtn"|onclick\s*=\s*"uploadNewFile'Repository: ithsjava25/project-backend-untitled-team
Length of output: 3270
Button text will be reset to "Create Ticket" on the Edit Ticket page.
Now that this button is wired with id="submitBtn", the uploadNewFile() function in script.js will reset its text on all completion/error paths. Specifically, lines 45, 70, 76, and 80 hardcode submitBtn.innerText = "Create Ticket", causing the button to incorrectly switch from "Save Changes" to "Create Ticket" after any upload completes or fails. Parameterize the reset label in uploadNewFile() (e.g., capture and restore the original button text) so the correct label is preserved for both create and edit pages.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/templates/edit_ticket.html` at line 33, The
uploadNewFile() handler in script.js currently hardcodes submitBtn.innerText =
"Create Ticket" on multiple completion/error paths which causes the Edit page
button (id="submitBtn") to flip from "Save Changes" to "Create Ticket"; fix by
capturing the button's original text at the start of uploadNewFile() (e.g.,
const originalLabel = submitBtn.innerText) and restore originalLabel instead of
the hardcoded string in all places where submitBtn.innerText is reset
(references: uploadNewFile(), submitBtn variable and the lines that set
submitBtn.innerText = "Create Ticket"); ensure the originalLabel is used on
success, error, and finally paths so Create and Edit pages keep their correct
labels.
Summary by CodeRabbit
Bug Fixes
Chores