Use kstate $url feature for channel icons

This commit is contained in:
Cadence Ember 2024-08-28 01:35:53 +12:00
parent a6c961984d
commit 818311bcb4
4 changed files with 2 additions and 6 deletions

View file

@ -120,8 +120,7 @@ async function channelToKState(channel, guild) {
if (customAvatar) {
avatarEventContent.url = customAvatar
} else if (guild.icon) {
avatarEventContent.discord_path = file.guildIcon(guild)
avatarEventContent.url = await file.uploadDiscordFileToMxc(avatarEventContent.discord_path) // TODO: somehow represent future values in kstate (callbacks?), while still allowing for diffing, so test cases don't need to touch the media API
avatarEventContent.url = {$url: file.guildIcon(guild)}
}
let history_visibility = PRIVACY_ENUMS.ROOM_HISTORY_VISIBILITY[privacyLevel]

View file

@ -65,7 +65,6 @@ async function guildToKState(guild, privacyLevel) {
"m.room.name/": {name: guild.name},
"m.room.avatar/": {
$if: guild.icon,
discord_path: file.guildIcon(guild),
url: {$url: file.guildIcon(guild)}
},
"m.room.guest_access/": {guest_access: createRoom.PRIVACY_ENUMS.GUEST_ACCESS[privacyLevel]},

View file

@ -14,7 +14,6 @@ test("guild2space: can generate kstate for a guild, passing privacy level 0", as
await kstateUploadMxc(kstateStripConditionals(await guildToKState(testData.guild.general, 0))),
{
"m.room.avatar/": {
discord_path: "/icons/112760669178241024/a_f83622e09ead74f0c5c527fe241f8f8c.png?size=1024",
url: "mxc://cadence.moe/zKXGZhmImMHuGQZWJEFKJbsF"
},
"m.room.guest_access/": {

View file

@ -38,8 +38,7 @@ module.exports = {
}]
},
"m.room.avatar/": {
discord_path: "/icons/112760669178241024/a_f83622e09ead74f0c5c527fe241f8f8c.png?size=1024",
url: "mxc://cadence.moe/zKXGZhmImMHuGQZWJEFKJbsF"
url: {$url: "/icons/112760669178241024/a_f83622e09ead74f0c5c527fe241f8f8c.png?size=1024"}
},
"m.room.power_levels/": {
events: {