prevent editing of pinned posts

This commit is contained in:
csoler 2018-09-04 20:21:42 +02:00
parent d856566c69
commit 1392c7c6fe
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C

View file

@ -615,23 +615,28 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
QTreeWidgetItem *item = *selectedItems.begin(); QTreeWidgetItem *item = *selectedItems.begin();
GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast<GxsIdRSTreeWidgetItem*>(item); GxsIdRSTreeWidgetItem *gxsIdItem = dynamic_cast<GxsIdRSTreeWidgetItem*>(item);
RsGxsId author_id; bool is_pinned = mForumGroup.mPinnedPosts.ids.find( RsGxsMessageId(item->data(COLUMN_THREAD_MSGID,Qt::DisplayRole).toString().toStdString()) ) != mForumGroup.mPinnedPosts.ids.end();
if(gxsIdItem && gxsIdItem->getId(author_id) && rsIdentity->isOwnId(author_id))
contextMnu.addAction(editAct); if(!is_pinned)
else
{ {
// Go through the list of own ids and see if one of them is a moderator RsGxsId author_id;
// TODO: offer to select which moderator ID to use if multiple IDs fit the conditions of the forum 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<RsGxsId> own_ids ; std::list<RsGxsId> own_ids ;
rsIdentity->getOwnIds(own_ids) ; rsIdentity->getOwnIds(own_ids) ;
for(auto it(own_ids.begin());it!=own_ids.end();++it) for(auto it(own_ids.begin());it!=own_ids.end();++it)
if(mForumGroup.mAdminList.ids.find(*it) != mForumGroup.mAdminList.ids.end()) if(mForumGroup.mAdminList.ids.find(*it) != mForumGroup.mAdminList.ids.end())
{ {
contextMnu.addAction(editAct); contextMnu.addAction(editAct);
break ; break ;
} }
}
} }
if(IS_GROUP_ADMIN(mSubscribeFlags)) if(IS_GROUP_ADMIN(mSubscribeFlags))