Skip to content

Adding a sticker doesn't make them appear in your sticker set #223

@dozro

Description

@dozro

Describe the bug

I clicked on the save to personal sticker pack, the option vanishes, indicating success, however it didn't appear in my sticker set. Even after reload with cleared caches. But the "save sticker" button still isn't visible again, so indicating it saved something, just nothing usable

The sticker event was:

{
    "type": "m.sticker",
    "content": {
        "body": "sticker.jpg",
        "file": {
            "hashes": {
                "sha256": "iKYRNOb4DlJcxEgV7R+xxxxxxxx"
            },
            "iv": "zAs23IX1FCQAAAAAAAAAAA",
            "key": {
                "alg": "A256CTR",
                "ext": true,
                "k": "xxxxxc-xxxxx",
                "key_ops": [
                    "encrypt",
                    "decrypt"
                ],
                "kty": "oct"
            },
            "url": "mxc://local.beeper.com/xxxxxc-xxxxx",
            "v": "v2"
        },
        "filename": "sticker.jpg",
        "info": {
            "h": 512,
            "mimetype": "image/jpeg",
            "size": 25769,
            "w": 512
        },
        "m.mentions": {
            "user_ids": []
        }
    },
    "sender": "@xxx:xxxx",
    "event_id": "$xxxxxx",
    "origin_server_ts": 1773324773368,
    "unsigned": {
        "age": 409477
    },
    "room_id": "!xxxxxx"
}

Reproduction

No response

Expected behavior

The sticker appearing in my sticker set

Platform and versions

- OS: Linux armv81
- Browser: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Mobile Safari/537.36
- Sable: v1.7.0 (f50de89)

Additional context

Is the sticker functionality introduced by myself oops

Might be an encryption issue bc the sticker seems to be encrypted. Unsure if sable currently supports adding a sticker that's encrypted, via this button.

probably somewhere near

export async function addStickerToDefaultPack(
mx: MatrixClient,
shortcode: string,
mxc: string,
body?: string,
info?: IImageInfo
) {
// current content of the default sticker pack, which is stored in account data under the key 'PoniesUserEmotes'
const current =
mx.getAccountData(AccountDataEvent.PoniesUserEmotes)?.getContent<PackContent>() ?? {};
// modified content with the new sticker added.
// We add the new sticker under the "images" key, using the shortcode as the key for the sticker.
// The sticker content includes the mxc URL, body, info, and usage (which we set to "sticker").
const next: PackContent = {
...current,
images: {
...(current.images ?? {}),
[shortcode]: {
...(current.images?.[shortcode] ?? {}),
url: mxc,
body,
info,
usage: [ImageUsage.Sticker],
},
},
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions