From 7ff1b19cc012ab8c764634298989f0fca20094bc Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 21 Jan 2019 17:11:29 -0500 Subject: [PATCH 1/3] Restore display of delivery status --- view/theme/frio/templates/wall_thread.tpl | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 8d357960fe..85e12b808d 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -202,7 +202,17 @@ 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.location}} @@ -239,7 +249,14 @@ as the value of $top_child_total (this is done at the end of this file)
{{$item.name}} - {{$item.ago}} {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + + {{$item.ago}} + {{if $item.location}} — ({{$item.location nofilter}}){{/if}} + {{if $item.owner_self}} + • + {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} + {{/if}} +
From 1ee1d7ef4e12849cd3ebc4fd09d95e4e3768dc94 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Jan 2019 00:02:00 -0500 Subject: [PATCH 2/3] Add new PostUpdate function to initialize delivery data --- src/Database/PostUpdate.php | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/Database/PostUpdate.php b/src/Database/PostUpdate.php index c40bfc98e7..acafea900c 100644 --- a/src/Database/PostUpdate.php +++ b/src/Database/PostUpdate.php @@ -34,6 +34,9 @@ class PostUpdate if (!self::update1281()) { return false; } + if (!self::update1297()) { + return false; + } return true; } @@ -377,4 +380,40 @@ class PostUpdate return false; } + + /** + * Set the delivery queue count to a negative value for all items preceding the feature. + * + * @return bool "true" when the job is done + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + private static function update1297() + { + // Was the script completed? + if (Config::get('system', 'post_update_version') >= 1297) { + return true; + } + + $max_item_delivery_data = DBA::selectFirst('item-delivery-data', ['iid'], ['queue_count > 0 OR queue_done > 0'], ['order' => ['iid']]); + $max_iid = $max_item_delivery_data['iid']; + + Logger::info('Start update1297 with max iid: ' . $max_iid); + + $condition = ['`queue_count` = 0 AND `iid` < ?', $max_iid]; + + DBA::update('item-delivery-data', ['queue_count' => -1], $condition); + + if (DBA::errorNo() != 0) { + Logger::error('Database error ' . DBA::errorNo() . ':' . DBA::errorMessage()); + return false; + } + + Logger::info('Processed rows: ' . DBA::affectedRows()); + + Config::set('system', 'post_update_version', 1297); + + Logger::info('Done'); + + return true; + } } From e2d32caa7857c5a8ca7fc694452cae844adad365 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 23 Jan 2019 00:05:53 -0500 Subject: [PATCH 3/3] Update delivery count display - Hide display when item is preceding the feature - Wrap the display in its own span - Remove delivery bullet from wall_thread.tpl - [frio] Make delivery icon fainter --- view/templates/sub/delivery_count.tpl | 21 +++++++++----- view/theme/frio/css/style.css | 1 + .../frio/templates/sub/delivery_count.tpl | 29 +++++++++++-------- view/theme/frio/templates/wall_thread.tpl | 3 -- .../vier/templates/sub/delivery_count.tpl | 29 +++++++++++-------- view/theme/vier/templates/wall_thread.tpl | 1 - 6 files changed, 48 insertions(+), 36 deletions(-) diff --git a/view/templates/sub/delivery_count.tpl b/view/templates/sub/delivery_count.tpl index d10eda639b..b487be8847 100644 --- a/view/templates/sub/delivery_count.tpl +++ b/view/templates/sub/delivery_count.tpl @@ -2,12 +2,17 @@ Please don't use this template as is, this is a placeholder that needs to be overriden with specific icons to avoid taking too much visual space *}} -{{if $delivery.queue_count == 0}} - {{$delivery.notifier_pending|escape}} -{{elseif $delivery.queue_done == 0}} - {{$delivery.delivery_pending|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} -{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} - {{$delivery.delivery_underway|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} -{{else}} - {{$delivery.delivery_almost|escape}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} +{{if $delivery.queue_count >= -1 && $delivery.queue_count !== '' && $delivery.queue_count !== null}} + + • + {{if $delivery.queue_count == 0}} + {{$delivery.notifier_pending}} + {{elseif $delivery.queue_done == 0}} + {{$delivery.delivery_pending}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} + {{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} + {{$delivery.delivery_underway}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} + {{else}} + {{$delivery.delivery_almost}} {{$item.delivery.queue_done}}/{{$item.delivery.queue_count}} + {{/if}} + {{/if}} diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index cfb404f9fe..896892531d 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -2094,6 +2094,7 @@ ul.dropdown-menu li:hover { /* Media Classes */ .media .time, .media .shared-time, +.media .delivery, .media .location, .media .location a { font-size: 11px; diff --git a/view/theme/frio/templates/sub/delivery_count.tpl b/view/theme/frio/templates/sub/delivery_count.tpl index 05d1d171c7..ee9e411cc4 100644 --- a/view/theme/frio/templates/sub/delivery_count.tpl +++ b/view/theme/frio/templates/sub/delivery_count.tpl @@ -1,13 +1,18 @@ -{{if $delivery.queue_count == 0}} - - {{$delivery.notifier_pending|escape}} -{{elseif $delivery.queue_done == 0}} - - {{$delivery.delivery_pending|escape}} -{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} - - {{$delivery.delivery_underway|escape}} -{{else}} - - {{$delivery.delivery_almost|escape}} +{{if $delivery.queue_count >= -1 && $delivery.queue_count !== '' && $delivery.queue_count !== null}} + + • + {{if $delivery.queue_count == 0}} + + {{$delivery.notifier_pending}} + {{elseif $delivery.queue_done == 0}} + + {{$delivery.delivery_pending}} + {{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} + + {{$delivery.delivery_underway}} + {{else}} + + {{$delivery.delivery_almost}} + {{/if}} + {{/if}} diff --git a/view/theme/frio/templates/wall_thread.tpl b/view/theme/frio/templates/wall_thread.tpl index 85e12b808d..12e419f8a5 100644 --- a/view/theme/frio/templates/wall_thread.tpl +++ b/view/theme/frio/templates/wall_thread.tpl @@ -209,7 +209,6 @@ 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}} @@ -233,7 +232,6 @@ as the value of $top_child_total (this is done at the end of this file) {{$item.ago}} {{if $item.location}} — ({{$item.location nofilter}}){{/if}} {{if $item.owner_self}} - • {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{/if}} @@ -253,7 +251,6 @@ as the value of $top_child_total (this is done at the end of this file) {{$item.ago}} {{if $item.location}} — ({{$item.location nofilter}}){{/if}} {{if $item.owner_self}} - • {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{/if}} diff --git a/view/theme/vier/templates/sub/delivery_count.tpl b/view/theme/vier/templates/sub/delivery_count.tpl index 594ce38c53..a0719f762f 100644 --- a/view/theme/vier/templates/sub/delivery_count.tpl +++ b/view/theme/vier/templates/sub/delivery_count.tpl @@ -1,13 +1,18 @@ -{{if $delivery.queue_count == 0}} - - {{$delivery.notifier_pending|escape}} -{{elseif $delivery.queue_done == 0}} - - {{$delivery.delivery_pending|escape}} -{{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} - - {{$delivery.delivery_underway|escape}} -{{else}} - - {{$delivery.delivery_almost|escape}} +{{if $delivery.queue_count >= -1 && $delivery.queue_count !== '' && $delivery.queue_count !== null}} + + • + {{if $delivery.queue_count == 0}} + + {{$delivery.notifier_pending}} + {{elseif $delivery.queue_done == 0}} + + {{$delivery.delivery_pending}} + {{elseif $delivery.queue_done / $delivery.queue_count < 0.75}} + + {{$delivery.delivery_underway}} + {{else}} + + {{$delivery.delivery_almost}} + {{/if}} + {{/if}} diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 607a789e56..21ebcea38f 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -57,7 +57,6 @@ {{if $item.plink}}{{else}} {{/if}} {{if $item.owner_self}} - • {{include file="sub/delivery_count.tpl" delivery=$item.delivery}} {{/if}}