Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Show archived rooms and implement forgetting #62

Merged
merged 10 commits into from
Dec 18, 2015
Merged

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Dec 18, 2015

Part of fixing element-hq/element-web#348

Forget button:

  • Shown if the user has a membership of leave (and hides the "Leave Room" button)
  • When clicked hits the forget API which nukes it from the store.
  • You're then taken to another room.
  • May require some new assets for a better icon. I reused the leave icon.

Archived rooms:

  • All rooms with a membership of leave or ban will now be dumped to the "Historical" section which was already in place. Listen for when rooms are deleted so we can update this list when people forget rooms.
  • Make the RoomSubList show a spinner if we are currently loading left rooms. This is done via the showSpinner prop.
  • Make the RoomSubList always display the archived section (because we don't know beforehand if there are archived rooms!). This is done via the alwaysShowHeader prop.
  • Call syncLeftRooms() when the archived header is clicked. This required the prop startAsHidden to be added to force the archived section to be hidden on start (so clicking it once will trigger the request).

Performance:
When the JS SDK encounters a new room it will emit a flurry of events for things
like state and room members. Refreshing the room list on each event is bad for
performance. This is okay initially because the room list is only shown after
the first sync, but when getting archived rooms it locks up for 15-30s as it
thrashes. Add a 1s cap to refreshRoomList() which means that it will refresh
AT MOST once every second. If it has been >1s since the last refresh it will
immediately refresh. If it has been <1s it will wait the difference. This improves
performance and results in 3-5s lock. More optimisations can be done in future.

Manually tested and it all works.

See also:

Call /forget when the forget button is clicked. Number of shortcomings:
 - We need to lazy load the historical list (atm we never get the list of left
   rooms; things only go into that list if you leave the room whilst running)
 - Once a room is forgotten we need to physically nuke it from the JS SDK.
 - Need icon for forget room.
…rooms.

When the JS SDK encounters a new room it will emit a flurry of events for things
like state and room members. Refreshing the room list on each event is bad for
performance. This is okay initially because the room list is only shown after
the first sync, but when getting archived rooms it locks up for 15-30s as it
thrashes. Add a 1s cap to refreshRoomList() which means that it will refresh
*AT MOST* once every second. If it has been >1s since the last refresh it will
immediately refresh. If it has been <1s it will wait the difference.
…tion in room list

This is so users can still find the room they've been expelled from, rather than
have it drop to the Historical section.
MatrixClientPeg.get().forget(this.props.roomId).done(function() {
dis.dispatch({ action: 'view_next_room' });
}, function(err) {
console.error("Failed to forget room: %s", err);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would we swallow this error msg? can we ErrorDialog it please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ara4n
Copy link
Member

ara4n commented Dec 18, 2015

LGTM, other than the fact that we've lost the "bottommost" CSS somehow for the Archived RoomSubList. This is meant to provide a whacking great margin on the bottom of the sublist to avoid the browser adjusting the scrollTop of the RoomList when users toggle sublists on and off (as otherwise if you hide the bottommost ones, it will scroll you upwards to make the bottommost list touch the bottom of the scroll area). It was also serving as a larger droptarget ,although this is less relevant given you can't currently dnd to archived (i assume). Would be nice to get it back - either by putting the margin on the overall roomlist or back on the bottommost roomsublist.

@kegsay
Copy link
Member Author

kegsay commented Dec 18, 2015

PTAL

@ara4n
Copy link
Member

ara4n commented Dec 18, 2015

lgtm, thanks.

kegsay added a commit that referenced this pull request Dec 18, 2015
Show archived rooms and implement forgetting
@kegsay kegsay merged commit e57d060 into develop Dec 18, 2015
dtygel pushed a commit to coletivoEITA/matrix-react-sdk that referenced this pull request May 12, 2017
 	there should be no translateable strings in getDefaultProp
bwindels added a commit that referenced this pull request Oct 9, 2019
Fix: only need 2 "Next" clicks, not 3, when setting a custom HS during registration
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants