mirror of https://gitlab.com/litecord/litecord.git
channels: use Icon.icon_hash
- images: handle generic_get with null icon - images: update group dms on delete icon
This commit is contained in:
parent
ed27bb605a
commit
24cc9e1d25
|
|
@ -422,7 +422,7 @@ async def _update_group_dm(channel_id: int, j: dict):
|
||||||
UPDATE group_dm_channels
|
UPDATE group_dm_channels
|
||||||
SET icon = $1
|
SET icon = $1
|
||||||
WHERE id = $2
|
WHERE id = $2
|
||||||
""", new_icon, channel_id)
|
""", new_icon.icon_hash, channel_id)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/<int:channel_id>', methods=['PUT', 'PATCH'])
|
@bp.route('/<int:channel_id>', methods=['PUT', 'PATCH'])
|
||||||
|
|
|
||||||
|
|
@ -274,6 +274,9 @@ class IconManager:
|
||||||
|
|
||||||
async def generic_get(self, scope, key, icon_hash, **kwargs) -> Icon:
|
async def generic_get(self, scope, key, icon_hash, **kwargs) -> Icon:
|
||||||
"""Get any icon."""
|
"""Get any icon."""
|
||||||
|
if icon_hash is None:
|
||||||
|
return None
|
||||||
|
|
||||||
log.debug('GET {} {} {}', scope, key, icon_hash)
|
log.debug('GET {} {} {}', scope, key, icon_hash)
|
||||||
key = str(key)
|
key = str(key)
|
||||||
|
|
||||||
|
|
@ -406,6 +409,12 @@ class IconManager:
|
||||||
WHERE icon = $1
|
WHERE icon = $1
|
||||||
""", icon.icon_hash)
|
""", icon.icon_hash)
|
||||||
|
|
||||||
|
await self.storage.db.execute("""
|
||||||
|
UPDATE group_dm_channels
|
||||||
|
SET icon = NULL
|
||||||
|
WHERE icon = $1
|
||||||
|
""", icon.icon_hash)
|
||||||
|
|
||||||
await self.storage.db.execute("""
|
await self.storage.db.execute("""
|
||||||
DELETE FROM icons
|
DELETE FROM icons
|
||||||
WHERE hash = $1
|
WHERE hash = $1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue