hive-forge: subscription --ignore refuses instead of silently watching (#5052)
This commit is contained in:
parent
4e6c3b4a2f
commit
902c1ae574
1 changed files with 16 additions and 5 deletions
|
|
@ -21,7 +21,8 @@ pub struct Args {
|
|||
/// Subscribe (watch the repo).
|
||||
#[arg(long, group = "action")]
|
||||
watch: bool,
|
||||
/// Mute (mark ignored).
|
||||
/// Unsupported: Forgejo's subscription endpoint can't mark a repo
|
||||
/// ignored without also watching it. Always refuses with an error.
|
||||
#[arg(long, group = "action")]
|
||||
ignore: bool,
|
||||
/// Unsubscribe (clear watch + ignore).
|
||||
|
|
@ -72,12 +73,22 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
println!("unsubscribed");
|
||||
return Ok(());
|
||||
}
|
||||
if args.watch || args.ignore {
|
||||
if args.ignore {
|
||||
// Forgejo's PUT subscription endpoint takes no body — it always
|
||||
// subscribes (watch). The old raw client sent a
|
||||
// subscribes (watch), it has no way to mark a repo ignored
|
||||
// without also watching it. The old raw client sent a
|
||||
// `{subscribed, ignored}` body which the server ignored, so
|
||||
// `--ignore` has always behaved like `--watch` server-side; the
|
||||
// typed call just makes that explicit.
|
||||
// `--ignore` silently behaved like `--watch` (the opposite of
|
||||
// what it promises) instead of failing. Refuse instead of lying
|
||||
// about what happened.
|
||||
anyhow::bail!(
|
||||
"subscription --ignore is not supported: Forgejo's subscription \
|
||||
endpoint has no way to mark a repo ignored without also \
|
||||
watching it. Use --unwatch to stop watching, or --watch if \
|
||||
muted-but-watched is what you actually want."
|
||||
);
|
||||
}
|
||||
if args.watch {
|
||||
let resp = client
|
||||
.api()
|
||||
.user_current_put_subscription(owner, name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue