From 59887124ac7a60425c9ee723f7e1281926bbad5b Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 6 Sep 2018 10:17:50 +0200 Subject: [PATCH] fixed transmission of pinned posts when a forum is edited --- .../src/gui/gxsforums/GxsForumGroupDialog.cpp | 14 +++++++++++++- .../src/gui/gxsforums/GxsForumGroupDialog.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp index 3c208419b..fcc7b463b 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp @@ -113,9 +113,13 @@ bool GxsForumGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMeta bool GxsForumGroupDialog::service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta) { - RsGxsForumGroup grp; + RsGxsForumGroup grp(mGroupData); // start again from cached information. That allows to keep the pinned posts for instance. + + // now replace data by locally edited/changed information + grp.mMeta = editedMeta; grp.mDescription = getDescription().toUtf8().constData(); + getSelectedModerators(grp.mAdminList.ids); std::cerr << "GxsForumGroupDialog::service_EditGroup() submitting changes"; @@ -131,6 +135,7 @@ bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGro std::cerr << std::endl; std::vector groups; + if (!rsGxsForums->getGroupData(token, groups)) { std::cerr << "GxsForumGroupDialog::service_loadGroup() Error getting GroupData"; @@ -148,9 +153,16 @@ bool GxsForumGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsGro std::cerr << "GxsForumsGroupDialog::service_loadGroup() Unfinished Loading"; std::cerr << std::endl; + // Information handled by GxsGroupDialog. description should rather be handled here in the service part! + groupMetaData = groups[0].mMeta; description = QString::fromUtf8(groups[0].mDescription.c_str()); + + // Local information. Description should be handled here. + setSelectedModerators(groups[0].mAdminList.ids); + mGroupData = groups[0]; // keeps the private information + return true; } diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h index 775396b5a..fcc2a2455 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h @@ -39,6 +39,9 @@ protected: virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_loadGroup(uint32_t token, Mode mode, RsGroupMetaData& groupMetaData, QString &description); virtual bool service_EditGroup(uint32_t &token, RsGroupMetaData &editedMeta); + +private: + RsGxsForumGroup mGroupData; }; #endif