Page MenuHomePhorge

Add draftRel for room
Changes PlannedPublic

Authored by nannanko on Wed, Mar 25, 9:25 AM.

Details

Reviewers
tusooa
Group Reviewers
O1: the Kazv Project
Summary

Sometimes certain events occupy the chat box, this diff makes the room remember this status as well as the old draft so that it can be restored when the time is right.

This will cause kazv don't works with old sessions.

Type: add

Test Plan

Verify unit tests passed.

Diff Detail

Repository
rL libkazv
Branch
nannanko/restore-draft
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 595
Build 1172: Invoke BuildbotBuildbot build #1535
Build 1171: arc lint + arc unit

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Wed, Mar 25, 9:37 AM
Harbormaster failed remote builds in B582: Diff 898!
nannanko edited the summary of this revision. (Show Details)

buildbot is broken

tusooa requested changes to this revision.Fri, Mar 27, 9:41 AM
tusooa added inline comments.
src/client/room/room-model.hpp
271–272

I think it will be good to put this into its own type:

struct LocalDraft
{
    std::string text;
    std::string relType;
    std::string relatedEventId;
};

Then, instead of using a simple string of oldDraft, we can store all draft versions in a immer::flex_vector<LocalDraft>.

When the user clicks Reply or Edit, push a LocalDraft into the vector. When the user clicks Close and confirms, pop the last object from the vector. The current draft can be obtained by the last element from the vector (or a default-initialized LocalDraft when the vector is empty).

SaveLocalDraftAction will be changed to only modify the current draft.

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

Use Kazv::LocalDraft instead of three std::string.

nannanko marked an inline comment as done.

Add more action to edit localDraft

src/client/room/local-draft.hpp
32–33

you also don't need namespace boost::serialization because you can just modify the Kazv namespace

35–59

split_free is not needed because save and load functions are exactly same

62

you can start this with 0

src/client/room/room-model.hpp
456–509

This will cause problems with loading from an archive of earlier versions. The std::string (of the old localDraft) must still be read out from the archive if it is a version less than 10.