From 7f6dd59a38ff4144a324b31a68cfe8160a140d09 Mon Sep 17 00:00:00 2001 From: C <118273+cdn@users.noreply.github.com> Date: Tue, 14 Apr 2020 15:36:05 +0000 Subject: [PATCH 1/2] Quick addition of replyto --- Media.php | 34 ++++++++++ templates/default/entity/Media/edit.tpl.php | 74 ++++++++++++++++++++- 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/Media.php b/Media.php index 265108e..d299b73 100644 --- a/Media.php +++ b/Media.php @@ -16,6 +16,18 @@ function getTitle() function getDescription() { + $body = $this->body; + if (!empty($this->inreplyto)) { + if (is_array($this->inreplyto)) { + foreach ($this->inreplyto as $inreplyto) { + $body = '' . $body; + } + } else { + $body = '' . $body; + } + } + return $body; + return $this->body; } @@ -28,6 +40,15 @@ function getActivityStreamsObjectType() return 'media'; } +/* + $meta = array('type' => 'media'); + if ($this->inreplyto) { + $meta['in-reply-to'] = $this->inreplyto; + // $meta['type'] = 'reply'; + } + return $meta; +*/ + /** * Saves changes to this object based on user input * @return bool @@ -47,6 +68,19 @@ function saveDataFromInput() } } + $this->inreplyto = \Idno\Core\Idno::site()->currentPage()->getInput('inreplyto'); + + // TODO fetch syndicated reply targets asynchronously (or maybe on-demand, when syndicating?) + if (!empty($inreplyto)) { + if (is_array($inreplyto)) { + foreach ($inreplyto as $inreplytourl) { + $this->syndicatedto = \Idno\Core\Webmention::addSyndicatedReplyTargets($inreplytourl, $this->syndicatedto); + } + } else { + $this->syndicatedto = \Idno\Core\Webmention::addSyndicatedReplyTargets($inreplyto); + } + } + $this->title = \Idno\Core\Idno::site()->currentPage()->getInput('title'); $this->body = \Idno\Core\Idno::site()->currentPage()->getInput('body'); $this->tags = \Idno\Core\Idno::site()->currentPage()->getInput('tags'); diff --git a/templates/default/entity/Media/edit.tpl.php b/templates/default/entity/Media/edit.tpl.php index 1a243a8..c3e9748 100644 --- a/templates/default/entity/Media/edit.tpl.php +++ b/templates/default/entity/Media/edit.tpl.php @@ -1,4 +1,18 @@ draw('entity/edit/header');?> +inreplyto)) { + if (!is_array($vars['object']->inreplyto)) { + $vars['object']->inreplyto = array($vars['object']->inreplyto); + } +} else { + $vars['object']->inreplyto = array(); +} +if (!empty($vars['url'])) { + $vars['object']->inreplyto = array($vars['url']); +} + +?>
@@ -55,6 +69,33 @@ 'label' => \Idno\Core\Idno::site()->language()->_('Description'), ])->draw('forms/input/richtext')?> draw('entity/tags/input');?> + +

+ + language()->_('Reply to a site'); ?> +

+ + +
+ inreplyto)) { + foreach ($vars['object']->inreplyto as $inreplyto) { + ?> +

+ + + language()->_('Remove URL'); ?> +

+ +
+ drawSyndication('media', $vars['object']->getPosseLinks()); ?> _id)) { echo $this->__(['name' => 'forward-to', 'value' => \Idno\Core\Idno::site()->config()->getDisplayURL() . 'content/all/'])->draw('forms/input/hidden'); @@ -71,4 +112,35 @@
-draw('entity/edit/footer');?> \ No newline at end of file + +draw('entity/edit/footer');?> From 7a96782c537ee8a7bd5de47dade418ff9f2c5a99 Mon Sep 17 00:00:00 2001 From: cdn <118273+cdn@users.noreply.github.com> Date: Sat, 30 Jan 2021 17:32:11 +0000 Subject: [PATCH 2/2] Rewrite getActivityStreamsObjectType() --- Media.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Media.php b/Media.php index d299b73..cc7003a 100644 --- a/Media.php +++ b/Media.php @@ -37,17 +37,12 @@ function getDescription() */ function getActivityStreamsObjectType() { - return 'media'; - } - -/* $meta = array('type' => 'media'); if ($this->inreplyto) { $meta['in-reply-to'] = $this->inreplyto; - // $meta['type'] = 'reply'; } return $meta; -*/ + } /** * Saves changes to this object based on user input