Page MenuHomePhorge

Implement RoomModel::isReadBy
Needs RevisionPublic

Authored by Yucheng on Thu, Mar 26, 7:25 PM.
Tags
None
Referenced Files
F53476854: D297.1774786830.diff
Sat, Mar 28, 5:20 AM
F53466260: D297.1774784872.diff
Sat, Mar 28, 4:47 AM
F53461955: D297.1774784112.diff
Sat, Mar 28, 4:35 AM
F53339656: D297.1774762395.diff
Fri, Mar 27, 10:33 PM
F53309583: D297.1774757314.diff
Fri, Mar 27, 9:08 PM
F53307947: D297.1774757048.diff
Fri, Mar 27, 9:04 PM
F53307251: D297.1774756911.diff
Fri, Mar 27, 9:01 PM
F53306860: D297.1774756837.diff
Fri, Mar 27, 9:00 PM
Subscribers

Details

Reviewers
tusooa
Group Reviewers
O1: the Kazv Project
Summary

The function will return true if an event has been read by a user and false otherwise

Type: add

Test Plan

Verify that the unit test passes

Diff Detail

Repository
rL libkazv
Branch
yucheng
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 586
Build 1154: Invoke BuildbotBuildbot build #1487
Build 1153: arc lint + arc unit

Event Timeline

tusooa requested changes to this revision.Fri, Mar 27, 9:19 AM
tusooa subscribed.
tusooa added inline comments.
src/client/room/room-model.cpp
769

This is generally good, but it is missing one edge case: when two events have the same timestamp, it may not give the correct response.

In kazv, we sort timeline by timestamp first, then by event id. This is reflected by sortKeyForTimelineEvent function in room-model.cpp . Try rewrite this function by comparing sortKeyForTimelineEvent.

src/client/room/room.cpp
948
src/client/room/room.hpp
815

This is a public API, so you should write a docstring for it. Read the other docstrings in this file and see https://kazv.chat/libkazv/api/classKazv_1_1Room.html to know how docstrings are rendered.

src/tests/client/room/read-receipt-test.cpp
412

You already knew how to write a test case, that is great!

One little thing is that you should declare some tags for a test case, just like the tests cases before.

And put the opening brace on the next line, because TEST_CASE is functionally a function definition. In libkazv, we put braces on the next line when it follows a named function, class, enum, or namespace definition.

426–429

As I mentioned before, you missed an edge case in your logic code. So here, you should also add a test for the edge case, where the timestamp of the event is equal to 1436451550453, but the event id is either smaller (assumed to be read) or larger (assumed to be unread).

This revision now requires changes to proceed.Fri, Mar 27, 9:19 AM