Fix patching instances
This commit is contained in:
parent
f5886ed34b
commit
982623b677
2 changed files with 3 additions and 1 deletions
|
@ -170,6 +170,8 @@ class PluginInstance:
|
||||||
self.plugin.on_external_config_update()
|
self.plugin.on_external_config_update()
|
||||||
|
|
||||||
async def update_primary_user(self, primary_user: UserID) -> bool:
|
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)
|
client = Client.get(primary_user)
|
||||||
if not client:
|
if not client:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -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:
|
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
|
return ErrPrimaryUserNotFound
|
||||||
instance.update_id(data.get("id", None))
|
instance.update_id(data.get("id", None))
|
||||||
instance.update_enabled(data.get("enabled", None))
|
instance.update_enabled(data.get("enabled", None))
|
||||||
|
|
Loading…
Reference in a new issue