aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-12-08 22:46:21 +0000
committerMario <mario@mariovavti.com>2024-12-08 22:46:21 +0000
commit7785487d776cdb5117f9a9206da9557ad2f59d0f (patch)
tree9f0da496b1d321d925cf0cc50af5e5efccbe711a
parent9756023e39cb58081b68644e23322cb69c8f0833 (diff)
downloadvolse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.tar.gz
volse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.tar.bz2
volse-hubzilla-7785487d776cdb5117f9a9206da9557ad2f59d0f.zip
fix delayed post handling in cron, always set item_delayed if we select a create date
-rw-r--r--Zotlabs/Daemon/Cron.php42
-rw-r--r--Zotlabs/Lib/Activity.php4
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--include/items.php10
-rw-r--r--view/tpl/jot-header.tpl1
-rw-r--r--view/tpl/jot.tpl1
6 files changed, 22 insertions, 38 deletions
diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php
index 4a5d88f8f..a38809f45 100644
--- a/Zotlabs/Daemon/Cron.php
+++ b/Zotlabs/Daemon/Cron.php
@@ -147,37 +147,29 @@ class Cron {
// (time travel posts). Restrict to items that have come of age in the last
// couple of days to limit the query to something reasonable.
- $r = q("select id from item where item_delayed = 1 and created <= %s and created > '%s' ",
+ $r = q("select * from item where item_delayed = 1 and created <= %s and created > '%s' ",
db_utcnow(),
dbesc(datetime_convert('UTC', 'UTC', 'now - 2 days'))
);
- if ($r) {
- foreach ($r as $rr) {
- $x = q("update item set item_delayed = 0 where id = %d",
- intval($rr['id'])
- );
- if ($x) {
- $z = q("select * from item where id = %d",
- intval($rr['id'])
- );
- if ($z) {
- xchan_query($z);
- $sync_item = fetch_post_tags($z);
- Libsync::build_sync_packet($sync_item[0]['uid'],
- [
- 'item' => [encode_item($sync_item[0], true)]
- ]
- );
- }
- Master::Summon(array('Notifier', 'wall-new', $rr['id']));
- if ($interval) {
- usleep($interval);
+ if ($r) {
+ xchan_query($r);
+ $items = fetch_post_tags($r);
+ foreach ($items as $item) {
+ $item['item_delayed'] = 0;
+ $post = item_store_update($item);
+
+ if($post['success']) {
+ Master::Summon(['Notifier', 'wall-new', $post['item_id']]);
+ if (!empty($post['approval_id'])) {
+ Master::Summon(['Notifier', 'wall-new', $post['approval_id']]);
}
}
- }
- }
-
+ if ($interval) {
+ usleep($interval);
+ }
+ }
+ }
// once daily run birthday_updates and then expire in background
// FIXME: add birthday updates, both locally and for xprof for use
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 66d2b06a7..f0b69038a 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -3807,8 +3807,8 @@ class Activity {
->setDenyGid($sourceItem['deny_gid'])
->setPrivate($sourceItem['item_private'])
->setRestrict($sourceItem['item_restrict'])
- ->setNocomment($sourceItem['item_nocomment'])
- ->setCommentsClosed($sourceItem['comments_closed'])
+ // ->setNocomment($sourceItem['item_nocomment'])
+ // ->setCommentsClosed($sourceItem['comments_closed'])
->setType($sourceItem['item_type'])
->setCommentPolicy($sourceItem['comment_policy'])
->setPublicPolicy($sourceItem['public_policy'])
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 06175109f..f542e44ff 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -100,7 +100,6 @@ class Item extends Controller {
$item_deleted = false;
$item_hidden = false;
$item_unpublished = false;
- $item_delayed = false;
$item_pending_remove = false;
$item_blocked = false;
@@ -178,6 +177,7 @@ class Item extends Controller {
$categories = ((x($_REQUEST, 'category')) ? escape_tags($_REQUEST['category']) : '');
$webpage = ((x($_REQUEST, 'webpage')) ? intval($_REQUEST['webpage']) : 0);
$item_obscured = ((x($_REQUEST, 'obscured')) ? intval($_REQUEST['obscured']) : 0);
+ $item_delayed = ((x($_REQUEST, 'delayed')) ? intval($_REQUEST['delayed']) : 0);
$pagetitle = ((x($_REQUEST, 'pagetitle')) ? escape_tags($_REQUEST['pagetitle']) : '');
$layout_mid = ((x($_REQUEST, 'layout_mid')) ? escape_tags($_REQUEST['layout_mid']) : '');
$plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
diff --git a/include/items.php b/include/items.php
index dbf7d104a..037846e02 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1791,16 +1791,6 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
if((! array_key_exists('item_nocomment',$arr)) && ($arr['comment_policy'] == 'none'))
$arr['item_nocomment'] = 1;
- // handle time travelers
- // Allow a bit of fudge in case somebody just has a slightly slow/fast clock
-
- $d1 = new DateTime('now +10 minutes', new DateTimeZone('UTC'));
- $d2 = new DateTime($arr['created'] . '+00:00');
-
- if($d2 > $d1) {
- $arr['item_delayed'] = 1;
- }
-
if(empty($arr['llink'])) {
$arr['llink'] = z_root() . '/display/' . $arr['uuid'];
}
diff --git a/view/tpl/jot-header.tpl b/view/tpl/jot-header.tpl
index 2c60b7c22..3d93fcde9 100644
--- a/view/tpl/jot-header.tpl
+++ b/view/tpl/jot-header.tpl
@@ -199,6 +199,7 @@ var activeCommentText = '';
$('#created-modal-OKButton').on('click', function() {
reply=$('#created-date').val();
if(reply && reply.length) {
+ $('#jot-delayed').val(1);
$('#jot-created').val(reply);
$('#createdModal').modal('hide');
}
diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl
index 53315876b..1cecee906 100644
--- a/view/tpl/jot.tpl
+++ b/view/tpl/jot.tpl
@@ -13,6 +13,7 @@
{{if $parent}}
<input type="hidden" name="parent" value="{{$parent}}" />
{{/if}}
+ <input type="hidden" id="jot-delayed" name="delayed" value="0" />
<input type="hidden" name="obj_type" value="{{$ptyp}}" />
<input type="hidden" name="profile_uid" value="{{$profile_uid}}" />
<input type="hidden" name="return" value="{{$return_path}}" />