mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
added a flag for moderating messages to help removign them when the author is not a moderator anymore
This commit is contained in:
parent
e7d721b3de
commit
59535eac8a
@ -111,7 +111,7 @@ public:
|
||||
RsTlvKeySignatureSet signSet;
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
uint32_t mMsgFlags; // Whats this for?
|
||||
uint32_t mMsgFlags; // used by some services (e.g. by forums to store message moderation flags)
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
// normally READ / UNREAD flags. LOCAL Data.
|
||||
|
@ -115,8 +115,7 @@ namespace GXS_SERV {
|
||||
/** START GXS Grp status flags **/
|
||||
|
||||
static const uint32_t GXS_GRP_STATUS_UNPROCESSED = 0x000000100;
|
||||
|
||||
static const uint32_t GXS_GRP_STATUS_UNREAD = 0x00000200;
|
||||
static const uint32_t GXS_GRP_STATUS_UNREAD = 0x000000200;
|
||||
|
||||
/** END GXS Grp status flags **/
|
||||
}
|
||||
|
@ -30,6 +30,14 @@
|
||||
#include "retroshare/rsgxsifacehelper.h"
|
||||
#include "serialiser/rstlvidset.h"
|
||||
|
||||
// Forum Service message flags, to be used in RsMsgMetaData::mMsgFlags
|
||||
// Gxs imposes to use the first two bytes (lower bytes) of mMsgFlags for private forum flags, the upper bytes being used for internal GXS stuff.
|
||||
|
||||
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MASK = 0x0000000f ;
|
||||
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MODERATED = 0x00000001 ;
|
||||
|
||||
#define IS_FORUM_MSG_MODERATION(flags) (flags & RS_GXS_FORUM_MSG_FLAGS_MODERATED)
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsGxsForums;
|
||||
extern RsGxsForums *rsGxsForums;
|
||||
|
@ -138,7 +138,7 @@ struct RsMsgMetaData : RsSerializable
|
||||
std::string mMsgName;
|
||||
time_t mPublishTs;
|
||||
|
||||
/// the first 16 bits for service, last 16 for GXS
|
||||
/// the lower 16 bits for service, upper 16 bits for GXS
|
||||
uint32_t mMsgFlags;
|
||||
|
||||
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
|
||||
|
@ -50,8 +50,9 @@
|
||||
//#define ENABLE_GENERATE
|
||||
|
||||
/** Constructor */
|
||||
CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId,const RsGxsMessageId& mOId,const RsGxsId& posterId)
|
||||
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId), mOrigMsgId(mOId),mPosterId(posterId)
|
||||
CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId& mOId, const RsGxsId& posterId, bool isModerating)
|
||||
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint),
|
||||
mForumId(fId), mParentId(pId), mOrigMsgId(mOId),mPosterId(posterId),mIsModerating(isModerating)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
@ -355,7 +356,9 @@ void CreateGxsForumMsg::createMsg()
|
||||
msg.mMeta.mGroupId = mForumId;
|
||||
msg.mMeta.mParentId = mParentId;
|
||||
msg.mMeta.mOrigMsgId = mOrigMsgId;
|
||||
msg.mMeta.mMsgFlags = mIsModerating?RS_GXS_FORUM_MSG_FLAGS_MODERATED : 0;
|
||||
msg.mMeta.mMsgId.clear() ;
|
||||
|
||||
if (mParentMsgLoaded) {
|
||||
msg.mMeta.mThreadId = mParentMsg.mMeta.mThreadId;
|
||||
}//if (mParentMsgLoaded)
|
||||
|
@ -36,7 +36,7 @@ class CreateGxsForumMsg : public QDialog, public TokenResponse
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId &moId, const RsGxsId &posterId = RsGxsId());
|
||||
CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId, const RsGxsMessageId &moId, const RsGxsId &posterId = RsGxsId(),bool isModerating=false);
|
||||
~CreateGxsForumMsg();
|
||||
|
||||
void newMsg(); /* cleanup */
|
||||
@ -75,6 +75,7 @@ private:
|
||||
bool mOrigMsgLoaded;
|
||||
bool mForumMetaLoaded;
|
||||
bool mForumCircleLoaded ;
|
||||
bool mIsModerating; // means that the msg has a orig author Id that is not the Id of the author
|
||||
|
||||
RsGxsForumMsg mParentMsg;
|
||||
RsGxsForumMsg mOrigMsg;
|
||||
|
@ -2325,7 +2325,7 @@ void GxsForumThreadWidget::editForumMessageData(const RsGxsForumMsg& msg)
|
||||
|
||||
if (!msg.mMeta.mAuthorId.isNull())
|
||||
{
|
||||
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(groupId(), msg.mMeta.mParentId, msg.mMeta.mMsgId, is_own?(msg.mMeta.mAuthorId):moderator_id);
|
||||
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(groupId(), msg.mMeta.mParentId, msg.mMeta.mMsgId, is_own?(msg.mMeta.mAuthorId):moderator_id,!is_own);
|
||||
|
||||
cfm->insertPastedText(QString::fromUtf8(msg.mMsg.c_str())) ;
|
||||
cfm->show();
|
||||
|
@ -255,9 +255,15 @@ void GxsForumsFillThread::run()
|
||||
// Make sure that the author is the same than the original message, or is a moderator. This should always happen when messages are constructed using
|
||||
// the UI but nothing can prevent a nasty user to craft a new version of a message with his own signature.
|
||||
|
||||
if(msgIt2->second.mMeta.mAuthorId != msgIt->second.mMeta.mAuthorId && forum_group.mAdminList.ids.find(msgIt->second.mMeta.mAuthorId)==forum_group.mAdminList.ids.end())
|
||||
if(msgIt2->second.mMeta.mAuthorId != msgIt->second.mMeta.mAuthorId)
|
||||
{
|
||||
if( !IS_FORUM_MSG_MODERATION(msgIt->second.mMeta.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.mMeta.mAuthorId)==forum_group.mAdminList.ids.end()) // if author is not a moderator, continue
|
||||
continue ;
|
||||
}
|
||||
|
||||
// always add the post a self version
|
||||
|
||||
if(mPostVersions[msgIt->second.mMeta.mOrigMsgId].empty())
|
||||
|
Loading…
Reference in New Issue
Block a user