modules/client/sync: Fix conditions to duplicate state in timeline; improve inconsistencies.
This commit is contained in:
parent
a5d3cfbfa6
commit
eefd59d845
|
@ -125,23 +125,28 @@ ircd::m::sync::room_state_linear_events(data &data)
|
||||||
room::events::viewport_size
|
room::events::viewport_size
|
||||||
};
|
};
|
||||||
|
|
||||||
// Figure out whether the event was included in the timeline or whether
|
const auto sounding
|
||||||
// to include it here in the state, which comes before the timeline.
|
|
||||||
// Since linear-sync is already distinct from polylog-sync, the
|
|
||||||
// overwhelming majority of state events coming through linear-sync will
|
|
||||||
// use the timeline. We make an exception for past state events the server
|
|
||||||
// only recently obtained, to hide them from the timeline.
|
|
||||||
if(viewport_size >= 0 && data.membership != "invite" && !is_own_join)
|
|
||||||
{
|
{
|
||||||
if(json::get<"depth"_>(*data.event) + viewport_size >= data.room_depth)
|
data.room_depth - json::get<"depth"_>(*data.event)
|
||||||
return false;
|
};
|
||||||
|
|
||||||
// We also query whether this state cell has been overwritten.
|
// Figure out whether the event was included in the timeline
|
||||||
// Unlike the timeline, the state field will not be processed
|
const bool viewport_visible
|
||||||
// sequentially by our client so we can skip outdated events.
|
{
|
||||||
if(m::room::state::next(data.event_idx))
|
viewport_size <= 0
|
||||||
return false;
|
|| data.membership == "invite"
|
||||||
}
|
|| sounding < viewport_size
|
||||||
|
};
|
||||||
|
|
||||||
|
// Query whether this state cell has been overwritten. Unlike the timeline,
|
||||||
|
// the state field will not be processed sequentially by our client.
|
||||||
|
const bool stale
|
||||||
|
{
|
||||||
|
m::room::state::next(data.event_idx) != 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!viewport_visible && stale)
|
||||||
|
return false;
|
||||||
|
|
||||||
json::stack::object rooms
|
json::stack::object rooms
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,11 +103,10 @@ ircd::m::sync::room_timeline_linear(data &data)
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(sounding >= 0);
|
assert(sounding >= 0);
|
||||||
const bool is_stale
|
const bool viewport_visible
|
||||||
{
|
{
|
||||||
sounding
|
viewport_size <= 0
|
||||||
&& viewport_size >= 0
|
|| sounding < viewport_size
|
||||||
&& sounding > viewport_size
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool is_own_membership
|
const bool is_own_membership
|
||||||
|
@ -154,7 +153,7 @@ ircd::m::sync::room_timeline_linear(data &data)
|
||||||
const bool skip
|
const bool skip
|
||||||
{
|
{
|
||||||
false
|
false
|
||||||
|| is_stale
|
|| !viewport_visible
|
||||||
|| (is_own_join && data.reflow_full_state)
|
|| (is_own_join && data.reflow_full_state)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue