Skip to content

Commit

Permalink
Remove useless empty tuple check in user mod cmd
Browse files Browse the repository at this point in the history
Actually Click errors out if `--threpid` is passed without arguments _or_ if it
is not exactly two arguments. No need for this empty tuple check. It will never
be true.
  • Loading branch information
JOJ0 committed Nov 13, 2023
1 parent 8134926 commit b5f2f4a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions synadm/cli/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,13 @@ def modify(ctx, helper, user_id, password, password_prompt, display_name,
if key in ["user_id", "password", "password_prompt"]: # skip these
continue
if key == "threepid":
if value != ():
for t_key, t_val in value:
click.echo(f"{key}: {t_key} {t_val}")
if t_key not in ["email", "msisdn"]:
helper.log.warning(
f"{t_key} is probably not a supported medium "
"type. Threepid medium types according to the "
"current matrix spec are: email, msisdn.")
for t_key, t_val in value:
click.echo(f"{key}: {t_key} {t_val}")
if t_key not in ["email", "msisdn"]:
helper.log.warning(
f"{t_key} is probably not a supported medium "
"type. Threepid medium types according to the "
"current matrix spec are: email, msisdn.")
elif key == "user_type" and value == 'regular':
click.echo("user_type: null")
elif value not in [None, {}, []]: # only show non-empty (aka changed)
Expand Down

0 comments on commit b5f2f4a

Please sign in to comment.