-
-
Notifications
You must be signed in to change notification settings - Fork 833
Conversation
- Doesn't work with MELS - Doesn't work with read markers - Doesn't work with jumping to events Shelving this for now as I fix some of this mess.
…rix-org/matrix-react-sdk into kegan/hide-join-part Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> # Conflicts: # src/components/structures/UserSettings.js
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
… kegan/hide-join-part
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Can one of the admins verify this patch? |
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
c34da8a
to
f036fd1
Compare
… t3chguy/hide-join-part-2
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
this is needed so that if a client which does not hide any events sets and RM at bottom of timeline, then riot-web which hides events sets the RM it'd set it at X-N where X is bottom and N is the amount of hidden events at bottom of the timeline, this way now an RM will fall through to the hidden events below a seen event. Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
688e48d
to
8e66e64
Compare
Does not fix the broken |
// of MemberEventListSummary, render each member event as if the previous | ||
// one was itself. This way, the timestamp of the previous event === the | ||
// timestamp of the current event, and no DateSeperator is inserted. | ||
const ret = this._getTilesForEvent(e, e, last); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK if last
is not computed for e
but instead for the first event in the MELS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that change was Kegan's - fc93517#diff-dbc0a683dd11c32adf8c9532eb9ebb27R386
I'll figure out why its needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would guess that it's needed for when you've expanded the MELS at the front of the timeline, (i.e. the most recent events are member events) and the last event should be indicated with last=true
but last
is calculated with i
where i
is the index of the first event in the MELS. I think last
should be recalculated for each event in the summary (so within the inner for
that iterates i
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't do it within that for-loop because it doesn't use the last value, the map afterwards does, so it'd set the last value to the same for all events in MELS as the last event in the MELS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best way I can see is changing it from lastShownEventIndex to lastShownEvent and then just checking it against the event itself, other way is to recalculate last inside that interior for loop and then if last && index === summarisedEvents.length - 1
(where index is the index passed to the mapper function)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(memory pointer check)
@@ -1023,7 +1020,14 @@ var TimelinePanel = React.createClass({ | |||
var boundingRect = node.getBoundingClientRect(); | |||
if ((allowPartial && boundingRect.top < wrapperRect.bottom) || | |||
(!allowPartial && boundingRect.bottom < wrapperRect.bottom)) { | |||
return i; | |||
let latestReadEventIndex = i; | |||
// Place the RM at a hidden event below the latest seen event (if exists) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if it exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this is confusing, the event is just the latest read visible event... event (if exists)
should be probably be visible event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/shouldHideEvent.js
Outdated
} | ||
|
||
// this only applies to joins/leaves not invites/kicks/bans | ||
return membership === 'join' || (membership === 'leave' && ev.getStateKey() === ev.getSender()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about unbans and invites? An unban = ban
to join
, invite acception = invite
to join
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/me votes for a helper in js-sdk to figure out what a member event does...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different apps may feel differently about how to group certain events and hiding joins/parts is a good example of how an app treats fairly arbitrary events specially.
Anyway, either the logic or the comment above needs to change; if the intention is to return true
for accepting invites (type of join) and being unbanned (type of join), then this should be mentioned in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by helper I meant a thing that took an event and spat out an enum val describing its effect 'ban'/'kick'/'unban'/'leave'/'join' etc
src/shouldHideEvent.js
Outdated
return membership === 'join' || (membership === 'leave' && ev.getStateKey() === ev.getSender()); | ||
} | ||
|
||
export default function(ev, syncedSettings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just import UserSettingsStore
here instead of importing it in the files that use shouldHideEvent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1104 (comment)
plus getSyncedSettings has to json parse so doing it once per event is nasty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
do not have the same i reference (namely MELS generation) this way a member event at bottom of MELS (if is the last event in the timeline will have last set appropriately)
I believe that is everything in Luke's review done |
src/shouldHideEvent.js
Outdated
// this only applies to joins/leaves not invites/kicks/bans | ||
return membership === 'join' || (membership === 'leave' && ev.getStateKey() === ev.getSender()); | ||
const isJoin = membership === 'join' && prevMembership !== 'ban'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be true
if prevMembership
is invite
, so if the intention is to return true
for invitation acceptations, then the comment above needs to be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated comment @lukebarnard1
@@ -1021,7 +1021,7 @@ var TimelinePanel = React.createClass({ | |||
if ((allowPartial && boundingRect.top < wrapperRect.bottom) || | |||
(!allowPartial && boundingRect.bottom < wrapperRect.bottom)) { | |||
let latestReadEventIndex = i; | |||
// Place the RM at a hidden event below the latest seen event (if exists) | |||
// Place the RM at a hidden event below the latest visible event. | |||
// to prevent RM going up the timeline between clients which do not hide the same events. | |||
for (let j = i + 1; j < this.state.events.length; j++) { | |||
if (messagePanel._shouldShowEvent(this.state.events[j])) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never check if i
itself is visible, if it is surely we can return i
immediately? In other words, let j = i;
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we know i
is visible because its in the DOM
we want the last non-visible event to put the rm on
(last non-visible but still before the next visible, so it trickles down the timeline)
@@ -1021,7 +1021,7 @@ var TimelinePanel = React.createClass({ | |||
if ((allowPartial && boundingRect.top < wrapperRect.bottom) || | |||
(!allowPartial && boundingRect.bottom < wrapperRect.bottom)) { | |||
let latestReadEventIndex = i; | |||
// Place the RM at a hidden event below the latest seen event (if exists) | |||
// Place the RM at a hidden event below the latest visible event. | |||
// to prevent RM going up the timeline between clients which do not hide the same events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording still seems confusing. How about something like "if the RM is on an event that is not visible, find the first event that is visible and place the RM on the event before it."
Ignore for now, using to easier follow Jenkins because tests never seem to fail on my Windows machines...Replaces #1104 - Maybe... Diff seems near-identical