diff --git a/doc/api.md b/doc/api.md
index 08fca74fa4..07813b6a77 100644
--- a/doc/api.md
+++ b/doc/api.md
@@ -634,6 +634,73 @@ Friendica doesn't allow showing the friends of other users.
* trim_user
* contributor_details
+---
+
+### Return values for statuses/* api calls
+
+Returned status object is conform to GNU Social/Twitter api.
+
+Friendica adds some addictional fields:
+
+- owner: a user object, it's the owner of the item.
+- private: boolean, true if the item is marked as private
+- activities: map with activities related to the item. Every activity is a list of user objects.
+
+This properties are prefixed with "friendica_" in JSON responses and namespaced under "http://friendi.ca/schema/api/1/" in XML responses
+
+JSON:
+
+```json
+[
+ {
+ // ...
+ 'friendica_owner' : {
+ // user object
+ },
+ 'friendica_private' : true,
+ 'friendica_activities': {
+ 'like': [
+ {
+ // user object
+ },
+ // ...
+ ],
+ 'dislike': [],
+ 'attendyes': [],
+ 'attendno': [],
+ 'attendmaybe': []
+ }
+ },
+ // ...
+]
+```
+
+XML:
+
+```xml
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+
---
### statusnet/config (*)
diff --git a/include/api.php b/include/api.php
index 7450d650eb..f40674b894 100644
--- a/include/api.php
+++ b/include/api.php
@@ -2888,6 +2888,7 @@ function api_format_items($r, $user_info, $filter_user = false, $type = "json")
'favorited' => $item['starred'] ? true : false,
'user' => $status_user ,
'friendica_owner' => $owner_user,
+ 'friendica_private' => $item['private'] == 1,
//'entities' => NULL,
'statusnet_html' => $converted["html"],
'statusnet_conversation_id' => $item['parent'],
diff --git a/include/conversation.php b/include/conversation.php
index 665d9d4831..5a26700fd7 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -471,6 +471,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
. "'; var profile_page = " . $a->pager['page'] . "; \r\n";
}
} elseif ($mode === 'profile') {
+ $items = conversation_add_children($items, false, $order, $uid);
$profile_owner = $a->profile['profile_uid'];
if (!$update) {
@@ -490,6 +491,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
}
}
} elseif ($mode === 'notes') {
+ $items = conversation_add_children($items, false, $order, $uid);
$profile_owner = local_user();
if (!$update) {
@@ -498,6 +500,7 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
. "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; \r\n";
}
} elseif ($mode === 'display') {
+ $items = conversation_add_children($items, false, $order, $uid);
$profile_owner = $a->profile['uid'];
if (!$update) {
diff --git a/include/dba.php b/include/dba.php
index 6480b28ed2..9e168eac79 100644
--- a/include/dba.php
+++ b/include/dba.php
@@ -5,9 +5,9 @@ use Friendica\Database\DBA;
/**
* @brief execute SQL query with printf style args - deprecated
*
- * Please use the dba:: functions instead:
- * dba::select, dba::exists, dba::insert
- * dba::delete, dba::update, dba::p, dba::e
+ * Please use the DBA:: functions instead:
+ * DBA::select, DBA::exists, DBA::insert
+ * DBA::delete, DBA::update, DBA::p, DBA::e
*
* @param $args Query parameters (1 to N parameters of different types)
* @return array|bool Query array
diff --git a/include/enotify.php b/include/enotify.php
index 0ef3c56765..70abce5845 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -32,6 +32,20 @@ function notification($params)
logger('Missing parameters.' . System::callstack());
}
+ // Ensure that the important fields are set at any time
+ $fields = ['notify-flags', 'language', 'username', 'email'];
+ $user = DBA::selectFirst('user', $fields, ['uid' => $params['uid']]);
+
+ if (!DBA::isResult($user)) {
+ logger('Unknown user ' . $params['uid']);
+ return;
+ }
+
+ $params['notify_flags'] = defaults($params, 'notify_flags', $user['notify-flags']);
+ $params['language'] = defaults($params, 'language', $user['language']);
+ $params['to_name'] = defaults($params, 'to_name', $user['username']);
+ $params['to_email'] = defaults($params, 'to_email', $user['email']);
+
// from here on everything is in the recipients language
L10n::pushLang($params['language']);
@@ -510,7 +524,7 @@ function notification($params)
}
// send email notification if notification preferences permit
- if ((!empty($params['notify_flags']) & intval($params['type']))
+ if ((intval($params['notify_flags']) & intval($params['type']))
|| $params['type'] == NOTIFY_SYSTEM
|| $params['type'] == SYSTEM_EMAIL) {
@@ -661,7 +675,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
$profiles = $notification_data["profiles"];
- $fields = ['notify-flags', 'language', 'username', 'email', 'nickname'];
+ $fields = ['nickname'];
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]);
if (!DBA::isResult($user)) {
return false;
@@ -724,10 +738,6 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
// Generate the notification array
$params = [];
$params["uid"] = $uid;
- $params["notify_flags"] = $user["notify-flags"];
- $params["language"] = $user["language"];
- $params["to_name"] = $user["username"];
- $params["to_email"] = $user["email"];
$params["item"] = $item;
$params["parent"] = $item["parent"];
$params["link"] = System::baseUrl().'/display/'.urlencode($item["guid"]);
diff --git a/include/items.php b/include/items.php
index 9922c447f0..08858682e6 100644
--- a/include/items.php
+++ b/include/items.php
@@ -371,7 +371,7 @@ function drop_item($id)
if ((local_user() == $item['uid']) || $contact_id) {
// Check if we should do HTML-based delete confirmation
- if ($_REQUEST['confirm']) {
+ if (!empty($_REQUEST['confirm'])) {
//