mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
keep current voter ID as poster ID in comment dialog
This commit is contained in:
parent
5e2f46a5fc
commit
6cc9cdf130
@ -686,8 +686,11 @@ void PostedListWidgetWithModel::openComments(const RsGxsMessageId& msgId)
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
RsGxsId current_author;
|
||||
ui->idChooser->getChosenId(current_author);
|
||||
|
||||
RsPostedPost post = index.data(Qt::UserRole).value<RsPostedPost>() ;
|
||||
auto *commentDialog = new GxsCommentDialog(this,rsPosted->getTokenService(),rsPosted);
|
||||
auto *commentDialog = new GxsCommentDialog(this,current_author,rsPosted->getTokenService(),rsPosted);
|
||||
|
||||
std::set<RsGxsMessageId> msg_versions({post.mMeta.mMsgId});
|
||||
commentDialog->commentLoad(post.mMeta.mGroupId, msg_versions, post.mMeta.mMsgId);
|
||||
|
@ -60,7 +60,7 @@ void GxsCommentContainer::commentLoad(const RsGxsGroupId &grpId, const std::set<
|
||||
comments += "...";
|
||||
}
|
||||
|
||||
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, getTokenService(), getCommentService());
|
||||
GxsCommentDialog *commentDialog = new GxsCommentDialog(this, RsGxsId(),getTokenService(), getCommentService());
|
||||
|
||||
QWidget *commentHeader = createHeaderWidget(grpId, msgId);
|
||||
commentDialog->setCommentHeader(commentHeader);
|
||||
|
@ -30,24 +30,24 @@
|
||||
#include <QDateTime>
|
||||
|
||||
/** Constructor */
|
||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service)
|
||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent, const RsGxsId &default_author, RsTokenService *token_service, RsGxsCommentService *comment_service)
|
||||
: QWidget(parent), ui(new Ui::GxsCommentDialog)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
setTokenService(token_service,comment_service);
|
||||
init();
|
||||
init(default_author);
|
||||
}
|
||||
|
||||
void GxsCommentDialog::init()
|
||||
void GxsCommentDialog::init(const RsGxsId& default_author)
|
||||
{
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * ttheader = ui->treeWidget->header () ;
|
||||
ttheader->resizeSection (0, 440);
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author);
|
||||
|
||||
connect(ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh()));
|
||||
connect(ui->idChooser, SIGNAL(currentIndexChanged( int )), this, SLOT(voterSelectionChanged( int )));
|
||||
@ -70,13 +70,13 @@ void GxsCommentDialog::setTokenService(RsTokenService *token_service, RsGxsComme
|
||||
ui->treeWidget->setup(token_service, comment_service);
|
||||
}
|
||||
|
||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent)
|
||||
GxsCommentDialog::GxsCommentDialog(QWidget *parent,const RsGxsId &default_author)
|
||||
: QWidget(parent), ui(new Ui::GxsCommentDialog)
|
||||
{
|
||||
/* Invoke the Qt Designer generated QObject setup routine */
|
||||
ui->setupUi(this);
|
||||
|
||||
init();
|
||||
init(default_author);
|
||||
}
|
||||
|
||||
GxsCommentDialog::~GxsCommentDialog()
|
||||
|
@ -32,8 +32,8 @@ class GxsCommentDialog: public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GxsCommentDialog(QWidget *parent);
|
||||
GxsCommentDialog(QWidget *parent, RsTokenService *token_service, RsGxsCommentService *comment_service);
|
||||
GxsCommentDialog(QWidget *parent=nullptr,const RsGxsId& default_author=RsGxsId());
|
||||
GxsCommentDialog(QWidget *parent,const RsGxsId& default_author, RsTokenService *token_service, RsGxsCommentService *comment_service);
|
||||
virtual ~GxsCommentDialog();
|
||||
|
||||
void setTokenService(RsTokenService *token_service, RsGxsCommentService *comment_service);
|
||||
@ -54,7 +54,7 @@ signals:
|
||||
void commentsLoaded(int);
|
||||
|
||||
private:
|
||||
void init();
|
||||
void init(const RsGxsId &default_author);
|
||||
|
||||
RsGxsGroupId mGrpId;
|
||||
RsGxsMessageId mMostRecentMsgId;
|
||||
|
@ -323,7 +323,7 @@ void GxsCommentTreeWidget::banUser()
|
||||
|
||||
void GxsCommentTreeWidget::makeComment()
|
||||
{
|
||||
GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, this);
|
||||
GxsCreateCommentDialog pcc(mCommentService, std::make_pair(mGroupId,mLatestMsgId), mLatestMsgId, mVoterId,this);
|
||||
pcc.exec();
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ void GxsCommentTreeWidget::replyToComment()
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
msgId.first = mGroupId;
|
||||
msgId.second = mCurrentCommentMsgId;
|
||||
GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, this);
|
||||
GxsCreateCommentDialog pcc(mCommentService, msgId, mLatestMsgId, mVoterId,this);
|
||||
|
||||
pcc.loadComment(mCurrentCommentText, mCurrentCommentAuthor, mCurrentCommentAuthorId);
|
||||
pcc.exec();
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <iostream>
|
||||
|
||||
GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, QWidget *parent) :
|
||||
GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair &parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author,QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::GxsCreateCommentDialog), mCommentService(service), mParentId(parentId), mThreadId(threadId)
|
||||
{
|
||||
@ -35,7 +35,7 @@ GxsCreateCommentDialog::GxsCreateCommentDialog(RsGxsCommentService *service, co
|
||||
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
|
||||
/* fill in the available OwnIds for signing */
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, RsGxsId());
|
||||
ui->idChooser->loadIds(IDCHOOSER_ID_REQUIRED, default_author);
|
||||
}
|
||||
|
||||
void GxsCreateCommentDialog::loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId)
|
||||
|
@ -36,7 +36,7 @@ class GxsCreateCommentDialog : public QDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, QWidget *parent = 0);
|
||||
explicit GxsCreateCommentDialog(RsGxsCommentService *service, const RsGxsGrpMsgIdPair& parentId, const RsGxsMessageId& threadId, const RsGxsId& default_author=RsGxsId(),QWidget *parent = 0);
|
||||
~GxsCreateCommentDialog();
|
||||
|
||||
void loadComment(const QString &msgText, const QString &msgAuthor, const RsGxsId &msgAuthorId);
|
||||
|
@ -731,7 +731,7 @@ void GxsGroupFrameDialog::loadComment(const RsGxsGroupId &grpId, const QVector<R
|
||||
comments += "...";
|
||||
}
|
||||
|
||||
commentDialog = new GxsCommentDialog(this, mInterface->getTokenService(), commentService);
|
||||
commentDialog = new GxsCommentDialog(this,RsGxsId(), mInterface->getTokenService(), commentService);
|
||||
|
||||
QWidget *commentHeader = createCommentHeaderWidget(grpId, most_recent_msgId);
|
||||
if (commentHeader) {
|
||||
|
Loading…
Reference in New Issue
Block a user