Fix reactions

This commit is contained in:
Nicolas Werner 2020-07-20 00:42:48 +02:00
parent 6f2bc908ba
commit 19f27236ea
12 changed files with 89 additions and 48 deletions

View file

@ -223,6 +223,20 @@ struct EventInReplyTo
}
};
struct EventRelatesTo
{
template<class Content>
using related_ev_id_t = decltype(Content::relates_to.event_id);
template<class T>
std::string operator()(const mtx::events::Event<T> &e)
{
if constexpr (is_detected<related_ev_id_t, T>::value) {
return e.content.relates_to.event_id;
}
return "";
}
};
struct EventTransactionId
{
template<class T>
@ -378,6 +392,11 @@ mtx::accessors::in_reply_to_event(const mtx::events::collections::TimelineEvents
{
return std::visit(EventInReplyTo{}, event);
}
std::string
mtx::accessors::relates_to_event_id(const mtx::events::collections::TimelineEvents &event)
{
return std::visit(EventRelatesTo{}, event);
}
std::string
mtx::accessors::transaction_id(const mtx::events::collections::TimelineEvents &event)