From 982623b677930708e38d17e676110fb52a661ecb Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 2 Nov 2018 00:53:43 +0200 Subject: [PATCH] Fix patching instances --- maubot/instance.py | 2 ++ maubot/management/api/instance.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/maubot/instance.py b/maubot/instance.py index 6e3590f..11c53bd 100644 --- a/maubot/instance.py +++ b/maubot/instance.py @@ -170,6 +170,8 @@ class PluginInstance: self.plugin.on_external_config_update() async def update_primary_user(self, primary_user: UserID) -> bool: + if not primary_user or primary_user == self.primary_user: + return True client = Client.get(primary_user) if not client: return False diff --git a/maubot/management/api/instance.py b/maubot/management/api/instance.py index 2947247..2901b8c 100644 --- a/maubot/management/api/instance.py +++ b/maubot/management/api/instance.py @@ -65,7 +65,7 @@ async def _create_instance(instance_id: str, data: dict) -> web.Response: async def _update_instance(instance: PluginInstance, data: dict) -> web.Response: - if not await instance.update_primary_user(data.get("primary_user")): + if not await instance.update_primary_user(data.get("primary_user", None)): return ErrPrimaryUserNotFound instance.update_id(data.get("id", None)) instance.update_enabled(data.get("enabled", None))