Page MenuHomePhorge

Display invited room at the top of RoomListView
ClosedPublic

Authored by nannanko on May 20 2024, 5:17 AM.
Tags
None
Referenced Files
F112156: D32.1732272273.diff
Thu, Nov 21, 2:44 AM
F112155: D32.1732272271.diff
Thu, Nov 21, 2:44 AM
F112154: D32.1732272267.diff
Thu, Nov 21, 2:44 AM
F112153: D32.1732272265.diff
Thu, Nov 21, 2:44 AM
F112152: D32.1732272263.diff
Thu, Nov 21, 2:44 AM
F112151: D32.1732272259.diff
Thu, Nov 21, 2:44 AM
F112103: D32.1732271515.diff
Thu, Nov 21, 2:31 AM
Subscribers
None

Details

Summary

This displays invited room at the top of room list, sorted by time.

Type: add

Test Plan
  • Verify unit tests pass.
  • Invite user to a room
  • Open kazv and verify this room at the top of room list
  • Send some message in other room
  • Verify the invited room is still at the top

Diff Detail

Repository
rK kazv
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Please add a changelog type to the summary, using the following format:

Type: (add|remove|skip|security|fix)

nannanko edited the test plan for this revision. (Show Details)
nannanko added a reviewer: tusooa.
src/matrix-room-list.cpp
135–157

Why don't we just sort by membership first and timestamp second?

The comparison function of the sort can be:

auto aIsInvite = a.membership == Invite;
auto bIsInvite = b.membership == Invite;
if (aIsInvite != bIsInvite) {
  return aIsInvite; // if my membership in A is invite, then the membership in B is not invite, so A should come first; otherwise B should come first
}

// otherwise compare by timestamp
tusooa requested changes to this revision.May 20 2024, 10:37 AM

Add a unit test (src/tests/matrix-room-list-test.cpp) to verify that invited rooms are indeed displayed before joined rooms.

This revision now requires changes to proceed.May 20 2024, 10:37 AM
  • Simplify the process by modifying existing sorting condition
nannanko marked an inline comment as done.
  • Add test for display invite room at top

Why does it cause testFilter to fail?

In D32#587, @nannanko wrote:

Why does it cause testFilter to fail?

Maybe the sort is unstable.

tusooa requested changes to this revision.May 25 2024, 4:05 PM
This revision now requires changes to proceed.May 25 2024, 4:05 PM
In D32#534, @tusooa wrote:

Add a unit test (src/tests/matrix-room-list-test.cpp) to verify that invited rooms are indeed displayed before joined rooms.

Done

In D32#589, @tusooa wrote:
In D32#587, @nannanko wrote:

Why does it cause testFilter to fail?

Maybe the sort is unstable.

Fixed

This revision is now accepted and ready to land.May 28 2024, 5:43 AM