aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2020-12-04 14:33:34 +0100
committerMax Kostikov <max@kostikov.co>2020-12-04 14:33:34 +0100
commita9dd6d6bdbc27e11ffe71644670686d82e05420f (patch)
tree05dd57d1c3f2a8b7541598544b92dbbfe964c329 /include
parentc9ce562369556ae01044dfb91541c4e4ee35af9e (diff)
parent9c7ec55b4049599f3a61192eaf020e3a112dfa0e (diff)
downloadvolse-hubzilla-a9dd6d6bdbc27e11ffe71644670686d82e05420f.tar.gz
volse-hubzilla-a9dd6d6bdbc27e11ffe71644670686d82e05420f.tar.bz2
volse-hubzilla-a9dd6d6bdbc27e11ffe71644670686d82e05420f.zip
Merge branch 'dev' into 'dev'
Dev sync See merge request kostikov/core!2
Diffstat (limited to 'include')
-rw-r--r--include/channel.php20
-rw-r--r--include/conversation.php5
-rw-r--r--include/feedutils.php12
-rw-r--r--include/hubloc.php28
-rwxr-xr-xinclude/items.php19
-rw-r--r--include/socgraph.php2
-rw-r--r--include/text.php2
7 files changed, 41 insertions, 47 deletions
diff --git a/include/channel.php b/include/channel.php
index e2be4d8a8..71fad5222 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2573,26 +2573,6 @@ function channel_reddress($channel) {
return strtolower($channel['channel_address'] . '@' . App::get_hostname());
}
-
-/**
- * @brief Get manual channel conversation update config.
- *
- * Check the channel config \e manual_conversation_update, if not set fall back
- * to global system config, defaults to 1 if nothing set.
- *
- * @param int $channel_id
- * @return int
- */
-function channel_manual_conv_update($channel_id) {
-
- $x = get_pconfig($channel_id, 'system', 'manual_conversation_update');
- if($x === false)
- $x = get_config('system', 'manual_conversation_update', 1);
-
- return intval($x);
-}
-
-
/**
* @brief Return parsed HTML remote_login template.
*
diff --git a/include/conversation.php b/include/conversation.php
index e77404cff..6615b04c3 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -511,6 +511,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
$jsreload = '';
$preview = (($page_mode === 'preview') ? true : false);
+ $r_preview = (($page_mode === 'r_preview') ? true : false);
$previewing = (($preview) ? ' preview ' : '');
$preview_lbl = t('This is an unsaved preview');
@@ -873,11 +874,13 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
}
+
$item['pagedrop'] = $page_dropping;
- if($item['id'] == $item['parent']) {
+ if($item['id'] == $item['parent'] || $r_preview) {
$item_object = new Zotlabs\Lib\ThreadItem($item);
+
$conv->add_thread($item_object);
if(($page_mode === 'list') || ($page_mode === 'pager_list')) {
$item_object->set_template('conv_list.tpl');
diff --git a/include/feedutils.php b/include/feedutils.php
index 0a9af7ee1..5f5f563f8 100644
--- a/include/feedutils.php
+++ b/include/feedutils.php
@@ -13,6 +13,10 @@
* @param array $params associative array which configures the feed
* @return string with an atom feed
*/
+
+use Ramsey\Uuid\Uuid;
+use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
+
function get_public_feed($channel, $params) {
if(! $params)
@@ -431,6 +435,13 @@ function get_atom_elements($feed, $item) {
$res['plink'] = unxmlify($item->get_link(0));
$res['item_rss'] = 1;
+ try {
+ $uuid = Uuid::uuid5(Uuid::NAMESPACE_URL, $res['plink'])->toString();
+ } catch (UnsatisfiedDependencyException $e) {
+ $uuid = md5($res['plink']);
+ }
+
+ $res['uuid'] = $uuid;
$summary = unxmlify($item->get_description(true));
@@ -1516,6 +1527,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
continue;
}
+
}
}
}
diff --git a/include/hubloc.php b/include/hubloc.php
index 6b896c627..6ab426a10 100644
--- a/include/hubloc.php
+++ b/include/hubloc.php
@@ -288,30 +288,18 @@ function locations_by_netid($netid) {
function ping_site($url) {
- $ret = array('success' => false);
+ $ret = array('success' => false);
- $sys = get_sys_channel();
+ $r = Zotlabs\Lib\Zotfinger::exec($url);
- $m = zot_build_packet($sys, 'ping');
- $r = zot_zot($url . '/post', $m);
- if(! $r['success']) {
- $ret['message'] = 'no answer from ' . $url;
- return $ret;
- }
- $packet_result = json_decode($r['body'], true);
- if(! $packet_result['success']) {
- $ret['message'] = 'packet failure from ' . $url;
- return $ret;
- }
+ if(! $r['data']) {
+ $ret['message'] = 'no answer from ' . $url;
+ return $ret;
+ }
- if($packet_result['success']) {
- $ret['success'] = true;
- }
- else {
- $ret['message'] = 'unknown error from ' . $url;
- }
+ $ret['success'] = true;
+ return $ret;
- return $ret;
}
diff --git a/include/items.php b/include/items.php
index 960aa3580..a027be4b2 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2502,7 +2502,7 @@ function item_update_parent_commented($item) {
);
q("UPDATE item set commented = '%s', changed = '%s' WHERE id = %d",
- dbesc(($z) ? $z[0]['commented'] : datetime_convert()),
+ dbesc(($z[0]['commented']) ? $z[0]['commented'] : datetime_convert()),
dbesc(datetime_convert()),
intval($item['parent'])
);
@@ -3179,8 +3179,18 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
if($rewrite_author) {
$item['author_xchan'] = $channel['channel_hash'];
- $r = q("update item set author_xchan = '%s' where id = %d",
+ //if it's a toplevel rss item we will also rewrite the mid to something fetchable
+ if($item['item_rss'] && $item['item_thread_top']) {
+ $item['mid'] = z_root() . '/item/' . $item['uuid'];
+ $item['parent_mid'] = $item['mid'];
+ $item['thr_parent'] = $item['mid'];
+ }
+
+ $r = q("UPDATE item SET author_xchan = '%s', mid = '%s', parent_mid = '%s', thr_parent = '%s' WHERE id = %d",
dbesc($item['author_xchan']),
+ dbesc($item['mid']),
+ dbesc($item['parent_mid']),
+ dbesc($item['thr_parent']),
intval($item_id)
);
}
@@ -3235,7 +3245,6 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
-
$arr['item_thread_top'] = 1;
if (strpos($item['body'], "[/share]") !== false) {
@@ -3299,7 +3308,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
$private = 1;
$item_wall = 1;
- $item_origin = 1;
+ $item_origin = (($item['item_deleted']) ? 0 : 1); // item_origin for deleted items is set to 0 in delete_imported_item() to prevent looping. In this case we probably should not set it back to 1 here.
$item_uplink = 0;
$item_nocomment = 0;
@@ -3315,7 +3324,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
);
}
else {
- $item_uplink = 1;
+ $item_uplink = (($item['item_rss']) ? 0 : 1); // Do not set item_uplink for rss items - we can not send anything to them.
// if this is an edit, item_store_update() will have already updated the item
// with the correct value for source_xchan (by ignoring it). We cannot set to owner_xchan
diff --git a/include/socgraph.php b/include/socgraph.php
index 3da4dce63..aaea4550c 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -271,6 +271,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
and xchan_hidden = 0
and xchan_deleted = 0
and xlink_static = 0
+ and xchan_network = 'zot6'
group by xchan_hash order by total desc limit %d offset %d ",
intval($uid),
intval($uid),
@@ -290,6 +291,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
and xchan_hidden = 0
and xchan_deleted = 0
and xlink_static = 0
+ and xchan_network = 'zot6'
group by xchan_hash order by total desc limit %d offset %d ",
intval($uid),
intval($uid),
diff --git a/include/text.php b/include/text.php
index 58cde7838..c2a45814c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -1667,7 +1667,7 @@ function format_filer(&$item) {
if(! trim($term))
continue;
$removelink = z_root() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']);
- $categories[] = array('term' => $term, 'removelink' => $removelink);
+ $categories[] = array('term' => $term, 'removelink' => $removelink, 'id' => $item['id']);
}
$s = replace_macros(get_markup_template('item_filer.tpl'),array(