GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commit c6f4cd3d authored by Malcolm Blaney's avatar Malcolm Blaney
Browse files

Only create comments from webmentions on permalink pages. Start

module now supports adding a feed url rather than a local user.
parent 89ff7c0a
Pipeline #140908721 passed with stage
in 1 minute and 35 seconds
......@@ -1902,32 +1902,37 @@ class Post extends Base {
$reader->Factory('CheckFollowPost', [$us_result, $us_target]);
}
else if ($comment_installed && in_array($us_mention, $display_comment)) {
$us_content = ['author' => $us_author, 'author_photo' => $us_author_photo,
'author_url' => $us_author_url, 'url' => $us_url,
'description' => $us_description,
'permalink' => $this->user->page . '#' . $id,
'category' => $us_mention];
$id = $comment->Factory('MatchUrl', $us_url);
if ($id !== 0) {
if ($comment->Factory('Modified', [$id, $us_description])) {
$resend = true;
if ($us_description === '') {
$comment->Remove($id);
}
else {
// SetContent will create a Notification for the updated comment.
$comment->SetContent($id, $us_content);
// The current page needs to be a permalink to display the comment.
if ($this->IsPermalink()) {
$us_content = ['author' => $us_author,
'author_photo' => $us_author_photo,
'author_url' => $us_author_url, 'url' => $us_url,
'description' => $us_description,
'permalink' => $this->user->page . '#' . $id,
'category' => $us_mention];
$id = $comment->Factory('MatchUrl', $us_url);
if ($id !== 0) {
if ($comment->Factory('Modified', [$id, $us_description])) {
$resend = true;
if ($us_description === '') {
$comment->Remove($id);
}
else {
// SetContent will create a Notification for the updated comment.
$comment->SetContent($id, $us_content);
}
}
}
}
else if ($us_description !== '') {
$id = new_module($this->user, $this->owner, 'comment',
$this->user->page, $comment->Group(),
$comment->Placement());
$comment->Add($id);
// SetContent will create a Notification for the new comment.
$comment->SetContent($id, $us_content);
$resend = true;
else if ($us_description !== '') {
// $this->user->page must have a post module to create the comment.
$id = new_module($this->user, $this->owner, 'comment',
$this->user->page, $comment->Group(),
$comment->Placement());
$comment->Add($id);
// SetContent will create a Notification for the new comment.
$comment->SetContent($id, $us_content);
$resend = true;
}
}
}
else if ($escrow_installed && $us_result['payment'] !== '') {
......
......@@ -601,12 +601,9 @@ class Start extends Base {
$this->Url('', 'blog', $this->user->name);
$reader->Factory('AddFeed', [$id, $feed, true]);
// Also add a default follow for this server if set.
$follow_user = $this->Substitute('start-follow-user');
$follow_page = $this->Substitute('start-follow-page');
if ($follow_user !== '' && $follow_page !== '') {
$feed = $scheme . $server .
$this->Url('', $follow_page, $follow_user);
$reader->Factory('AddFeed', [$id, $feed, true]);
$follow_url = $this->Substitute('start-follow-url');
if ($follow_url !== '') {
$reader->Factory('AddFeed', [$id, $follow_url, true]);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment