mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-14 08:59:50 -05:00
commit
969ad81913
@ -1423,65 +1423,44 @@ bool p3GxsChannels::createCommentV2(
|
||||
RsGxsMessageId& commentMessageId,
|
||||
std::string& errorMessage )
|
||||
{
|
||||
constexpr auto fname = __PRETTY_FUNCTION__;
|
||||
const auto failure = [&](const std::string& err)
|
||||
{
|
||||
errorMessage = err;
|
||||
RsErr() << fname << " " << err << std::endl;
|
||||
return false;
|
||||
};
|
||||
|
||||
if(channelId.isNull()) return failure("channelId cannot be null");
|
||||
if(threadId.isNull()) return failure("threadId cannot be null");
|
||||
if(parentId.isNull()) return failure("parentId cannot be null");
|
||||
|
||||
std::vector<RsGxsChannelGroup> channelsInfo;
|
||||
if(!getChannelsInfo(std::list<RsGxsGroupId>({channelId}),channelsInfo))
|
||||
{
|
||||
errorMessage = "Channel with Id " + channelId.toStdString()
|
||||
+ " does not exist.";
|
||||
return false;
|
||||
}
|
||||
return failure( "Channel with Id " + channelId.toStdString()
|
||||
+ " does not exist." );
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
|
||||
if(!getChannelContent( // does the post thread exist?
|
||||
channelId,std::set<RsGxsMessageId>({threadId}), posts, comments ))
|
||||
{
|
||||
errorMessage = "You cannot comment post " + threadId.toStdString() +
|
||||
" of channel with Id " + channelId.toStdString() +
|
||||
": this post does not exists locally!";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure( "You cannot comment post " + threadId.toStdString() +
|
||||
" of channel with Id " + channelId.toStdString() +
|
||||
": this post does not exists locally!" );
|
||||
|
||||
// check that the post thread Id is actually that of a post thread
|
||||
if(posts.size() != 1 || !posts[0].mMeta.mParentId.isNull())
|
||||
{
|
||||
errorMessage = "You cannot comment post " + threadId.toStdString() +
|
||||
" of channel with Id " + channelId.toStdString() +
|
||||
": supplied threadId is not a thread, or parentMsgId is not a" +
|
||||
" comment!";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure( "You cannot comment post " + threadId.toStdString() +
|
||||
" of channel with Id " + channelId.toStdString() +
|
||||
": supplied threadId is not a thread, or parentMsgId is"
|
||||
" not a comment!");
|
||||
|
||||
if(!parentId.isNull())
|
||||
{
|
||||
if(!getChannelContent( // does the post thread exist?
|
||||
channelId,std::set<RsGxsMessageId>({parentId}),posts,comments ))
|
||||
{
|
||||
errorMessage = "You cannot comment post " + parentId.toStdString() +
|
||||
": supplied parent comment Id is not a comment!";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(comments.size() != 1 || comments[0].mMeta.mParentId.isNull())
|
||||
{ // is the comment parent actually a comment?
|
||||
errorMessage = "You cannot comment post "
|
||||
+ parentId.toStdString()
|
||||
+ " of channel with Id " + channelId.toStdString() +
|
||||
": supplied mParentMsgId is not a comment Id!";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!getChannelContent( // does the post thread exist?
|
||||
channelId, std::set<RsGxsMessageId>({parentId}),
|
||||
posts, comments ))
|
||||
return failure( "You cannot comment post " + parentId.toStdString() +
|
||||
": supplied parent doesn't exists locally!" );
|
||||
|
||||
if(!origCommentId.isNull())
|
||||
{
|
||||
@ -1491,35 +1470,22 @@ bool p3GxsChannels::createCommentV2(
|
||||
|
||||
if( !getChannelContent(channelId, s, posts, comments) ||
|
||||
comments.size() != 1 )
|
||||
{
|
||||
errorMessage = "You cannot edit comment "
|
||||
+ origCommentId.toStdString()
|
||||
+ " of channel with Id " + channelId.toStdString()
|
||||
+ ": this post does not exist locally!";
|
||||
RsErr() << __PRETTY_FUNCTION__ << " " << errorMessage << std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure( "You cannot edit comment " +
|
||||
origCommentId.toStdString() +
|
||||
" of channel with Id " + channelId.toStdString() +
|
||||
": this comment does not exist locally!");
|
||||
|
||||
const RsGxsId& commentAuthor = comments[0].mMeta.mAuthorId;
|
||||
if(commentAuthor != authorId)
|
||||
{
|
||||
errorMessage = "Editor identity and creator doesn't match "
|
||||
+ authorId.toStdString() + " != "
|
||||
+ commentAuthor.toStdString();
|
||||
RsErr() << __PRETTY_FUNCTION__ << " " << errorMessage << std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure( "Editor identity and creator doesn't match "
|
||||
+ authorId.toStdString() + " != "
|
||||
+ commentAuthor.toStdString() );
|
||||
}
|
||||
|
||||
if(!rsIdentity->isOwnId(authorId)) // is the author ID actually ours?
|
||||
{
|
||||
errorMessage = "You cannot comment to channel with Id " +
|
||||
channelId.toStdString() + " with identity " +
|
||||
authorId.toStdString() + " because it is not yours.";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure( "You cannot comment to channel with Id " +
|
||||
channelId.toStdString() + " with identity " +
|
||||
authorId.toStdString() + " because it is not yours." );
|
||||
|
||||
// Now create the comment
|
||||
RsGxsComment cmt;
|
||||
@ -1532,28 +1498,15 @@ bool p3GxsChannels::createCommentV2(
|
||||
|
||||
uint32_t token;
|
||||
if(!createNewComment(token, cmt))
|
||||
{
|
||||
errorMessage = "Failed creating comment.";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure("createNewComment failed");
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
errorMessage = "GXS operation failed.";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
RsTokenService::GxsRequestStatus wSt = waitToken(token);
|
||||
if(wSt != RsTokenService::COMPLETE)
|
||||
return failure( "GXS operation waitToken failed with: " +
|
||||
std::to_string(wSt) );
|
||||
|
||||
if(!RsGenExchange::getPublishedMsgMeta(token, cmt.mMeta))
|
||||
{
|
||||
errorMessage = "Failure getting created comment data.";
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
return failure("Failure getting created comment data.");
|
||||
|
||||
commentMessageId = cmt.mMeta.mMsgId;
|
||||
return true;
|
||||
|
@ -39,14 +39,23 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QFrame" name="titleBarFrame">
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
@ -54,7 +63,16 @@
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -160,6 +178,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>RSTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
@ -171,11 +194,6 @@
|
||||
<header>gui/common/RSTabWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="FeedReader_images.qrc"/>
|
||||
|
@ -109,7 +109,7 @@ QString PostedDialog::icon(IconType type)
|
||||
case ICON_POPULAR_GROUP:
|
||||
return "";
|
||||
case ICON_OTHER_GROUP:
|
||||
return ":/icons/png/feed-other.png";
|
||||
return "";
|
||||
case ICON_SEARCH:
|
||||
return ":/images/find.png";
|
||||
case ICON_DEFAULT:
|
||||
|
@ -306,7 +306,7 @@ void PostedItem::fill()
|
||||
urlstr += messageName();
|
||||
urlstr += QString(" </span></a>");
|
||||
|
||||
QString siteurl = url.scheme() + "://" + url.host();
|
||||
QString siteurl = url.toEncoded();
|
||||
sitestr = QString("<a href=\"%1\" ><span style=\" text-decoration: underline; color:#0079d3;\"> %2 </span></a>").arg(siteurl).arg(siteurl);
|
||||
|
||||
ui->titleLabel->setText(urlstr);
|
||||
|
@ -124,6 +124,13 @@ QIcon PostedListWidget::groupIcon()
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
void PostedListWidget::groupIdChanged()
|
||||
{
|
||||
mPostIndex = 0;
|
||||
GxsMessageFramePostWidget::groupIdChanged();
|
||||
updateShowText();
|
||||
}
|
||||
|
||||
/*****************************************************************************************/
|
||||
// Overloaded from FeedHolder.
|
||||
QScrollArea *PostedListWidget::getScrollArea()
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
|
||||
/* GxsMessageFrameWidget */
|
||||
virtual QIcon groupIcon();
|
||||
virtual void groupIdChanged();
|
||||
|
||||
/* FeedHolder */
|
||||
virtual QScrollArea *getScrollArea();
|
||||
|
@ -303,7 +303,7 @@ border-image: url(:/images/closepressed.png)
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="toolBarFrame">
|
||||
<widget class="QFrame" name="toolBarFrameTop">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/* Standard rules */
|
||||
|
||||
QFrame#toolBarFrame {
|
||||
QFrame#toolBarFrame, QFrame#toolBarFrameTop {
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
border: 1px solid #CCCCCC;
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ no_retroshare_gui:CONFIG -= retroshare_gui
|
||||
# Enable GXS distant syncronization
|
||||
CONFIG *= gxsdistsync
|
||||
|
||||
# To disable RetroShare-nogui append the following
|
||||
# assignation to qmake command line "CONFIG+=no_retroshare_nogui"
|
||||
# To enable RetroShare-nogui append the following
|
||||
# assignation to qmake command line "CONFIG+=retroshare_nogui"
|
||||
CONFIG *= no_retroshare_nogui
|
||||
retroshare_nogui:CONFIG -= no_retroshare_nogui
|
||||
|
||||
# To disable cmark append the following
|
||||
# assignation to qmake command line "CONFIG+=no_cmark"
|
||||
# To enable cmark append the following
|
||||
# assignation to qmake command line "CONFIG+=rs_gui_cmark"
|
||||
CONFIG *= no_rs_gui_cmark
|
||||
rs_gui_cmark:CONFIG -= no_rs_gui_cmark
|
||||
|
||||
@ -63,18 +63,19 @@ retroshare_android_notify_service:CONFIG -= no_retroshare_android_notify_service
|
||||
CONFIG *= no_retroshare_qml_app
|
||||
retroshare_qml_app:CONFIG -= no_retroshare_qml_app
|
||||
|
||||
# To enable RetroShare service append the following assignation to
|
||||
# qmake command line "CONFIG+=retroshare_service"
|
||||
# To disable RetroShare service append the following assignation to
|
||||
# qmake command line "CONFIG+=no_retroshare_service"
|
||||
CONFIG *= retroshare_service
|
||||
retroshare_service:CONFIG -= no_retroshare_service
|
||||
no_retroshare_service:CONFIG -= retroshare_service
|
||||
|
||||
# To enable libresapi (deprecated) append the following assignation to qmake command line
|
||||
# "CONFIG+=libresapi"
|
||||
CONFIG+=no_libresapi
|
||||
libresapi:CONFIG -= no_libresapi
|
||||
|
||||
# To enable libresapi via local socket (unix domain socket or windows named
|
||||
# pipes) append the following assignation to qmake command line
|
||||
#"CONFIG+=libresapilocalserver"
|
||||
# "CONFIG+=libresapilocalserver"
|
||||
CONFIG *= no_libresapilocalserver
|
||||
libresapilocalserver:CONFIG -= no_libresapilocalserver
|
||||
|
||||
@ -83,8 +84,8 @@ libresapilocalserver:CONFIG -= no_libresapilocalserver
|
||||
CONFIG *= no_libresapi_settings
|
||||
libresapi_settings:CONFIG -= no_libresapi_settings
|
||||
|
||||
# To disable libresapi via HTTP (based on libmicrohttpd) append the following
|
||||
# assignation to qmake command line "CONFIG+=no_libresapihttpserver"
|
||||
# To enable libresapi via HTTP (based on libmicrohttpd) append the following
|
||||
# assignation to qmake command line "CONFIG+=libresapihttpserver"
|
||||
CONFIG *= no_libresapihttpserver
|
||||
libresapihttpserver:CONFIG -= no_libresapihttpserver
|
||||
|
||||
@ -164,7 +165,8 @@ rs_macos10.14:CONFIG -= rs_macos10.11
|
||||
CONFIG *= no_rs_jsonapi
|
||||
rs_jsonapi:CONFIG -= no_rs_jsonapi
|
||||
|
||||
# To disable deep search append the following assignation to qmake command line
|
||||
# To enable deep search append the following assignation to qmake command line
|
||||
# CONFIG *= rs_deep_search
|
||||
CONFIG *= no_rs_deep_search
|
||||
rs_deep_search:CONFIG -= no_rs_deep_search
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user