Skip to content

Commit ee5b34c

Browse files
authored
Merge pull request #236 from dozro/fix/sticker-add-encrypted-sticker
Improve sticker handling and update documentation on limitations
2 parents 466442c + dddff22 commit ee5b34c

4 files changed

Lines changed: 12 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sable: patch
3+
---
4+
5+
disabling quick add for encrypted sticker, this mitigates the issue of being unable to use quick to add encrypted sticker

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ devAssets
1818
*.tfbackend
1919
!*.tfbackend.example
2020
crash.log
21+
22+
# the following line was added with the "git ignore" tool by itsrye.dev, version 0.1.0
23+
.lh

src/app/features/room/message/Message.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,9 @@ function MessageInternal(
825825
</Text>
826826
</MenuItem>
827827
)}
828+
{/* Only show "Add to User Sticker Pack" if the sticker isn't already in the default pack and isn't encrypted */}
828829
{isStickerMessage &&
830+
mEvent.getContent().url &&
829831
!doesStickerExistInDefaultPack(mx, mEvent.getContent().url) && (
830832
<MenuItem
831833
size="300"
@@ -835,7 +837,7 @@ function MessageInternal(
835837
addStickerToDefaultPack(
836838
mx,
837839
`sticker-${mEvent.getId()}`,
838-
mEvent.getContent().url,
840+
mEvent.getContent().url ?? mEvent.getContent().file?.url ?? '',
839841
mEvent.getContent().body,
840842
mEvent.getContent().info
841843
);

src/app/utils/addStickerToDefaultStickerPack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IImageInfo } from '$types/matrix/common';
44
import { MatrixClient } from 'matrix-js-sdk';
55

66
// Utility function to add a sticker to the default sticker pack
7+
// For now this only works for unencrypted stickers
78
export async function addStickerToDefaultPack(
89
mx: MatrixClient,
910
shortcode: string,

0 commit comments

Comments
 (0)