Prevent duplicate approve reviews + redesign bottom bar; bump to 2.9
Build iOS App / Build .ipa and publish source (push) Successful in 22s
Build iOS App / Build .ipa and publish source (push) Successful in 22s
- Approve: rapid taps fired multiple submitReview calls that each appended a review, stacking duplicate entries. Add a busy guard (skip while one is in flight) and dedupe reviews per user so the latest replaces earlier ones; disable the review menu while submitting. - Bottom bar: replace the full-width bar with a floating frosted-glass pill inset from the edges (like SideStore), with a highlighted capsule behind the active tab. Bump to 2.9.
This commit is contained in:
1 parent
ed22fbc351
commit
5e9ee9e5cf
3 files changed
+40
-14
No files matched your search
@@ -113,12 +113,20 @@ final class PRDetailViewModel: ObservableObject {
|
||||
|
||||
func submitReview(state: String, comment: String?) async {
|
||||
guard let client = SettingsStore.shared.client() else { return }
|
||||
// Guard against concurrent submissions: rapid taps on Approve used to
|
||||
// fire several requests that each appended a review, stacking
|
||||
// duplicate entries. Skip if one is already in flight.
|
||||
guard busyMessage == nil else { return }
|
||||
busyMessage = "Submitting…"
|
||||
defer { busyMessage = nil }
|
||||
do {
|
||||
let r = try await client.submitReview(owner: owner, repo: repo.name,
|
||||
number: prNumber, state: state,
|
||||
comment: comment)
|
||||
// A user's latest review replaces their earlier ones (Gitea stores
|
||||
// one review per user per PR). Drop any prior review by this user
|
||||
// so we don't render duplicates.
|
||||
reviews.removeAll { $0.user?.login == r.user?.login }
|
||||
reviews.append(r)
|
||||
} catch {
|
||||
errorMessage = error.localizedDescription
|
||||
|
||||
Reference in new issue
Block a user