automatically add moderator rights to the owner of a forum

This commit is contained in:
csoler 2018-12-24 11:44:57 +01:00
parent ac146c6808
commit e09b416674
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
5 changed files with 14 additions and 9 deletions

@ -74,6 +74,10 @@ struct RsGxsForumGroup : RsSerializable
RS_SERIAL_PROCESS(mAdminList); RS_SERIAL_PROCESS(mAdminList);
RS_SERIAL_PROCESS(mPinnedPosts); RS_SERIAL_PROCESS(mPinnedPosts);
} }
// utility functions
bool canEditPosts(const RsGxsId& id) const { return mAdminList.ids.find(id) != mAdminList.ids.end() || id == mMeta.mAuthorId; }
}; };
struct RsGxsForumMsg : RsSerializable struct RsGxsForumMsg : RsSerializable

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1237</width> <width>1237</width>
<height>1189</height> <height>1206</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -44,7 +44,7 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="createmode"> <widget class="QWidget" name="createmode">
<layout class="QGridLayout" name="gridLayout_8"> <layout class="QGridLayout" name="gridLayout_8">
@ -169,10 +169,10 @@
<item> <item>
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="toolTip"> <property name="toolTip">
<string>Will be used to send feedback</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The identity here can be used to send feedback.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>Contact:</string> <string>Owner:</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -399,7 +399,7 @@
<item> <item>
<widget class="QRadioButton" name="publish_required"> <widget class="QRadioButton" name="publish_required">
<property name="text"> <property name="text">
<string>Required</string> <string>Re&amp;quired</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -855,8 +855,8 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

@ -62,6 +62,7 @@ GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent
: GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent) : GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
{ {
ui.pubKeyShare_cb->setEnabled(true) ; ui.pubKeyShare_cb->setEnabled(true) ;
ui.label_2->setToolTip(tr("<p>Put one of your identities here to allow others to send feedback and also have moderator rights on the forum. You may as well leave that field blank and keep the forum anonymously administrated.</p>"));
} }
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent) GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenExternalQueue, RsTokenService *tokenService, Mode mode, RsGxsGroupId groupId, QWidget *parent)

@ -927,7 +927,7 @@ void RsGxsForumModel::computeMessagesHierarchy(const RsGxsForumGroup& forum_grou
if( !IS_FORUM_MSG_MODERATION(msgIt->second.mMsgFlags) ) // if authors are different the moderation flag needs to be set on the editing msg if( !IS_FORUM_MSG_MODERATION(msgIt->second.mMsgFlags) ) // if authors are different the moderation flag needs to be set on the editing msg
continue ; continue ;
if( forum_group.mAdminList.ids.find(msgIt->second.mAuthorId)==forum_group.mAdminList.ids.end()) // if author is not a moderator, continue if( !forum_group.canEditPosts(msgIt->second.mAuthorId)) // if author is not a moderator, continue
continue ; continue ;
} }

@ -843,7 +843,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
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.canEditPosts(*it))
{ {
contextMnu.addAction(editAct); contextMnu.addAction(editAct);
break ; break ;
@ -1137,7 +1137,7 @@ void GxsForumThreadWidget::updateForumDescription()
} }
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Distribution"), distrib_string); forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Distribution"), distrib_string);
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Contact"), author); forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Owner"), author);
if(!anti_spam_features1.isNull()) if(!anti_spam_features1.isNull())
forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features1); forum_description += QString("<b>%1: \t</b>%2<br/>").arg(tr("Anti-spam")).arg(anti_spam_features1);