Fix grower save bug, add name sorting, and clarify status meanings#164
Open
markdav-is wants to merge 1 commit into
Open
Fix grower save bug, add name sorting, and clarify status meanings#164markdav-is wants to merge 1 commit into
markdav-is wants to merge 1 commit into
Conversation
- #155: Remove service-layer permission check from UpdateGrowerAsync and align the PUT controller endpoint to use EditModule policy (matching the POST). The extra IsAuthorized call in the service returned null for users without explicit module Edit permission, producing the 'Unable to save changes' error. - #161: Add ORDER BY GrowerName to all grower list queries in the repository so the list is consistently alphabetical across filters. - #149: Add tooltip (title attribute) to status badges in Grower Index and Edit pages explaining the difference between Active, Inactive, and Exited so users understand what each status means on hover. https://claude.ai/code/session_013s3rc5YSBFQ5U9Ef1bH13c
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses Grower module reliability and usability by fixing an authorization-related save failure, enforcing consistent alphabetical ordering of grower lists, and clarifying grower status meanings via UI tooltips.
Changes:
- Removed service-layer authorization gating for grower updates and enforced edit authorization at the
PUTcontroller endpoint. - Added
OrderBy(g => g.GrowerName)to grower list repository methods to ensure consistent sorting. - Added status “meaning” tooltips to Grower Index and Edit status badges.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Server/Services/GrowerService.cs | Removes service-layer authorization check from update path to avoid silent save failures. |
| Server/Repository/GrowerRepository.cs | Applies consistent alphabetical ordering by GrowerName across list queries. |
| Server/Controllers/GrowerController.cs | Tightens PUT authorization to require EditModule policy (matching POST). |
| Client/Modules/Grower/Index.razor | Adds status tooltip descriptions for list badges (with noted localization/accessibility follow-ups). |
| Client/Modules/Grower/Edit.razor | Adds status tooltip/ARIA label on edit badge and includes a small formatting fix opportunity. |
Comment on lines
+126
to
129
| <span class="badge @GetStatusBadgeClass(grower.Status)" | ||
| title="@GetStatusDescription(grower.Status)"> | ||
| @GetStatusText(grower.Status) | ||
| </span> |
Comment on lines
+346
to
+352
| private string GetStatusDescription(GrowerStatus status) => status switch | ||
| { | ||
| GrowerStatus.Active => "Currently participating in the program.", | ||
| GrowerStatus.Inactive => "Temporarily paused (e.g. illness or travel) but has not left the program.", | ||
| GrowerStatus.Exited => "Has permanently left the program.", | ||
| _ => string.Empty | ||
| }; |
| <span class="badge bg-secondary me-1">General</span> | ||
| } | ||
| <small class="text-muted">@note.CreatedOn.ToLocalTime().ToString("yyyy-MM-dd HH:mm") � @note.CreatedBy</small> | ||
| <small class="text-muted">@note.CreatedOn.ToLocalTime().ToString("yyyy-MM-dd HH:mm") � @note.CreatedBy</small> |
d712d0a to
63720ac
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Bug: Grower Edit page fails to save — 'Unable to save changes. Please try again.' #155 — Grower Edit page save was silently failing for users without explicit "Edit" module permission. The service layer was doing its own
IsAuthorizedcheck (against CLAUDE.md policy), returningnullwhen it failed, which surfaced as "Unable to save changes. Please try again." Removed the service-layer check and aligned thePUT /{id}controller endpoint to use[Authorize(Policy = PolicyNames.EditModule)], matching the existingPOSTendpoint.Fixes sortable columns for growers. #161 — Grower list had no consistent ordering. All repository list methods (
GetAllGrowers,GetActiveGrowers,GetGrowersByStatus,GetGrowersByVillage,GetGrowersByMentor) now sort byGrowerNamealphabetically. Note: since the name is a single field, this sorts by full name — a separateSurnamecolumn would be needed for true surname-first sorting.Fixes Support: Team unclear on what 'Inactive' grower status means #149 — Status badges in Grower Index and Edit now include a
titletooltip explaining what each status means on hover: Active (currently participating), Inactive (temporarily paused, still in program), Exited (permanently left).Test plan
https://claude.ai/code/session_013s3rc5YSBFQ5U9Ef1bH13c
Generated by Claude Code