From 3a3161950966dddfffd48336e36701a626730c72 Mon Sep 17 00:00:00 2001 From: gerhard6380 Date: Fri, 2 Sep 2016 17:01:52 +0200 Subject: [PATCH 1/4] API: change friendica_activities to include arrays of users --- include/api.php | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/include/api.php b/include/api.php index a380845ed1..a9c5e7a468 100644 --- a/include/api.php +++ b/include/api.php @@ -2362,29 +2362,54 @@ 'attendno' => array(), 'attendmaybe' => array() ); + $items = q('SELECT * FROM item WHERE uid=%d AND `thr-parent`="%s" AND visible AND NOT deleted', intval($item['uid']), dbesc($item['uri'])); + foreach ($items as $i){ - builtin_activity_puller($i, $activities); + // not used as result should be structured like other user data + //builtin_activity_puller($i, $activities); + + // get user data and add it to the array of the activity + $user = api_get_user($a, $i['author-link']); + switch($i['verb']) { + case ACTIVITY_LIKE: + $activities['like'][] = $user; + break; + case ACTIVITY_DISLIKE: + $activities['dislike'][] = $user; + break; + case ACTIVITY_ATTEND: + $activities['attendyes'][] = $user; + break; + case ACTIVITY_ATTENDNO: + $activities['attendno'][] = $user; + break; + case ACTIVITY_ATTENDMAYBE: + $activities['attendmaybe'][] = $user; + break; + default: + break; + } } if ($type == "xml") { $xml_activities = array(); - foreach ($activities as $k => $v) + foreach ($activities as $k => $v) { + // change xml element from "like" to "friendica:like" $xml_activities["friendica:".$k] = $v; - + // add user data into xml output + $k_user = 0; + foreach ($v as $user) + $xml_activities["friendica:".$k][$k_user++.":user"] = $user; + } $activities = $xml_activities; } - $res = array(); - $uri = $item['uri']."-l"; - foreach($activities as $k => $v) { - $res[$k] = (x($v,$uri)?count($v[$uri]):0); - #$res[$k] = ( x($v,$uri) ? array_map("api_contactlink_to_array", $v[$uri]) : array() ); - } - return $res; + return $activities; + } /** From c02b1c3f36a19bb5e4fb27e2edd9c4c45a8a7b4c Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 3 Sep 2016 12:48:51 +0200 Subject: [PATCH 2/4] The "tagged with" message now works again. --- include/conversation.php | 2 +- object/Item.php | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index 9d7b474af9..e74f4c33f0 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -425,7 +425,7 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`, `item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`, `item`.`location`, `item`.`coord`, `item`.`app`, - `item`.`rendered-hash`, `item`.`rendered-html`, + `item`.`rendered-hash`, `item`.`rendered-html`, `item`.`object`, `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, diff --git a/object/Item.php b/object/Item.php index ee40d186ce..9f01ac59b0 100644 --- a/object/Item.php +++ b/object/Item.php @@ -89,14 +89,14 @@ class Item extends BaseObject { $a = $this->get_app(); $item = $this->get_data(); - $edited = false; - if (strcmp($item['created'], $item['edited'])<>0) { - $edited = array( - 'label' => t('This entry was edited'), - 'date' => datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r'), - 'relative' => relative_date($item['edited']) - ); - } + $edited = false; + if (strcmp($item['created'], $item['edited'])<>0) { + $edited = array( + 'label' => t('This entry was edited'), + 'date' => datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r'), + 'relative' => relative_date($item['edited']) + ); + } $commentww = ''; $sparkle = ''; $buttons = ''; @@ -439,10 +439,10 @@ class Item extends BaseObject { } } - if ($this->is_toplevel()) { - $result['total_comments_num'] = "$total_children"; - $result['total_comments_text'] = tt('comment', 'comments', $total_children); - } + if ($this->is_toplevel()) { + $result['total_comments_num'] = "$total_children"; + $result['total_comments_text'] = tt('comment', 'comments', $total_children); + } $result['private'] = $item['private']; $result['toplevel'] = ($this->is_toplevel() ? 'toplevel_item' : ''); From 1cb6043aea60d142c7bbe0f9576fcc92b4669d1a Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 4 Sep 2016 18:06:07 +0200 Subject: [PATCH 3/4] Attachments are now displayed again. --- include/conversation.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/conversation.php b/include/conversation.php index e74f4c33f0..057526c547 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -390,7 +390,6 @@ function item_fieldlists() { /* These Fields are not added below (yet). They are here to for bug search. `item`.`type`, -`item`.`object`, `item`.`extid`, `item`.`received`, `item`.`changed`, @@ -399,7 +398,6 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`target`, `item`.`resource-id`, `item`.`tag`, -`item`.`attach`, `item`.`inform`, `item`.`pubmail`, `item`.`visible`, @@ -424,7 +422,7 @@ These Fields are not added below (yet). They are here to for bug search. `item`.`verb`, `item`.`object-type`, `item`.`postopts`, `item`.`plink`, `item`.`guid`, `item`.`wall`, `item`.`private`, `item`.`starred`, `item`.`title`, `item`.`body`, `item`.`file`, `item`.`event-id`, - `item`.`location`, `item`.`coord`, `item`.`app`, + `item`.`location`, `item`.`coord`, `item`.`app`, `item`.`attach`, `item`.`rendered-hash`, `item`.`rendered-html`, `item`.`object`, `item`.`allow_cid`, `item`.`allow_gid`, `item`.`deny_cid`, `item`.`deny_gid`, `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, From 2040cb44734fa8534e1deefe9aedb37c0e6981c5 Mon Sep 17 00:00:00 2001 From: ben-utzer Date: Mon, 5 Sep 2016 00:22:39 +0200 Subject: [PATCH 4/4] Update htconfig.md typo, siehe auch https://github.com/friendica/friendica/pull/2754 --- doc/htconfig.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/htconfig.md b/doc/htconfig.md index f7266604f6..fa26236673 100644 --- a/doc/htconfig.md +++ b/doc/htconfig.md @@ -57,7 +57,7 @@ line to your .htconfig.php: * qsearch_limit - Default value is 100. * relay_server - Experimental Diaspora feature. Address of the relay server where public posts should be send to. For example https://podrelay.net * relay_subscribe (Boolean) - Enables the receiving of public posts from the relay. They will be included in the search and on the community page when it is set up to show all public items. -* relay_scope - Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts witt selected tags should be received. +* relay_scope - Can be "all" or "tags". "all" means that every public post should be received. "tags" means that only posts with selected tags should be received. * relay_server_tags - Comma separated list of tags for the "tags" subscription (see "relay_scrope") * relay_user_tags (Boolean) - If enabled, the tags from the saved searches will used for the "tags" subscription in addition to the "relay_server_tags". * remove_multiplicated_lines (Boolean) - If enabled, multiple linefeeds in items are stripped to a single one.