From 1392c7c6fe8c034ffaeb924be57730592722ac57 Mon Sep 17 00:00:00 2001 From: csoler Date: Tue, 4 Sep 2018 20:21:42 +0200 Subject: [PATCH] prevent editing of pinned posts --- .../gui/gxsforums/GxsForumThreadWidget.cpp | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 93c75fdf4..463e9cd6b 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -615,23 +615,28 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/) QTreeWidgetItem *item = *selectedItems.begin(); GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast(item); - RsGxsId author_id; - if(gxsIdItem && gxsIdItem->getId(author_id) && rsIdentity->isOwnId(author_id)) - contextMnu.addAction(editAct); - else + bool is_pinned = mForumGroup.mPinnedPosts.ids.find( RsGxsMessageId(item->data(COLUMN_THREAD_MSGID,Qt::DisplayRole).toString().toStdString()) ) != mForumGroup.mPinnedPosts.ids.end(); + + if(!is_pinned) { - // Go through the list of own ids and see if one of them is a moderator - // TODO: offer to select which moderator ID to use if multiple IDs fit the conditions of the forum + RsGxsId author_id; + if(gxsIdItem && gxsIdItem->getId(author_id) && rsIdentity->isOwnId(author_id)) + contextMnu.addAction(editAct); + else + { + // Go through the list of own ids and see if one of them is a moderator + // TODO: offer to select which moderator ID to use if multiple IDs fit the conditions of the forum - std::list own_ids ; - rsIdentity->getOwnIds(own_ids) ; + std::list own_ids ; + rsIdentity->getOwnIds(own_ids) ; - for(auto it(own_ids.begin());it!=own_ids.end();++it) - if(mForumGroup.mAdminList.ids.find(*it) != mForumGroup.mAdminList.ids.end()) - { - contextMnu.addAction(editAct); - break ; - } + for(auto it(own_ids.begin());it!=own_ids.end();++it) + if(mForumGroup.mAdminList.ids.find(*it) != mForumGroup.mAdminList.ids.end()) + { + contextMnu.addAction(editAct); + break ; + } + } } if(IS_GROUP_ADMIN(mSubscribeFlags))