zcommand: Add /fluid-width and /fixed-width slash commands.

This commit is contained in:
Wyatt Hoodes
2020-03-11 20:51:47 -10:00
committed by Tim Abbott
parent 5cf8ddf630
commit 13f86f35d9
4 changed files with 106 additions and 0 deletions

View File

@@ -38,4 +38,18 @@ def process_zcommands(content: str, user_profile: UserProfile) -> Dict[str, Any]
switch_command='night',
setting='night_mode',
setting_value=False))
elif command == 'fluid-width':
if user_profile.fluid_layout_width:
return dict(msg='You are still in fluid width mode.')
return dict(msg=change_mode_setting(command=command,
switch_command='fixed-width',
setting='fluid_layout_width',
setting_value=True))
elif command == 'fixed-width':
if not user_profile.fluid_layout_width:
return dict(msg='You are still in fixed width mode.')
return dict(msg=change_mode_setting(command=command,
switch_command='fluid-width',
setting='fluid_layout_width',
setting_value=False))
raise JsonableError(_('No such command: %s') % (command,))