Skip to content

Conversation

@adalpari
Copy link
Contributor

@adalpari adalpari commented Nov 6, 2025

Description

This PR is preventing the user from answering already closed tickets in support. In addition. we are adding a visual indicator to show the ticket status. At first we started just showing the "Closed" one, but felt odd to just show the status for that state, so we went ahead with all of them.

Testing instructions

@jeremy, sin I assume you already have open and closd tickets, I'm targeting you directly here :)

  1. Log in with a WP.COM account and enable MODERN_SUPPORT FF
  2. Go to your support tickets list
  • Verify you see the states for all of them
  • Verify you can answer non-closed tickets
  • Verify you cannot answer closed tickets
Screenshot 2025-11-06 at 10 23 33 Screenshot 2025-11-06 at 10 24 22

@adalpari
Copy link
Contributor Author

adalpari commented Nov 6, 2025

@claude

@claude
Copy link

claude bot commented Nov 6, 2025

Claude finished @adalpari's task —— View job


Code Review Complete ✅

I've completed a comprehensive review of this PR that prevents users from replying to closed support tickets and adds visual status indicators. Overall, the implementation is well-structured and follows good practices. Here are my findings:


Strengths

  1. Clean Architecture: The changes follow proper separation of concerns - model updates, repository layer, UI layer, and tests are all appropriately modified.

  2. Good UI/UX Design:

    • The status badges are visually clear with appropriate color coding
    • The closed conversation banner is prominent and informative
    • Disabling replies for closed tickets prevents user confusion
  3. Comprehensive Test Coverage: Both repository and ViewModel tests were updated to include the new status field, maintaining test quality.

  4. Proper Compose Patterns: Good use of Material 3 theming, semantic modifiers, and composable structure.


🔍 Issues & Recommendations

1. Status String Handling (Medium Priority)

Location: HEConversationDetailScreen.kt:69, HEConversationsListScreen.kt:134

Issue: The status comparison uses hardcoded strings in different formats:

  • Line 69: STATUS_CLOSED = "closed" (lowercase)
  • Line 116: .equals(STATUS_CLOSED, ignoreCase = true) (case-insensitive)
  • Line 134: when (status.lowercase()) (explicitly lowercased)

Recommendation: Consider centralizing status constants to avoid inconsistencies:

object SupportConversationStatus {
    const val OPEN = "open"
    const val PENDING = "pending"
    const val ON_HOLD = "on-hold"
    const val SOLVED = "solved"
    const val CLOSED = "closed"
}

This would make the code more maintainable and prevent potential bugs if the API changes status formats.


2. Missing "New" Status Handling (Low Priority)

Location: HEConversationsListScreen.kt:134-165

Issue: The screenshots show a "new" status badge, but the ConversationStatusBadge function doesn't have a case for "new" status - it falls through to the else branch using default surfaceVariant colors.

Recommendation: Add an explicit case for "new" status if it's a valid state, or document why it's intentionally using default colors.


3. Potential Line Length Violation (Low Priority)

Location: HEConversationsListScreen.kt:73-74, HEConversationDetailScreen.kt:101-102

Issue: According to the CLAUDE.md file, the maximum line length is 120 characters. While most lines appear compliant, some lines with string concatenation might be close to the limit.

Recommendation: Run ./gradlew detekt to verify no line length violations exist.


4. Accessibility Consideration (Low Priority)

Location: HEConversationsListScreen.kt:167-178

Issue: The status badge doesn't have explicit content description for accessibility, relying on the text being read automatically.

Recommendation: Consider adding a semantic contentDescription to the status badge for better screen reader support, especially since color is used to convey meaning.


📋 Code Quality Checklist

  • Clean Code: Well-structured, readable code with clear naming
  • Error Handling: Proper null checks and safe calls
  • Testing: Comprehensive unit tests updated for new field
  • UI/UX: Clear visual indicators and proper user feedback
  • ⚠️ Constants: Could benefit from centralized status constants
  • Compose Best Practices: Good use of Material 3, modifiers, and state management
  • Performance: No obvious performance issues
  • Security: No security concerns identified

🎯 Testing Recommendations

Before merging, please verify:

  1. ✅ Run ./gradlew detekt to check for any code style violations
  2. ✅ Run unit tests: ./gradlew :WordPress:testWordPressVanillaDebugUnitTest
  3. ✅ Test all status types display correctly (open, pending, on-hold, solved, closed, new)
  4. ✅ Verify closed ticket banner prevents message sending
  5. ✅ Test edge cases (very long status names, rapid status changes)
  6. ✅ Test with screen readers for accessibility

📝 Minor Observations

  1. Line 69: The constant STATUS_CLOSED is private and only used once with case-insensitive comparison - consider if the constant is necessary or if it could be inlined.

  2. Repository Changes: The status field addition to SupportConversation model and repository mappings is clean and minimal - good job keeping changes focused.

  3. Test Updates: The test helper functions properly include the new status field with appropriate defaults ("open") - this is good practice.


Summary

This is a solid implementation that achieves its goals effectively. The main suggestions are minor improvements around status constant management and ensuring comprehensive status handling. The code is production-ready with the current implementation, and the suggested improvements are optional enhancements for long-term maintainability.

Recommendation: ✅ Approve with minor suggestions - The PR can be merged as-is, with the suggestions considered for future improvements.


@dangermattic
Copy link
Collaborator

dangermattic commented Nov 6, 2025

2 Warnings
⚠️ strings.xml files should only be updated on release branches, when the translations are downloaded by our automation.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 6, 2025

App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
FlavorJalapeno
Build TypeDebug
Versionpr22342-ecb21de
Commitecb21de
Direct Downloadjetpack-prototype-build-pr22342-ecb21de.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Nov 6, 2025

App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
FlavorJalapeno
Build TypeDebug
Versionpr22342-ecb21de
Commitecb21de
Direct Downloadwordpress-prototype-build-pr22342-ecb21de.apk
Note: Google Login is not supported on these builds.

@adalpari adalpari marked this pull request as ready for review November 6, 2025 09:46
@adalpari adalpari requested a review from jkmassel November 6, 2025 09:46
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 3.06122% with 95 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.10%. Comparing base (a18c70b) to head (ecb21de).
⚠️ Report is 1 commits behind head on trunk.

Files with missing lines Patch % Lines
...ndroid/support/he/ui/HEConversationDetailScreen.kt 0.00% 41 Missing ⚠️
...s/android/support/he/ui/ConversationStatusBadge.kt 0.00% 34 Missing ⚠️
...ess/android/support/he/model/ConversationStatus.kt 0.00% 11 Missing ⚠️
...android/support/he/ui/HEConversationsListScreen.kt 0.00% 6 Missing ⚠️
...ess/android/support/he/util/HEConversationUtils.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk   #22342      +/-   ##
==========================================
- Coverage   39.12%   39.10%   -0.03%     
==========================================
  Files        2205     2207       +2     
  Lines      106157   106231      +74     
  Branches    15049    15054       +5     
==========================================
+ Hits        41536    41539       +3     
- Misses      61129    61200      +71     
  Partials     3492     3492              

☔ 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.

Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

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

We could probably expose the status in the header of a detail view instead of the message count.

I noted one other issue inline.

Otherwise, this works well.

@@ -0,0 +1,10 @@
package org.wordpress.android.support.he.model

object ConversationStatus {
Copy link
Contributor

Choose a reason for hiding this comment

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

These status values are more for the support person than for the user – we probably shouldn't expose them directly.

On iOS we have "waiting for support","waiting for user", "solved" and "closed" – we can probably mirror that here?

Copy link
Contributor Author

@adalpari adalpari Nov 7, 2025

Choose a reason for hiding this comment

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

Good point!
I've made some changes here (and refactor)

Screenshot 2025-11-07 at 18 59 42 Screenshot 2025-11-07 at 19 00 07

@adalpari adalpari requested a review from jkmassel November 7, 2025 18:03
…osed-tickets

# Conflicts:
#	WordPress/src/main/java/org/wordpress/android/support/he/ui/HEConversationDetailScreen.kt
#	WordPress/src/main/res/values/strings.xml
@adalpari adalpari enabled auto-merge (squash) November 12, 2025 11:45
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants