fixed channel UI so that comment label is only shown when a new comment is here

This commit is contained in:
csoler 2021-01-12 22:31:59 +01:00
parent 7b2f6a3439
commit af696639cc
9 changed files with 65 additions and 6 deletions

View file

@ -71,14 +71,15 @@ struct RsGxsChannelGroup : RsSerializable, RsGxsGenericGroupData
struct RsGxsChannelPost : RsSerializable, RsGxsGenericMsgData
{
RsGxsChannelPost() : mAttachmentCount(0), mCommentCount(0), mSize(0) {}
RsGxsChannelPost() : mAttachmentCount(0), mCommentCount(0), mUnreadCommentCount(0), mSize(0) {}
std::set<RsGxsMessageId> mOlderVersions;
std::string mMsg; // UTF8 encoded.
std::list<RsGxsFile> mFiles;
uint32_t mAttachmentCount; // auto calced.
uint32_t mCommentCount; // auto calced. WARNING: not computed yet. In the future we need a background process to update this and store in the service string.
uint32_t mCommentCount; // auto calced.
uint32_t mUnreadCommentCount; // auto calced.
uint64_t mSize; // auto calced.
RsGxsImage mThumbnail;
@ -95,6 +96,7 @@ struct RsGxsChannelPost : RsSerializable, RsGxsGenericMsgData
RS_SERIAL_PROCESS(mFiles);
RS_SERIAL_PROCESS(mAttachmentCount);
RS_SERIAL_PROCESS(mCommentCount);
RS_SERIAL_PROCESS(mUnreadCommentCount);
RS_SERIAL_PROCESS(mSize);
RS_SERIAL_PROCESS(mThumbnail);
}

View file

@ -176,6 +176,8 @@ struct RsGxsCommentService
virtual bool acknowledgeVote(
uint32_t token,
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) = 0;
};
/// @deprecated use RsGxsVoteType::NONE instead @see RsGxsVoteType

View file

@ -202,7 +202,9 @@ public:
virtual bool getPostData(
const uint32_t& token, std::vector<RsPostedPost>& posts) = 0;
//Not currently used
virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) =0;
//Not currently used
//virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
/* From RsGxsCommentService */

View file

@ -151,6 +151,12 @@ virtual bool getChannelDownloadDirectory(const RsGxsGroupId &groupId, std::strin
return mCommentService->createGxsComment(token, msg);
}
virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) override
{
setMessageReadStatus(token,RsGxsGrpMsgIdPair(gid,comment_msg_id),true);
return true;
}
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override
{
return mCommentService->createGxsVote(token, msg);

View file

@ -110,6 +110,13 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
return p3PostBase::setMessageReadStatus(token, msgId, read);
}
virtual bool setCommentAsRead(uint32_t& token,const RsGxsGroupId& gid,const RsGxsMessageId& comment_msg_id) override
{
p3PostBase::setMessageReadStatus(token,RsGxsGrpMsgIdPair(gid,comment_msg_id),true);
return true;
}
/** Comment service - Provide RsGxsCommentService -
* redirect to p3GxsCommentService */