Fix patching instances

This commit is contained in:
Tulir Asokan 2018-11-02 00:53:43 +02:00
parent f5886ed34b
commit 982623b677
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -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))