Sending contact suggestions does work again
This commit is contained in:
parent
35c7a61620
commit
a6cf036db2
|
@ -26,26 +26,29 @@ function fsuggest_post(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', ['name', 'url', 'request', 'photo'], ['id' => $contact_id, 'uid' => local_user()]);
|
// We do query the "uid" as well to ensure that it is our contact
|
||||||
if (!DBA::isResult($contact)) {
|
if (!DBA::exists('contact', ['id' => $contact_id, 'uid' => local_user()])) {
|
||||||
notice(L10n::t('Contact not found.') . EOL);
|
notice(L10n::t('Contact not found.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$suggest_contact_id = intval($_POST['suggest']);
|
||||||
|
if (empty($suggest_contact_id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We do query the "uid" as well to ensure that it is our contact
|
||||||
|
$contact = DBA::selectFirst('contact', ['name', 'url', 'request', 'avatar'], ['id' => $suggest_contact_id, 'uid' => local_user()]);
|
||||||
|
if (!DBA::isResult($contact)) {
|
||||||
|
notice(L10n::t('Suggested contact not found.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$note = Strings::escapeHtml(trim(defaults($_POST, 'note', '')));
|
$note = Strings::escapeHtml(trim(defaults($_POST, 'note', '')));
|
||||||
|
|
||||||
$new_contact = intval($_POST['suggest']);
|
|
||||||
if (empty($new_contact)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DBA::exists('contact', ['id' => $new_contact])) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$fields = ['uid' => local_user(),'cid' => $contact_id, 'name' => $contact['name'],
|
$fields = ['uid' => local_user(),'cid' => $contact_id, 'name' => $contact['name'],
|
||||||
'url' => $contact['url'], 'request' => $contact['request'],
|
'url' => $contact['url'], 'request' => $contact['request'],
|
||||||
'photo' => $contact['photo'], 'note' => $note, 'created' => DateTimeFormat::utcNow()];
|
'photo' => $contact['avatar'], 'note' => $note, 'created' => DateTimeFormat::utcNow()];
|
||||||
DBA::insert('fsuggest', $fields);
|
DBA::insert('fsuggest', $fields);
|
||||||
|
|
||||||
Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', DBA::lastInsertId());
|
Worker::add(PRIORITY_HIGH, 'Notifier', 'suggest', DBA::lastInsertId());
|
||||||
|
|
|
@ -319,7 +319,7 @@ class Delivery extends BaseObject
|
||||||
$deliver_status = DFRN::deliver($owner, $contact, $atom, false, true);
|
$deliver_status = DFRN::deliver($owner, $contact, $atom, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::log('Delivery to ' . $contact['url'] . ' with guid ' . defaults($target_item, 'guid', $target_item['id']) . ' returns ' . $deliver_status);
|
Logger::info('DFRN Delivery', ['cmd' => $cmd, 'url' => $contact['url'], 'guid' => defaults($target_item, 'guid', $target_item['id']), 'return' => $deliver_status]);
|
||||||
|
|
||||||
if ($deliver_status < 0) {
|
if ($deliver_status < 0) {
|
||||||
Logger::info('Delivery failed: defer message', ['id' => defaults($target_item, 'guid', $target_item['id'])]);
|
Logger::info('Delivery failed: defer message', ['id' => defaults($target_item, 'guid', $target_item['id'])]);
|
||||||
|
|
Loading…
Reference in a new issue