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
F25495: D32.1725781143.diff
Sat, Sep 7, 12:39 AM
Unknown Object (File)
Thu, Sep 5, 11:20 AM
Unknown Object (File)
Wed, Sep 4, 12:00 AM
Unknown Object (File)
Tue, Sep 3, 5:00 AM
Unknown Object (File)
Mon, Sep 2, 10:32 PM
Unknown Object (File)
Mon, Sep 2, 3:43 PM
Unknown Object (File)
Mon, Sep 2, 3:43 PM
Unknown Object (File)
Mon, Sep 2, 3:43 PM
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