mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
merge comments between channel item versions
This commit is contained in:
parent
6b09fa0f67
commit
51710c10a0
@ -60,6 +60,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RsMsgMetaData mMeta;
|
RsMsgMetaData mMeta;
|
||||||
|
|
||||||
|
std::set<RsGxsMessageId> mOlderVersions ;
|
||||||
std::string mMsg; // UTF8 encoded.
|
std::string mMsg; // UTF8 encoded.
|
||||||
|
|
||||||
std::list<RsGxsFile> mFiles;
|
std::list<RsGxsFile> mFiles;
|
||||||
|
@ -64,6 +64,21 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QVector<RsGxsMessageId> v;
|
||||||
|
bool self = false;
|
||||||
|
|
||||||
|
for(std::set<RsGxsMessageId>::const_iterator it(post.mOlderVersions.begin());it!=post.mOlderVersions.end();++it)
|
||||||
|
{
|
||||||
|
if(*it == post.mMeta.mMsgId)
|
||||||
|
self = true ;
|
||||||
|
|
||||||
|
v.push_back(*it) ;
|
||||||
|
}
|
||||||
|
if(!self)
|
||||||
|
v.push_back(post.mMeta.mMsgId);
|
||||||
|
|
||||||
|
setMessageVersions(v) ;
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
//setGroup(group, false);
|
//setGroup(group, false);
|
||||||
|
@ -64,7 +64,10 @@ void GxsFeedItem::comments(const QString &title)
|
|||||||
|
|
||||||
if (mFeedHolder)
|
if (mFeedHolder)
|
||||||
{
|
{
|
||||||
mFeedHolder->openComments(feedId(), groupId(), messageId(), title);
|
if(mMessageVersions.empty())
|
||||||
|
mFeedHolder->openComments(feedId(), groupId(),QVector<RsGxsMessageId>(1,messageId()), messageId(), title);
|
||||||
|
else
|
||||||
|
mFeedHolder->openComments(feedId(), groupId(),mMessageVersions, messageId(), title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,12 @@ public:
|
|||||||
GxsFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate);
|
GxsFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate);
|
||||||
virtual ~GxsFeedItem();
|
virtual ~GxsFeedItem();
|
||||||
|
|
||||||
RsGxsMessageId messageId() { return mMessageId; }
|
RsGxsMessageId messageId() const { return mMessageId; }
|
||||||
|
const QVector<RsGxsMessageId>& messageVersions() const { return mMessageVersions ; }
|
||||||
|
|
||||||
//To be able to update with thread message when comment is received.
|
//To be able to update with thread message when comment is received.
|
||||||
void setMessageId( RsGxsMessageId id) {mMessageId = id;}
|
void setMessageId( RsGxsMessageId id) {mMessageId = id;}
|
||||||
|
void setMessageVersions( const QVector<RsGxsMessageId>& v) { mMessageVersions = v;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* load message data */
|
/* load message data */
|
||||||
@ -61,6 +64,7 @@ protected slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
RsGxsMessageId mMessageId;
|
RsGxsMessageId mMessageId;
|
||||||
|
QVector<RsGxsMessageId> mMessageVersions ;
|
||||||
uint32_t mTokenTypeMessage;
|
uint32_t mTokenTypeMessage;
|
||||||
uint32_t mTokenTypeComment;
|
uint32_t mTokenTypeComment;
|
||||||
};
|
};
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate);
|
GxsGroupFeedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, RsGxsIfaceHelper *iface, bool autoUpdate);
|
||||||
virtual ~GxsGroupFeedItem();
|
virtual ~GxsGroupFeedItem();
|
||||||
|
|
||||||
RsGxsGroupId groupId() { return mGroupId; }
|
RsGxsGroupId groupId() const { return mGroupId; }
|
||||||
uint32_t feedId() { return mFeedId; }
|
uint32_t feedId() const { return mFeedId; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint32_t nextTokenType() { return ++mNextTokenType; }
|
uint32_t nextTokenType() { return ++mNextTokenType; }
|
||||||
|
@ -543,6 +543,10 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector<RsGxsChannelPost> &po
|
|||||||
#ifdef DEBUG_CHANNEL
|
#ifdef DEBUG_CHANNEL
|
||||||
std::cerr << " and is more recent => following" << std::endl;
|
std::cerr << " and is more recent => following" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
for(std::set<RsGxsMessageId>::const_iterator itt(posts[current_index].mOlderVersions.begin());itt!=posts[current_index].mOlderVersions.end();++itt)
|
||||||
|
posts[source_index].mOlderVersions.insert(*itt);
|
||||||
|
|
||||||
|
posts[source_index].mOlderVersions.insert(posts[current_index].mMeta.mMsgId);
|
||||||
posts[current_index].mMeta.mMsgId.clear(); // clear the msg Id so the post will be ignored
|
posts[current_index].mMeta.mMsgId.clear(); // clear the msg Id so the post will be ignored
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_CHANNEL
|
#ifdef DEBUG_CHANNEL
|
||||||
|
Loading…
Reference in New Issue
Block a user