mirror of
https://github.com/matrix-construct/construct
synced 2024-12-01 03:02:59 +01:00
ircd:Ⓜ️🧾 Simplify receipt freshness decisional.
This commit is contained in:
parent
2aea86eb29
commit
caf38d076a
1 changed files with 14 additions and 28 deletions
|
@ -112,40 +112,26 @@ try
|
|||
user_id
|
||||
};
|
||||
|
||||
bool ret{true};
|
||||
user_room.get("ircd.read", room_id, [&ret, &event_id]
|
||||
(const m::event &event)
|
||||
const m::event::idx event_idx
|
||||
{
|
||||
const auto &content
|
||||
{
|
||||
at<"content"_>(event)
|
||||
index(std::nothrow, event_id)
|
||||
};
|
||||
|
||||
const m::event::id &previous_id
|
||||
if(!event_idx)
|
||||
return true;
|
||||
|
||||
const auto last_idx
|
||||
{
|
||||
unquote(content.get("event_id"))
|
||||
user_room.get(std::nothrow, "ircd.read", room_id)
|
||||
};
|
||||
|
||||
if(event_id == previous_id)
|
||||
{
|
||||
ret = false;
|
||||
return;
|
||||
}
|
||||
if(!last_idx)
|
||||
return true;
|
||||
|
||||
const m::event::idx &previous_idx
|
||||
{
|
||||
index(previous_id)
|
||||
};
|
||||
if(last_idx < event_idx)
|
||||
return true;
|
||||
|
||||
const m::event::idx &event_idx
|
||||
{
|
||||
index(event_id)
|
||||
};
|
||||
|
||||
ret = event_idx > previous_idx;
|
||||
});
|
||||
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
catch(const std::exception &e)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue