removed tokens from boards and added missing blocking API calls

This commit is contained in:
csoler 2022-07-06 17:13:34 +02:00
parent cdc650540b
commit 73279db2c5
3 changed files with 26 additions and 39 deletions

View File

@ -28,6 +28,7 @@
#include "ui_PostedCreatePostDialog.h"
#include "util/misc.h"
#include "util/qtthreadsutils.h"
#include "util/RichTextEdit.h"
#include "gui/feeds/SubFileItem.h"
#include "util/rsdir.h"
@ -178,10 +179,20 @@ void PostedCreatePostDialog::createPost()
return;
}
uint32_t token;
mPosted->createPost(token, post);
RsThread::async([this,post]()
{
RsGxsMessageId post_id;
accept();
bool res = rsPosted->createPost(post,post_id);
RsQThreadUtils::postToObject( [res,this]()
{
if(!res)
QMessageBox::information(nullptr,tr("Error while creating post"),tr("An error occurred while creating the post."));
accept();
}, this );
});
}
void PostedCreatePostDialog::fileHashingFinished(QList<HashedFile> hashedFiles)

View File

@ -217,34 +217,6 @@ QWidget *PostedDialog::createCommentHeaderWidget(const RsGxsGroupId &grpId, cons
return new PostedItem(NULL, 0, grpId, msgId, true, false);
}
#ifdef TO_REMOVE
void PostedDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
{
std::vector<RsPostedGroup> groups;
rsPosted->getGroupData(token, groups);
/* Save groups to fill description */
PostedGroupInfoData *postedData = new PostedGroupInfoData;
userdata = postedData;
std::vector<RsPostedGroup>::iterator groupIt;
for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) {
RsPostedGroup &group = *groupIt;
groupInfo.push_back(group.mMeta);
if (group.mGroupImage.mData != NULL) {
QPixmap image;
GxsIdDetails::loadPixmapFromData(group.mGroupImage.mData, group.mGroupImage.mSize, image,GxsIdDetails::ORIGINAL);
postedData->mIcon[group.mMeta.mGroupId] = image;
}
if (!group.mDescription.empty()) {
postedData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str());
}
}
}
#endif
void PostedDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
{
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);

View File

@ -279,16 +279,20 @@ void BasePostedItem::loadComments()
}
void BasePostedItem::readToggled(bool checked)
{
if (mInFill) {
return;
}
if (mInFill) {
return;
}
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
RsThread::async([this,checked]()
{
RsGxsGrpMsgIdPair msgPair = std::make_pair(groupId(), messageId());
rsPosted->setPostReadStatus(msgPair, !checked);
uint32_t token;
rsPosted->setMessageReadStatus(token, msgPair, !checked);
setReadStatus(false, checked);
RsQThreadUtils::postToObject( [checked,this]()
{
setReadStatus(false, checked);
}, this );
});
}
void BasePostedItem::readAndClearItem()