aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Item.php2
-rw-r--r--include/conversation.php24
-rwxr-xr-xinclude/dba/dba_driver.php2
-rwxr-xr-xinclude/items.php43
4 files changed, 66 insertions, 5 deletions
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 96f656f7b..bcbdcb9e9 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -901,6 +901,8 @@ class Item extends \Zotlabs\Web\Controller {
$x = item_store_update($datarray,$execflag);
+ // item_create_edit_activity($x);
+
if(! $parent) {
$r = q("select * from item where id = %d",
intval($post_id)
diff --git a/include/conversation.php b/include/conversation.php
index 43533e3c1..154a9f82d 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -405,8 +405,6 @@ function count_descendants($item) {
function visible_activity($item) {
$hidden_activities = [ ACTIVITY_LIKE, ACTIVITY_DISLIKE, ACTIVITY_AGREE, ACTIVITY_DISAGREE, ACTIVITY_ABSTAIN, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE ];
- $post_types = [ ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT, basename(ACTIVITY_OBJ_NOTE), basename(ACTIVITY_OBJ_COMMENT)];
-
if(intval($item['item_notshown']))
return false;
@@ -416,14 +414,32 @@ function visible_activity($item) {
}
}
+ if(is_edit_activity($item))
+ return false;
+
+ return true;
+}
+
+/**
+ * @brief Check if a given activity is an edit activity
+ *
+ *
+ * @param array $item
+ * @return boolean
+ */
+
+function is_edit_activity($item) {
+
+ $post_types = [ ACTIVITY_OBJ_NOTE, ACTIVITY_OBJ_COMMENT, basename(ACTIVITY_OBJ_NOTE), basename(ACTIVITY_OBJ_COMMENT)];
+
// In order to share edits with networks which have no concept of editing, we'll create
// separate activities to indicate the edit. Our network will not require them, since our
// edits are automatically applied and the activity indicated.
if(($item['verb'] === ACTIVITY_UPDATE) && (in_array($item['obj_type'],$post_types)))
- return false;
+ return true;
- return true;
+ return false;
}
/**
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 8ae3dccfe..6fb0e79cc 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -182,7 +182,7 @@ abstract class dba_driver {
return false;
}
- if(strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
+ if(strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1') && (! strpbrk($server,':;'))) {
if((! dns_get_record($server, DNS_A + DNS_CNAME + DNS_PTR)) && (! filter_var($server, FILTER_VALIDATE_IP))) {
$this->error = sprintf( t('Cannot locate DNS info for database server \'%s\''), $server);
$this->connected = false;
diff --git a/include/items.php b/include/items.php
index 4c40d9430..cb8a00c33 100755
--- a/include/items.php
+++ b/include/items.php
@@ -4503,3 +4503,46 @@ function fix_attached_file_permissions($channel,$observer_hash,$body,
}
}
}
+
+
+function item_create_edit_activity($post) {
+ if((! $post) || (! $post['item']))
+ return;
+
+ $update_item = $post['item'];
+
+ $new_item = $update_item;
+
+ $new_item['id'] = 0;
+ $new_item['parent'] = 0;
+ $new_item['mid'] = item_message_id();
+
+ $new_item['body'] = sprintf( t('Edited %s'), (($update_item['item_thread_top']) ? t('Post','edit_activity') : t('Comment','edit_activity')));
+
+ $new_item['body'] .= "\n\n";
+ $new_item['body'] .= $update_item['body'];
+
+ $new_item['title'] = $update_item['title'];
+
+ $new_item['verb'] = ACTIVITY_UPDATE;
+ $new_item['item_thread_top'] = 0;
+
+ $x = post_activity_item($new_item);
+
+ logger('posted edit activity');
+
+ $post_id = $x['id'];
+ if($post_id) {
+ $r = q("select * from item where id = %d",
+ intval($post_id)
+ );
+ if($r) {
+ xchan_query($r);
+ $sync_item = fetch_post_tags($r);
+ build_sync_packet($new_item['uid'],array('item' => array(encode_item($sync_item[0],true))));
+ }
+ }
+
+ \Zotlabs\Daemon\Master::Summon(array('Notifier', 'edit_activity', $post_id));
+
+} \ No newline at end of file