mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-26 07:55:44 -04:00
implemented update of posts for new model. Unfinished yet.
This commit is contained in:
parent
2066248b3b
commit
d3565c2ee4
4 changed files with 545 additions and 277 deletions
|
@ -554,75 +554,4 @@ void GxsForumsFillThread::run()
|
|||
deleteLater();
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GxsForumsFillThread::convertMsgToThreadWidget(const RsGxsForumMsg& msg, bool useChildTS, uint32_t filterColumn, ForumModelIndex parent)
|
||||
{
|
||||
ForumModelPostEntry fentry;
|
||||
|
||||
fentry.mMsgId = msg.mMeta.mMsgId;
|
||||
fentry.mPublishTs = msg.mMeta.mPublishTs;
|
||||
fentry.mParent = parent;
|
||||
|
||||
if(mForumGroup.mPinnedPosts.ids.find(msg.mMeta.mMsgId) != mForumGroup.mPinnedPosts.ids.end())
|
||||
fentry.mFlags |= ForumModelPostEntry::FLAG_POST_IS_PINNED;
|
||||
|
||||
// Early check for a message that should be hidden because its author
|
||||
// is flagged with a bad reputation
|
||||
|
||||
uint32_t idflags =0;
|
||||
RsReputations::ReputationLevel reputation_level = rsReputations->overallReputationLevel(msg.mMeta.mAuthorId,&idflags) ;
|
||||
bool redacted = false;
|
||||
|
||||
if(reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
fentry.mPostFlags |= ForumModelPostEntry::FLAG_POST_IS_REDACTED;
|
||||
|
||||
// We use a specific item model for forums in order to handle the post pinning.
|
||||
|
||||
if(reputation_level == RsReputations::REPUTATION_UNKNOWN)
|
||||
fentry.mReputationWarningLevel = 3 ;
|
||||
else if(reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE)
|
||||
fentry.mReputationWarningLevel = 2 ;
|
||||
else if(reputation_level < rsGxsForums->minReputationForForwardingMessages(mForumGroup.mMeta.mSignFlags,idflags))
|
||||
fentry.mReputationWarningLevel = 1 ;
|
||||
else
|
||||
fentry.mReputationWarningLevel = 0 ;
|
||||
|
||||
#ifdef TODO
|
||||
// This is an attempt to put pinned posts on the top. We should rather use a QSortFilterProxyModel here.
|
||||
QString itemSort = QString::number(msg.mMeta.mPublishTs);//Don't need to format it as for sort.
|
||||
|
||||
if (useChildTS)
|
||||
{
|
||||
for(QTreeWidgetItem *grandParent = parent; grandParent!=NULL; grandParent = grandParent->parent())
|
||||
{
|
||||
//Update Parent Child TimeStamp
|
||||
QString oldTSSort = grandParent->data(COLUMN_THREAD_DATE, ROLE_THREAD_SORT).toString();
|
||||
|
||||
QString oldCTSSort = oldTSSort.split("|").at(0);
|
||||
QString oldPTSSort = oldTSSort.contains("|") ? oldTSSort.split(" | ").at(1) : oldCTSSort;
|
||||
#ifdef SHOW_COMBINED_DATES
|
||||
QString oldTSText = grandParent->text(COLUMN_THREAD_DATE);
|
||||
QString oldCTSText = oldTSText.split("|").at(0);
|
||||
QString oldPTSText = oldTSText.contains("|") ? oldTSText.split(" | ").at(1) : oldCTSText;//If first time parent get only its mPublishTs
|
||||
#endif
|
||||
if (oldCTSSort.toDouble() < itemSort.toDouble())
|
||||
{
|
||||
#ifdef SHOW_COMBINED_DATES
|
||||
grandParent->setText(COLUMN_THREAD_DATE, DateTime::formatDateTime(qtime) + " | " + oldPTSText);
|
||||
#endif
|
||||
grandParent->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, itemSort + " | " + oldPTSSort);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
//#TODO
|
||||
#if 0
|
||||
if (IS_GROUP_SUBSCRIBED(subscribeFlags) && !(msginfo.mMsgFlags & RS_DISTRIB_MISSING_MSG)) {
|
||||
rsGxsForums->getMessageStatus(msginfo.forumId, msginfo.msgId, status);
|
||||
} else {
|
||||
// show message as read
|
||||
status = RSGXS_MSG_STATUS_READ;
|
||||
}
|
||||
#endif
|
||||
if (parent) parent->addChild(item);
|
||||
return item;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue