mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-12 16:09:37 -05:00
added some tests to insertGroupData() to avoid inconsistent calls
This commit is contained in:
parent
ac02b68b34
commit
fa8968797c
@ -1193,7 +1193,7 @@ int RsServer::StartupRetroShare()
|
|||||||
std::cerr << "(EE) Cannot create extensions directory " << extensions_dir
|
std::cerr << "(EE) Cannot create extensions directory " << extensions_dir
|
||||||
<< ". This is not mandatory, but you probably have a permission problem." << std::endl;
|
<< ". This is not mandatory, but you probably have a permission problem." << std::endl;
|
||||||
|
|
||||||
#ifdef DEBUG_PLUGIN_SYSTEM
|
#ifndef DEBUG_PLUGIN_SYSTEM
|
||||||
plugins_directories.push_back(".") ; // this list should be saved/set to some correct value.
|
plugins_directories.push_back(".") ; // this list should be saved/set to some correct value.
|
||||||
// possible entries include: /usr/lib/retroshare, ~/.retroshare/extensions/, etc.
|
// possible entries include: /usr/lib/retroshare, ~/.retroshare/extensions/, etc.
|
||||||
#endif
|
#endif
|
||||||
|
@ -185,7 +185,7 @@ void GxsMessageFramePostWidget::loadGroupData()
|
|||||||
|
|
||||||
RsThread::async([this]()
|
RsThread::async([this]()
|
||||||
{
|
{
|
||||||
RsGxsGenericGroupData *data;
|
RsGxsGenericGroupData *data = nullptr;
|
||||||
getGroupData(data);
|
getGroupData(data);
|
||||||
|
|
||||||
if(!data)
|
if(!data)
|
||||||
|
@ -515,7 +515,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
|
|||||||
|
|
||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
std::set<RsGxsMessageId> older_versions(item->olderVersions());
|
std::set<RsGxsMessageId> older_versions(item->olderVersions()); // we make a copy because the item will be deleted
|
||||||
ui->feedWidget->removeFeedItem(item) ;
|
ui->feedWidget->removeFeedItem(item) ;
|
||||||
|
|
||||||
older_versions.insert(meta.mMsgId);
|
older_versions.insert(meta.mMsgId);
|
||||||
@ -792,9 +792,16 @@ void GxsChannelPostsWidget::toggleAutoDownload()
|
|||||||
|
|
||||||
bool GxsChannelPostsWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
bool GxsChannelPostsWidget::insertGroupData(const RsGxsGenericGroupData *data)
|
||||||
{
|
{
|
||||||
insertChannelDetails(*dynamic_cast<const RsGxsChannelGroup*>(data));
|
const RsGxsChannelGroup *d = dynamic_cast<const RsGxsChannelGroup*>(data);
|
||||||
return true;
|
|
||||||
|
|
||||||
|
if(!d)
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " Cannot dynamic cast input data (" << (void*)data << " to RsGxsGenericGroupData. Something bad happenned." << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
insertChannelDetails(*d);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,std::vector<RsGxsGenericMsgData*>& psts)
|
void GxsChannelPostsWidget::getMsgData(const std::set<RsGxsMessageId>& msgIds,std::vector<RsGxsGenericMsgData*>& psts)
|
||||||
@ -825,6 +832,11 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector<RsGxsGenericMsgData*>& pst
|
|||||||
|
|
||||||
bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
|
||||||
{
|
{
|
||||||
|
if(groupId().isNull())
|
||||||
|
{
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << " Trying to get data about null group!!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
std::vector<RsGxsChannelGroup> groups;
|
std::vector<RsGxsChannelGroup> groups;
|
||||||
|
|
||||||
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({groupId()}),groups) && groups.size()==1)
|
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({groupId()}),groups) && groups.size()==1)
|
||||||
@ -851,7 +863,7 @@ void GxsChannelPostsWidget::insertAllPosts(const std::vector<RsGxsGenericMsgData
|
|||||||
{
|
{
|
||||||
std::vector<RsGxsChannelPost> cposts;
|
std::vector<RsGxsChannelPost> cposts;
|
||||||
|
|
||||||
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some timer, and the cposts list is being modified in the insert method.
|
for(auto post: posts) // This is not so nice but we have somehow to convert to RsGxsChannelPost at some time, and the cposts list is being modified in the insert method.
|
||||||
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
cposts.push_back(*static_cast<RsGxsChannelPost*>(post));
|
||||||
|
|
||||||
insertChannelPosts(cposts, thread, false);
|
insertChannelPosts(cposts, thread, false);
|
||||||
|
@ -817,7 +817,10 @@ void GxsForumThreadWidget::changedThread(QModelIndex index)
|
|||||||
bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
bool setToReadOnActive = Settings->getForumMsgSetToReadOnActivate();
|
||||||
|
|
||||||
if(setToReadOnActive)
|
if(setToReadOnActive)
|
||||||
|
{
|
||||||
|
saveExpandedItems(mSavedExpandedMessages);
|
||||||
mThreadModel->setMsgReadStatus(src_index, true,false);
|
mThreadModel->setMsgReadStatus(src_index, true,false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
||||||
@ -837,6 +840,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
|||||||
|
|
||||||
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
if (index.column() == RsGxsForumModel::COLUMN_THREAD_READ)
|
||||||
{
|
{
|
||||||
|
saveExpandedItems(mSavedExpandedMessages);
|
||||||
ForumModelPostEntry fmpe;
|
ForumModelPostEntry fmpe;
|
||||||
|
|
||||||
QModelIndex src_index = mThreadProxyModel->mapToSource(index);
|
QModelIndex src_index = mThreadProxyModel->mapToSource(index);
|
||||||
@ -845,6 +849,7 @@ void GxsForumThreadWidget::clickedThread(QModelIndex index)
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "Setting message read status to false" << std::endl;
|
std::cerr << "Setting message read status to false" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mThreadModel->setMsgReadStatus(src_index, IS_MSG_UNREAD(fmpe.mMsgStatus),false);
|
mThreadModel->setMsgReadStatus(src_index, IS_MSG_UNREAD(fmpe.mMsgStatus),false);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
@ -1266,6 +1271,7 @@ void GxsForumThreadWidget::markMsgAsReadUnread (bool read, bool children, bool f
|
|||||||
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) {
|
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
saveExpandedItems(mSavedExpandedMessages);
|
||||||
|
|
||||||
if(forum)
|
if(forum)
|
||||||
mThreadModel->setMsgReadStatus(mThreadModel->root(),read,children);
|
mThreadModel->setMsgReadStatus(mThreadModel->root(),read,children);
|
||||||
|
Loading…
Reference in New Issue
Block a user