Skip to content
Snippets Groups Projects
Verified Commit 637db55e authored by Nicolas Werner's avatar Nicolas Werner
Browse files

Default body to shortcode if unset and sending sticker

parent 922c63ef
Branches pushrules
No related tags found
No related merge requests found
...@@ -33,6 +33,12 @@ public: ...@@ -33,6 +33,12 @@ public:
return {}; return {};
return images.at(static_cast<size_t>(row)).image; return images.at(static_cast<size_t>(row)).image;
} }
QString shortcodeAt(int row)
{
if (row < 0 || static_cast<size_t>(row) >= images.size())
return {};
return images.at(static_cast<size_t>(row)).shortcode;
}
private: private:
std::string room_id; std::string room_id;
......
...@@ -636,7 +636,7 @@ InputBar::sticker(CombinedImagePackModel *model, int row) ...@@ -636,7 +636,7 @@ InputBar::sticker(CombinedImagePackModel *model, int row)
mtx::events::msg::StickerImage sticker{}; mtx::events::msg::StickerImage sticker{};
sticker.info = img.info.value_or(mtx::common::ImageInfo{}); sticker.info = img.info.value_or(mtx::common::ImageInfo{});
sticker.url = img.url; sticker.url = img.url;
sticker.body = img.body; sticker.body = img.body.empty() ? model->shortcodeAt(row).toStdString() : img.body;
// workaround for https://github.com/vector-im/element-ios/issues/2353 // workaround for https://github.com/vector-im/element-ios/issues/2353
sticker.info.thumbnail_url = sticker.url; sticker.info.thumbnail_url = sticker.url;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment