summaryrefslogtreecommitdiff
path: root/Hutch/Views/Tickets
Commit message (Collapse)AuthorAgeFilesLines
* fix: move the S1186 empty-block comments inside the bracesChristian Cleberg2026-07-161-1/+1
| | | | | | Trailing // comments after {} left the block lexically empty, so SonarCloud kept flagging stopLoading (and would have re-flagged the two Cancel buttons). S1186 wants a *nested* comment; use /* ... */ inside.
* chore: clear the actionable SonarCloud code smellsChristian Cleberg2026-07-161-1/+1
| | | | | | | | | | | | | | | | | | | - S1871: merge the identical .home / .recentActivity deep-link cases in RootView — recent activity is a section of Home, not its own screen. - S1186: comment the two intentionally-empty Cancel buttons (PatchsetDetailView, TicketDetailView) and the empty URLProtocol stopLoading override in APICacheTests. - S108: comment the expected-miss catch block in APICacheTests. - S1172: rename the unused url parameter in mimeType(for:) to _. - S4624: extract the nested template literal in the deep-link builders (background.js, content.js) to a pathSegment variable. Left as Won't Fix, with reasons: the 35 hardcoded-URI warnings (a one-forge client and its literal-URL tests), executeCached's 8 params (38 call sites, no benefit), the forceRefresh S1172 pair (fixed as a real bug instead), S1481 on ArtifactsView (false positive — $vm.error is used), and S7785 (top-level await would break a classic content script).
* fix: blank mailing list from Projects, swipe flicker, hidden uploadChristian Cleberg2026-07-162-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Three problems from manual testing. Opening a mailing list from More → Projects showed a blank screen, while the same tap on a project pinned to Home worked. handleTabNavigation reset the target path and appended to it two Task.yields later. When the target tab is already on screen — Projects lives under More — the reset starts an animated pop of the view the user is standing on and the appends land mid-animation. From Home the tab actually changes, so the More stack is quiescent and the appends land cleanly. Each case now builds its path and assigns it once, so SwiftUI gets a single diff with nothing to race. Destructive swipe actions made the row vanish and spring back while the confirmation was still up. role: .destructive makes SwiftUI perform the row removal on activation, which allowsFullSwipe: false does not prevent — the report was a tap, not a full swipe. These buttons only record pending state and wait for an answer, so they are plain buttons tinted red instead. Six sites: the two added here, plus trackers, pastes, and tracker ACLs and labels, which had the same flicker already. The artifacts upload control was invisible. It was declared as a toolbar item from a view that is a segment inside RepositoryDetailView's tab switch rather than its own navigation destination, so it never reached the navigation bar. It is a row in the list now, and also an action on the empty state — the overlay covers the list, and a repository with no artifacts is precisely the one that needs uploading.
* Phase 1: close the write gaps (#3)v3.6.0Christian Cleberg2026-07-154-0/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * refactor: collapse duplicated request paths in SRHTClient Five request paths each repeated the token guard, header setup, status-code handling, and a ~35-line #if DEBUG logging block. The file carried that block five times over. Extract makeAuthorizedRequest, send, and encodedGraphQLBody, and route execute, executeAndCache, executeMultipartFiles, and performGraphQLRequest through them. executeMultipart is now the single-file case of executeMultipartFiles, which it already was byte for byte. 938 lines to 612, with one copy of the logging block. fetchText keeps its own guard: it is a GET to an allowlisted URL and must not run GraphQL error checks over what is usually a plain-text build log. One behavior change falls out. executeAndCache wrote the raw response to the cache before decoding, so a 200 carrying GraphQL errors was cached and then thrown. Routing it through performGraphQLRequest surfaces those errors first, so error payloads are no longer cached. * feat: edit and delete tickets updateTicket and deleteTicket both existed in todo.sr.ht's API but were never called, so a ticket could be filed and its status changed but its subject and body were frozen from the moment it was created, and it could never be removed. Edit opens a sheet seeded with the current subject and body. The input carries only fields that actually changed, so an edit cannot clobber a field the user did not touch, and Save stays disabled until something differs. Clearing the body sends an explicit null via updateValue rather than a nil subscript assignment, which would drop the key and silently leave the old body in place — the same trap fixed for repository descriptions in 7ffef07. Delete is destructive and irreversible, so it sits behind a confirmation dialog naming the ticket and pops the detail view on success. * feat: subscribe to and unsubscribe from tickets ticketSubscribe and ticketUnsubscribe existed in the API but were never called, so email notifications for a ticket could only be managed on the web. Ticket.subscription is null when the user is not subscribed, so the detail query now reads it and the menu reflects real server state rather than guessing. The toggle updates optimistically and reverts on failure, so the control never claims a subscription that did not take. Decoded into the private payload rather than TicketDetail, which is Codable and cached — adding a field there would have changed the cached shape and touched every optimistic-update construction site. * feat: subscribe to and unsubscribe from trackers trackerSubscribe and trackerUnsubscribe existed in the API but were never called. Tracker.subscription is null when not subscribed, so the state can be read rather than guessed. The read is a separate uncached query. The tickets query it sits beside is paginated and cached, and a per-user subscription has no business riding along in page payloads or being served stale from disk. Unsubscribe passes tickets: false, so leaving a tracker does not silently drop subscriptions to individual tickets the user opted into. * feat: unsubscribe from mailing lists mailingListUnsubscribe existed in the API but was never called, so the list of subscriptions was readable and nothing more. Scoped to unsubscribe. MailingList has no subscription field, unlike Ticket and Tracker, so per-list state is only knowable from the subscriptions query — which is exactly what builds this view. Subscribing would need a list the user is by definition not subscribed to, and sr.ht exposes no discovery API to find one (see SCOPE.md on hub.sr.ht), so there is nowhere honest to put that action yet. The row is removed optimistically and restored if the mutation fails. The confirmation says plainly that Hutch cannot resubscribe, since it cannot. * feat: manage todo and lists email preferences updatePreferences existed on both services but was never called, so these were web-only settings. The two services expose preferences/updatePreferences under identical names but with different fields — notifySelf on todo, copySelf on lists — and there is no shared preferences service, so both are read and written side by side. They load concurrently and one service being unreachable does not hide the other's toggle. These are server-side and apply beyond Hutch, unlike the @AppStorage toggles above them in Settings, so the footer says so and each toggle reverts if its mutation fails. * refactor: drop the memory-only cache path Two executeCached overloads existed with different return types and semantics: one doing stale-while-revalidate against the persistent cache with TTLs, the other only consulting the in-memory responseCache. The second was an easy thing to reach for by mistake, since the compiler picked it purely on argument labels. It turned out to be dead. All 38 call sites already used the TTL-aware overload, and the memory-only one was the sole caller of executeAndCache, so both are removed. Its doc comment promised refresh "via the onRefresh callback", which the signature has not had for some time. SRHTClient is now 569 lines, down from 938 before this branch. responseCache stays as the in-memory layer behind cachedPayload and the three view models that read it directly. * chore: bump to 3.6.0 and record Phase 1 MARKETING_VERSION 3.5.0 -> 3.6.0, build 87 -> 88. * fix: decode preferences responses on the main actor The module sets SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, so the response types are implicitly main-actor isolated and their Decodable conformances are too. Decoding straight from an `async let` used those conformances from a nonisolated context, which warns today and is an error in the Swift 6 language mode. Move each fetch into its own method and `async let` over those instead, so decoding stays on the main actor. This is what HomeViewModel.loadDashboard already does, and the concurrency is unaffected — the network work still overlaps, since execute suspends and frees the actor.
* feat(cache): persist read-only API responsesv3.3.1Christian Cleberg2026-05-062-11/+59
| | | | | | | | | | | | Add a bounded stale-while-revalidate cache at the Sourcehut API boundary with stable keys, centralized TTLs, request coalescing, payload hashing, and LRU disk pruning. Cache high-value read-only repo, build, ticket, project, profile, paste, and Home/Work Queue data while keeping mutations network-only and invalidating related prefixes after successful writes. Add focused cache tests and implementation notes.
* feat: add persistent stale-while-revalidate API cacheChristian Cleberg2026-05-062-36/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce an actor-backed persistent cache layer at the SRHTClient boundary for read-only SourceHut data. Cache entries now store stable metadata including key, resource type, fetched/expires/access timestamps, payload hash, schema version, and payload size, with bounded memory and disk usage. Add centralized cache key builders and TTL defaults for repository, file, ticket, build, log, profile, status, and list-style resources. Support networkOnly, cacheOnly, cacheFirstThenRefresh, and refreshIgnoringCache policies, plus request coalescing for duplicate in-flight cache keys. Integrate first-pass caching into high-value low-risk read paths: - build detail and completed/active build logs - ticket detail - README lookup - repository tree, blob, and linked file reads Keep mutation paths network-only and add simple prefix invalidation after ticket and build mutations. Add compact cached/stale UI status rows and a Settings action to clear the persistent cache. Add focused cache tests covering round trips, expiration, stale fallback, policy behavior, request coalescing, prefix invalidation, size limits, LRU pruning, expired pruning, and mutation bypass behavior. Document storage, key, TTL, invalidation, limitations, and next recommended targets.
* fix: sonarqube code smell fixesv3.1.4Christian Cleberg2026-04-133-3/+5
|
* fix(tickets): load all pages on tracker open for accurate Open tabChristian Cleberg2026-04-131-5/+26
| | | | | | | | todo.sr.ht only exposes cursor-based `tracker.tickets` (no status filter), so client-side Open filtering missed older open tickets when only the first page was loaded. Paginate until the cursor is exhausted in loadTickets(). Fixes: https://todo.sr.ht/~ccleberg/hutch/62
* feat(theme): AMOLED true-black rows via themedRow()Christian Cleberg2026-04-134-1/+75
| | | | | | | | | | Apply listRowBackground(Color.black) per row in AMOLED mode using ThemedRowStyle and themedRow() across Lists and Forms. Use themedList() for scroll/grouped backgrounds. Treat segmented and clear list rows with isAMOLED-aware listRowBackground where Color.clear was required. Removes reliance on UIKit appearance for list cells on iOS 16+. Implements: https://todo.sr.ht/~ccleberg/hutch/24
* fix: suppress false "network request failed" error on ticket list scrollChristian Cleberg2026-04-131-1/+5
| | | | | | | | | | | | | | When scrolling through a large tracker, SwiftUI's .task modifier cancels in-flight pagination requests as rows leave the screen. URLSession responds with URLError(-999), which was being surfaced to the user as "The network request failed. Please try again." — even though the cancellation is expected and benign. Guard against Task.isCancelled in the catch block so cancellations are silently ignored; isLoadingMore is still reset unconditionally so the next scroll attempt retries from the same cursor position. Fixes: https://todo.sr.ht/~ccleberg/hutch/61
* fix: show empty state for bare git repos instead of an errorChristian Cleberg2026-04-131-7/+27
| | | | | | | | | | | git.sr.ht returns "internal system error" from the references query and "reference not found" from the log/readme queries when a repo has no commits. Broaden isEmptyRepositoryError to cover missingReference, unknownRevision, noRows, notFound, and those two message strings, then apply the same silent-empty treatment to loadReferences and loadArtifacts (which previously surfaced any error directly to the user). Fixes: https://todo.sr.ht/~ccleberg/hutch/60
* perf: cache filtered collections and add equatable row viewsChristian Cleberg2026-04-132-7/+19
| | | | | | | | | | | | | | | | Convert filteredJobs, filteredPastes, and filteredTickets from computed properties to stored properties updated via didSet on their inputs. Each update function guards with an equality check before assigning, so @Observable skips the notification when the filtered result hasn't changed — preventing list re-renders on auto-refresh when no visible data has actually changed. Add Equatable conformance to BuildRowView, PasteRowView, TicketRowView, and SelectableTicketRow, and apply .equatable() at each ForEach call site. When a list does re-render, SwiftUI now skips body evaluation for rows whose model value is identical to the previous pass. Implements: https://todo.sr.ht/~ccleberg/hutch/57
* release: v3.0.0 — navigation overhaul, Work view, and multi-pin supportv3.0.0Christian Cleberg2026-04-132-15/+58
| | | | | | | | | | | | | | | | | | | | Reworks the app's core navigation and home screen for v3.0.0: - Replace Inbox with Work view: unified dashboard showing unread threads and assigned tickets, with All/Unread/Assigned scope picker - Overhaul Home screen: redesigned with pinned items grid (trackers, repos, mailing lists, users), recent activity section, and system status banner; backed by HomePinStore supporting all resource types - Simplify navigation bars across list screens: default toolbar shows only the primary action (+) and an overflow menu (…); pin, share, and select moved into the overflow menu; selection mode gets its own nav bar with Cancel / "N Selected" / All - Consolidate repo detail toolbars: pin and share moved into the existing actions menu for both Git and Mercurial detail views - Add recent activity tracking via RecentActivityStore - Add work and inbox deep link aliases (hutch://work, hutch://inbox) Implements: https://todo.sr.ht/~ccleberg/hutch/55
* feat: add power user actionsChristian Cleberg2026-04-134-14/+226
| | | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/52 Implements: https://todo.sr.ht/~ccleberg/hutch/53 Implements: https://todo.sr.ht/~ccleberg/hutch/54
* feat: add multi-account supportChristian Cleberg2026-04-121-2/+3
| | | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/49 Implements: https://todo.sr.ht/~ccleberg/hutch/50 Implements: https://todo.sr.ht/~ccleberg/hutch/51
* feat: add search and recent queriesChristian Cleberg2026-04-122-5/+58
| | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/47 Implements: https://todo.sr.ht/~ccleberg/hutch/48
* feat: add ticket label management and bulk actionsChristian Cleberg2026-04-123-42/+623
| | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/45 Implements: https://todo.sr.ht/~ccleberg/hutch/46
* feat: polish read-only project views and home integrationChristian Cleberg2026-04-121-76/+133
| | | | | | Refs: https://todo.sr.ht/~ccleberg/hutch/36 Refs: https://todo.sr.ht/~ccleberg/hutch/37 Refs: https://todo.sr.ht/~ccleberg/hutch/38
* feat: add ticket saved filters and label filteringChristian Cleberg2026-04-123-35/+530
| | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/32 Implements: https://todo.sr.ht/~ccleberg/hutch/33
* feat: improve ticket list actions and metadata visibilityChristian Cleberg2026-04-121-48/+71
| | | | | Implements: https://todo.sr.ht/~ccleberg/hutch/20 Implements: https://todo.sr.ht/~ccleberg/hutch/21
* improve home attention flows and cross-linkingv2.14.0Christian Cleberg2026-04-121-0/+35
|
* chore: add explanatory comments to all intentional empty closuresv2.10.2Christian Cleberg2026-04-033-6/+14
|
* feat: browse user repositories and trackers from profilev2.9.0Christian Cleberg2026-04-021-10/+9
|
* feat: add Look Up screen and restrict management actions to ownersv2.8.0Christian Cleberg2026-04-012-3/+22
| | | | Implements: https://todo.sr.ht/~ccleberg/Hutch/4
* reverse order of swipe actions for user acls in trackersChristian Cleberg2026-04-011-8/+7
|
* Add tracker management (delete/update, ACLs, labels)v2.7.0Christian Cleberg2026-04-016-215/+1690
| | | | | | | | | | | | | - Add swipe actions (delete/edit) to tracker list - Add tracker settings menu on detail screen - Implement updateTracker and deleteTracker mutations - Implement ACL management (updateUserACL, updateTrackerACL, deleteACL) - Implement label management (createLabel, updateLabel, deleteLabel) - Add dedicated UI flows for ACLs and labels - Ensure state refresh after mutations - Handle loading, errors, and destructive confirmations Implements: https://todo.sr.ht/~ccleberg/Hutch/12
* fix: add nested comments to satisfy sonar rule swift:S1186Christian Cleberg2026-03-241-1/+3
|
* delete extraneous test filesChristian Cleberg2026-03-221-141/+0
|
* feat: swipe actions on tickets, pastes, builds, and home dashboardChristian Cleberg2026-03-222-0/+513
|
* feat: add search to builds, trackers, tickets, pastes, mailing lists, and inboxChristian Cleberg2026-03-224-6/+102
|
* feat: add privacy policy link and global swipe actions toggle to SettingsChristian Cleberg2026-03-221-0/+141
|
* v2.1: bundled polish and fixesChristian Cleberg2026-03-195-35/+19
|
* feat: add inbox threads and move builds under moreChristian Cleberg2026-03-192-4/+127
|
* Omit resolution when reopening resolved ticketsChristian Cleberg2026-03-182-9/+16
|
* show tracker creation errors inside the creation sheetChristian Cleberg2026-03-182-2/+44
|
* v1.0Christian Cleberg2026-03-176-0/+2363