Skip to content

fix: hide delete buttons unless signed on#2361

Merged
jo-elimu merged 2 commits intomainfrom
2360-hide-submit-buttons-when-contributor-is-not-signed-on
Feb 19, 2026
Merged

fix: hide delete buttons unless signed on#2361
jo-elimu merged 2 commits intomainfrom
2360-hide-submit-buttons-when-contributor-is-not-signed-on

Conversation

@jo-elimu
Copy link
Copy Markdown
Member

@jo-elimu jo-elimu commented Feb 19, 2026

Issue Number

Purpose

Technical Details

Testing Instructions

Screenshots


Format Checks

Note

Files in PRs are automatically checked for format violations with mvn spotless:check.

If this PR contains files with format violations, run mvn spotless:apply to fix them.

@jo-elimu jo-elimu self-assigned this Feb 19, 2026
@jo-elimu jo-elimu requested a review from a team as a code owner February 19, 2026 12:14
@jo-elimu jo-elimu requested review from SnehaHS65, Souvik-Cyclic and nya-elimu and removed request for a team February 19, 2026 12:14
@jo-elimu jo-elimu linked an issue Feb 19, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 19, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

Updated project version and modified several content edit JSPs so the Delete link is rendered only when a contributor is present; no other behavioral or public API changes.

Changes

Cohort / File(s) Summary
Version Update
pom-dependency-tree.txt
Bumped application version from 2.6.148-SNAPSHOT to 2.6.149-SNAPSHOT.
Conditional Delete Link Rendering
src/main/webapp/WEB-INF/jsp/content/emoji/edit.jsp, src/main/webapp/WEB-INF/jsp/content/letter/edit.jsp, src/main/webapp/WEB-INF/jsp/content/multimedia/image/edit.jsp, src/main/webapp/WEB-INF/jsp/content/multimedia/video/edit.jsp, src/main/webapp/WEB-INF/jsp/content/number/edit.jsp, src/main/webapp/WEB-INF/jsp/content/word/edit.jsp
Wrapped the Delete link/button in a if not empty contributor conditional so the Delete action is only shown when a contributor is present. No other UI or backend changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes the required issue number (#2360) but lacks Purpose, Technical Details, Testing Instructions, and Screenshots sections, which are important for code review completeness. Fill in the empty Purpose, Technical Details, Testing Instructions, and Screenshots sections to provide complete context for reviewers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: hiding delete buttons when a contributor is not signed in, which aligns with the core modification across multiple edit.jsp files.
Linked Issues check ✅ Passed The PR successfully implements the requirement from #2360 to hide delete/submit buttons when contributor is empty across all edit.jsp files (emoji, letter, image, video, number, word), preventing web crawlers from accessing URLs.
Out of Scope Changes check ✅ Passed The version bump in pom-dependency-tree.txt is an expected artifact and not a functional change; all code changes are in scope and focus solely on hiding delete buttons conditionally.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2360-hide-submit-buttons-when-contributor-is-not-signed-on

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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/webapp/WEB-INF/jsp/content/number/edit.jsp (1)

113-114: ⚠️ Potential issue | 🟠 Major

Guard against null contributor before comparing IDs to prevent NPE.

Lines 113-114 access contributor.id without checking if contributor is null. When unauthenticated visitors access this page, contributor will be null from the session, throwing a NullPointerException. The same issue exists in word/edit.jsp at line 173.

Add a null guard before the ID comparison:

Suggested fix
-    <c:if test="${(not empty numberContributionEvents) 
-                  && (numberContributionEvents[0].contributor.id != contributor.id)}">
+    <c:if test="${(not empty numberContributionEvents) and (not empty contributor)
+                  && (numberContributionEvents[0].contributor.id != contributor.id)}">

Apply the same guard to word/edit.jsp at line 173.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/webapp/WEB-INF/jsp/content/number/edit.jsp` around lines 113 - 114,
The comparison on numberContributionEvents[0].contributor.id uses contributor.id
without guarding for a null contributor, causing an NPE for unauthenticated
users; update the conditional in edit.jsp to check contributor != null before
comparing IDs (i.e., ensure contributor is not null &&
numberContributionEvents[0].contributor.id != contributor.id), and make the
identical change at the equivalent check in word/edit.jsp (the conditional
around line 173) so both pages safely handle null contributor sessions.
🤖 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/webapp/WEB-INF/jsp/content/word/edit.jsp`:
- Around line 163-165: The <c:if> guard is malformed: the opening tag is
immediately closed leaving the Delete anchor (<a
href="/content/word/delete/${word.id}">) outside the conditional and an orphaned
</c:if> remains; fix by turning the empty self-closed <c:if test="${not empty
contributor}"></c:if> into a proper block that wraps the Delete link (i.e.,
place the <a href="<spring:url value='/content/word/delete/${word.id}' />"
...>Delete</a> inside the <c:if test="${not empty contributor}"> ... </c:if>),
ensuring the conditional controls rendering and removing any extra/mismatched
tags.

---

Outside diff comments:
In `@src/main/webapp/WEB-INF/jsp/content/number/edit.jsp`:
- Around line 113-114: The comparison on
numberContributionEvents[0].contributor.id uses contributor.id without guarding
for a null contributor, causing an NPE for unauthenticated users; update the
conditional in edit.jsp to check contributor != null before comparing IDs (i.e.,
ensure contributor is not null && numberContributionEvents[0].contributor.id !=
contributor.id), and make the identical change at the equivalent check in
word/edit.jsp (the conditional around line 173) so both pages safely handle null
contributor sessions.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.98%. Comparing base (c6ba81a) to head (d5884f4).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2361      +/-   ##
============================================
+ Coverage     16.80%   16.98%   +0.17%     
- Complexity      464      468       +4     
============================================
  Files           264      264              
  Lines          7836     7836              
  Branches        899      899              
============================================
+ Hits           1317     1331      +14     
+ Misses         6445     6432      -13     
+ Partials         74       73       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jo-elimu jo-elimu merged commit d942976 into main Feb 19, 2026
18 of 20 checks passed
@jo-elimu jo-elimu deleted the 2360-hide-submit-buttons-when-contributor-is-not-signed-on branch February 19, 2026 12:38
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.

Hide form buttons when contributor is not signed on

1 participant