Skip to content

Commit cb22c67

Browse files
committed
fix: move own tasks with changes requested back to In Progress
1 parent 8ab2cfd commit cb22c67

3 files changed

Lines changed: 31 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Your PR sits in **In Review** for two days because nobody noticed it. A teammate
3636
- 👤 **Mine**: your tasks grouped by status (In Progress, In Review, Reviewed), each with its linked PRs. *User Stories* that have sub-issues are hidden: you follow them through their sub-issues.
3737
- 🗂️ **Your layout**: click a section header to fold it, and drag headers to put the status you care about first (or right-click → *Move Up* / *Move Down*).
3838
- 👀 **Reviewing**: the tasks you are reviewing for teammates, split into *Your turn* and *Waiting on the author*, with a notification when a re-review is requested.
39-
- 🚚 **Moves the card for you**: approve and the card goes to the next status (e.g. *Reviewed*); request changes and it goes back to *In Progress* and you're unassigned. Toggle it with *Move Cards After My Review*. When all the PRs of one of your own tasks are merged, it goes to *Ready to Verify* from whatever earlier column it is in (*Move My Merged Tasks to Ready to Verify*). The same goes for a *User Story* split into sub-issues: once all its sub-issues are closed or in *Ready to Verify* (or later), the story moves to *Ready to Verify* too.
39+
- 🚚 **Moves the card for you**: approve and the card goes to the next status (e.g. *Reviewed*); request changes and it goes back to *In Progress* and you're unassigned. Your own tasks follow the same rule: when a reviewer requests changes, the card goes back to *In Progress*, even if it was moved to *Reviewed* (that column is only for approved work). Toggle it with *Move Cards After My Review*. When all the PRs of one of your own tasks are merged, it goes to *Ready to Verify* from whatever earlier column it is in (*Move My Merged Tasks to Ready to Verify*). The same goes for a *User Story* split into sub-issues: once all its sub-issues are closed or in *Ready to Verify* (or later), the story moves to *Ready to Verify* too.
4040
- 🔍 **Review state at a glance**: *awaiting review*, *being reviewed*, *changes requested*, *approved*, *merged*, plus the reviewers and CI status (✅ ❌ ⏳).
4141
- 🙋 **Needs reviewer**: teammates' tasks in review with no second assignee, and an **Assign me** button that adds you as the reviewer without opening GitHub (the task then moves to *Reviewing*).
4242
- 🔁 **Re-request review**: when your PR has *changes requested* and you've pushed the fixes, the card shows a **Re-request review** button (also in the right-click menu). It asks those reviewers to look again, moves the card back to the review status and re-assigns them if they were unassigned.

‎Sources/GitHubFloat/Model.swift‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,34 @@ final class Store: ObservableObject {
714714
statusOptions.first { $0.name.caseInsensitiveCompare(name) == .orderedSame }
715715
}
716716

717+
/// Your own task with changes requested goes back to In Progress (Reviewed is only for approved work),
718+
/// even if it sits in the review status or was moved to Reviewed by hand. Handled once per review.
719+
private func applyChangesRequested(_ tasks: [BoardTask]) {
720+
guard settings.autoMove, let board, let target = option(named: "In Progress"), let targetId = target.id else { return }
721+
for t in tasks where [settings.reviewStatus, statusAfterReview].contains(t.status) {
722+
let requests = t.prs.filter { $0.stage == .changesRequested }.flatMap(\.reviewers).filter { $0.state == "CHANGES_REQUESTED" }
723+
guard let latest = requests.max(by: { ($0.submittedAt ?? .distantPast) < ($1.submittedAt ?? .distantPast) }) else { continue }
724+
let key = "changes:\(t.id)@\(latest.submittedAt?.timeIntervalSince1970 ?? 0)"
725+
guard !handledVerdicts.contains(key) else { continue }
726+
handledVerdicts.insert(key)
727+
Task { [weak self] in
728+
guard let self else { return }
729+
do {
730+
try await client.setStatus(projectId: board.projectId, itemId: t.id, fieldId: board.statusFieldId, optionId: targetId)
731+
if settings.notifications {
732+
Notifier.shared.post(.init(title: "Changes requested · \(t.repo.map { "\($0)#\(t.number ?? 0)" } ?? "Draft")",
733+
body: "\(t.title)\nMoved back to \(target.name)",
734+
url: t.prs.first?.url ?? t.url, id: "changes-\(t.id)", kind: .info), sound: false)
735+
}
736+
} catch {
737+
handledVerdicts.remove(key)
738+
self.error = "Could not move \(t.title): \(error.localizedDescription)"
739+
}
740+
await self.refresh()
741+
}
742+
}
743+
}
744+
717745
/// Moves cards you just reviewed: approved -> the status after review, changes requested -> In Progress + unassign you.
718746
/// Only reviews submitted after the card entered the review status count, so older verdicts never move cards back.
719747
private func applyVerdicts(_ tasks: [BoardTask], viewer: String) {
@@ -767,6 +795,7 @@ final class Store: ObservableObject {
767795
let shown = settings.shownStatuses
768796
let assigned = shown.isEmpty ? fetched : fetched.filter { shown.contains($0.status) }
769797
applyVerdicts(assigned.filter { $0.isReviewing(by: snap.viewer) }, viewer: snap.viewer)
798+
applyChangesRequested(assigned.filter { !$0.isReviewing(by: snap.viewer) })
770799
let newMine = assigned.filter { !$0.isReviewing(by: snap.viewer) && (settings.statuses.isEmpty || settings.statuses.contains($0.status)) }
771800
// Reviewing = others' work assigned to you, until you approve / request changes or its PRs are merged or closed.
772801
let newReviewing = assigned

‎Sources/GitHubFloat/main.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSWind
811811

812812
let autoMove = item("Move Cards After My Review", #selector(toggleAutoMove), key: "")
813813
autoMove.state = settings.autoMove ? .on : .off
814-
autoMove.toolTip = "Approve → next status after review. Request changes → In Progress and you're unassigned."
814+
autoMove.toolTip = "Approve → next status after review. Request changes → In Progress and you're unassigned. Your own tasks with changes requested also go back to In Progress."
815815
menu.addItem(autoMove)
816816
let autoMerged = item("Move My Merged Tasks to \(settings.mergedStatus)", #selector(toggleAutoMoveMerged), key: "")
817817
autoMerged.state = settings.autoMoveMerged ? .on : .off

0 commit comments

Comments
 (0)