Merge pull request #1441 from csoler/v0.6-ForumAdmin2

automatically add moderator rights to the owner of a forum
This commit is contained in:
csoler 2018-12-25 20:34:42 +01:00 committed by GitHub
commit 1176908e71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 9 deletions

View File

@ -74,6 +74,10 @@ struct RsGxsForumGroup : RsSerializable
RS_SERIAL_PROCESS(mAdminList);
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

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1237</width>
<height>1189</height>
<height>1206</height>
</rect>
</property>
<property name="windowTitle">
@ -44,7 +44,7 @@
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="createmode">
<layout class="QGridLayout" name="gridLayout_8">
@ -169,10 +169,10 @@
<item>
<widget class="QLabel" name="label_2">
<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 name="text">
<string>Contact:</string>
<string>Owner:</string>
</property>
</widget>
</item>
@ -399,7 +399,7 @@
<item>
<widget class="QRadioButton" name="publish_required">
<property name="text">
<string>Required</string>
<string>Re&amp;quired</string>
</property>
</widget>
</item>
@ -855,8 +855,8 @@
</customwidget>
</customwidgets>
<resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -62,6 +62,7 @@ GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent
: GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
{
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)

View File

@ -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
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 ;
}

View File

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