From d63e903d9ff184fa6e4e8f6a2d2da745c74fa582 Mon Sep 17 00:00:00 2001
From: Michael
Date: Tue, 3 Mar 2020 21:29:51 +0000
Subject: [PATCH] Changed template for direction
---
src/Object/Post.php | 10 ++++++++++
static/defaults.config.php | 4 ++++
view/theme/frio/templates/wall_thread.tpl | 9 +++++++++
view/theme/vier/templates/wall_thread.tpl | 3 +++
4 files changed, 26 insertions(+)
diff --git a/src/Object/Post.php b/src/Object/Post.php
index 1c1f85e2a5..76cf6b0367 100644
--- a/src/Object/Post.php
+++ b/src/Object/Post.php
@@ -406,6 +406,15 @@ class Post
$remote_comment = '';
}
+ $direction = [];
+ if (DI::config()->get('debug', 'show_direction')) {
+ $conversation = DBA::selectFirst('conversation', ['direction'], ['item-uri' => $item['uri']]);
+ if (!empty($conversation['direction']) && in_array($conversation['direction'], [1, 2])) {
+ $title = [1 => DI::l10n()->t('Pushed'), 2 => DI::l10n()->t('Pulled')];
+ $direction = ['direction' => $conversation['direction'], 'title' => $title[$conversation['direction']]];
+ }
+ }
+
$tmp_item = [
'template' => $this->getTemplate(),
'type' => implode("", array_slice(explode("/", $item['verb']), -1)),
@@ -482,6 +491,7 @@ class Post
'commented' => $item['commented'],
'created_date' => $item['created'],
'return' => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
+ 'direction' => $direction,
'delivery' => [
'queue_count' => $item['delivery_queue_count'],
'queue_done' => $item['delivery_queue_done'] + $item['delivery_queue_failed'], /// @todo Possibly display it separately in the future
diff --git a/static/defaults.config.php b/static/defaults.config.php
index ab47eef19c..110c016eb0 100644
--- a/static/defaults.config.php
+++ b/static/defaults.config.php
@@ -496,6 +496,10 @@ return [
// Logs every call to /inbox as a JSON file in Friendica's temporary directory
'ap_inbox_log' => false,
+ // show_direction (Boolean)
+ // Display if a post had been fetched or had been pushed towards our server
+ 'show_direction' => false,
+
// total_ap_delivery (Boolean)
// Deliver via AP to every possible receiver and we suppress the delivery to these contacts with other protocols
'total_ap_delivery' => false,
diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl
index 5a0cf57fad..a5a785af7e 100644
--- a/view/theme/frio/templates/wall_thread.tpl
+++ b/view/theme/frio/templates/wall_thread.tpl
@@ -155,6 +155,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
+ {{if $item.direction}}
+ {{include file="sub/direction.tpl" direction=$item.direction}}
+ {{/if}}
{{if $item.pinned}}
•
{{$item.pinned}}
@@ -183,6 +186,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
+ {{if $item.direction}}
+ {{include file="sub/direction.tpl" direction=$item.direction}}
+ {{/if}}
@@ -202,6 +208,9 @@ as the value of $top_child_total (this is done at the end of this file)
{{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
+ {{if $item.direction}}
+ {{include file="sub/direction.tpl" direction=$item.direction}}
+ {{/if}}
diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl
index aef411bcaa..31ab92a3d7 100644
--- a/view/theme/vier/templates/wall_thread.tpl
+++ b/view/theme/vier/templates/wall_thread.tpl
@@ -60,6 +60,9 @@
{{if $item.owner_self}}
{{include file="sub/delivery_count.tpl" delivery=$item.delivery}}
{{/if}}
+ {{if $item.direction}}
+ {{include file="sub/direction.tpl" direction=$item.direction}}
+ {{/if}}
{{$item.pinned}}
{{if $item.lock}}{{$item.lock}}{{/if}}