fix: drop auto-picked-branch warning on resort when user pick honored
The amber "auto-picked" warning persisted even after the user explicitly picked a branch via the picker — the resort flow only updated the message text from "auto-picked X" to "selected X" but kept the warning visible. That reads as "you should review this" when in fact the user already did. Now: when /api/resort honors a user's explicit branch selection, the matching auto-picked-branch warning is dropped from WARNINGS. The BranchPicker in the ModTable expansion (sortof-app.jsx ~818) keeps the picker accessible if the user wants to switch branches later. Initial /api/sort still emits the warning (the user hasn't picked yet); suppression only kicks in once selected_modids honors a group's pick.
This commit is contained in:
@@ -524,23 +524,21 @@ def _apply_branch_rules(
|
|||||||
|
|
||||||
# Resort-mode override: the user has explicitly picked branches via
|
# Resort-mode override: the user has explicitly picked branches via
|
||||||
# the picker. Replace the rules' kept_set with the user's selection
|
# the picker. Replace the rules' kept_set with the user's selection
|
||||||
# restricted to this group, and update the matching auto-picked-
|
# restricted to this group, and DROP the matching auto-picked-branch
|
||||||
# branch warning's `picked` field so the picker UI shows their
|
# warning — the user has already chosen, and the BranchPicker in the
|
||||||
# current choice ticked. Without this, narrowing a multi-branch
|
# ModTable expansion (frontend sortof-app.jsx ~818) keeps the picker
|
||||||
# wsid to one branch erases the picker section because the warning
|
# accessible if they want to revisit. Leaving the amber warning in
|
||||||
# was tied to the rule's auto-pick, not the user's pick.
|
# place after an explicit pick reads as "you should review this"
|
||||||
|
# which is exactly wrong — they already did.
|
||||||
if is_resort and selected_modids is not None:
|
if is_resort and selected_modids is not None:
|
||||||
user_picks = [m.id for m in group if m.id in selected_modids]
|
user_picks = [m.id for m in group if m.id in selected_modids]
|
||||||
if user_picks:
|
if user_picks:
|
||||||
kept_set = set(user_picks)
|
kept_set = set(user_picks)
|
||||||
for w in warnings:
|
warnings = [
|
||||||
if (w.get("tag") == "auto-picked-branch"
|
w for w in warnings
|
||||||
and w.get("wsid") == wsid):
|
if not (w.get("tag") == "auto-picked-branch"
|
||||||
w["picked"] = user_picks[0]
|
and w.get("wsid") == wsid)
|
||||||
w["msg"] = (
|
]
|
||||||
f"{title} ({wsid}) ships {len(group)} branches; "
|
|
||||||
f"selected {user_picks[0]}. Pick another:"
|
|
||||||
)
|
|
||||||
|
|
||||||
for m in group:
|
for m in group:
|
||||||
if m.id not in kept_set:
|
if m.id not in kept_set:
|
||||||
|
|||||||
Reference in New Issue
Block a user