Skip to content

Commit 1410882

Browse files
committed
fix hide review message bug
1 parent ca100e7 commit 1410882

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/hide_review.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,12 @@ main() {
224224
fi
225225
echo ""
226226
echo "Hiding review $review_id..."
227-
_run_cmd hide_review --id "$review_id" --reason "$reason" || {
227+
_run_cmd_capture hide_review --id "$review_id" --reason "$reason"
228+
if echo "$CAPTURED" | grep -q "error:"; then
228229
echo "ERROR: Command failed. Review was NOT hidden."
230+
_display_captured
229231
continue
230-
}
232+
fi
231233
REVIEW_LINES[$((selection-1))]="${chosen_line/|False|/|True|}"
232234
echo ""
233235
echo "Review $review_id is now hidden."
@@ -248,10 +250,12 @@ main() {
248250
fi
249251
echo ""
250252
echo "Unhiding review $review_id..."
251-
_run_cmd hide_review --id "$review_id" --reason "$reason" --unhide || {
253+
_run_cmd_capture hide_review --id "$review_id" --reason "$reason" --unhide
254+
if echo "$CAPTURED" | grep -q "error:"; then
252255
echo "ERROR: Command failed. Review was NOT changed."
256+
_display_captured
253257
continue
254-
}
258+
fi
255259
REVIEW_LINES[$((selection-1))]="${chosen_line/|True|/|False|}"
256260
echo ""
257261
echo "Review $review_id is now visible."

tcf_website/management/commands/hide_review.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def add_arguments(self, parser):
2525
parser.add_argument("--id", type=int, required=True, help="Review ID")
2626
parser.add_argument(
2727
"--reason",
28-
type=str,
28+
nargs="+",
2929
help="Reason for hiding/unhiding (required unless --show)",
3030
)
3131
parser.add_argument(
@@ -41,7 +41,8 @@ def add_arguments(self, parser):
4141

4242
def handle(self, *args, **options):
4343
review_id = options["id"]
44-
reason = options.get("reason")
44+
reason_parts = options.get("reason")
45+
reason = " ".join(reason_parts) if reason_parts else None
4546
show_only = options["show"]
4647
unhide = options["unhide"]
4748

0 commit comments

Comments
 (0)