Add support for intentional mentions
This is still a bit flaky around when to remove a mention, but it should work in most cases. Might add a toggle in the future to disable these though.
This commit is contained in:
parent
7ec56d8df5
commit
7c2a152cfb
15 changed files with 242 additions and 51 deletions
|
|
@ -241,6 +241,18 @@ struct EventRelations
|
|||
}
|
||||
};
|
||||
|
||||
struct EventMentions
|
||||
{
|
||||
template<class T>
|
||||
std::optional<mtx::common::Mentions> operator()(const mtx::events::Event<T> &e)
|
||||
{
|
||||
if constexpr (requires { T::mentions; }) {
|
||||
return e.content.mentions;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
};
|
||||
|
||||
struct SetEventRelations
|
||||
{
|
||||
mtx::common::Relations new_relations;
|
||||
|
|
@ -447,6 +459,11 @@ mtx::accessors::relations(const mtx::events::collections::TimelineEvents &event)
|
|||
{
|
||||
return std::visit(EventRelations{}, event);
|
||||
}
|
||||
std::optional<mtx::common::Mentions>
|
||||
mtx::accessors::mentions(const mtx::events::collections::TimelineEvents &event)
|
||||
{
|
||||
return std::visit(EventMentions{}, event);
|
||||
}
|
||||
|
||||
void
|
||||
mtx::accessors::set_relations(mtx::events::collections::TimelineEvents &event,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue