Implement pull request feedback

- Improve formatting of drop_item in mod/item
- Replace deprecated Logger::log() calls in Protocol\Feed::consume
This commit is contained in:
Hypolite Petovan 2020-06-17 21:44:28 -04:00
parent 4e7c45f835
commit f544c8383b
2 changed files with 8 additions and 10 deletions

View File

@ -928,7 +928,7 @@ function drop_item(int $id, string $return = '')
DI::baseUrl()->redirect('display/' . $item['guid']);
}
$is_comment = ($item['gravity'] == GRAVITY_COMMENT) ? true : false;
$is_comment = $item['gravity'] == GRAVITY_COMMENT;
$parentitem = null;
if (!empty($item['parent'])) {
$fields = ['guid'];
@ -949,14 +949,12 @@ function drop_item(int $id, string $return = '')
if (!empty($parentitem)) {
DI::baseUrl()->redirect('display/' . $parentitem['guid']);
//NOTREACHED
}
// In case something goes wrong
} // In case something goes wrong
else {
DI::baseUrl()->redirect('network');
//NOTREACHED
}
}
else {
} else {
// if unknown location or deleting top level post called from display
if (empty($return_url) || strpos($return_url, 'display') !== false) {
DI::baseUrl()->redirect('network');

View File

@ -74,24 +74,24 @@ class Feed
public static function consume($xml, array $importer, array $contact, &$hub)
{
if ($contact['network'] === Protocol::OSTATUS) {
Logger::log('Consume OStatus messages ', Logger::DEBUG);
Logger::info('Consume OStatus messages');
OStatus::import($xml, $importer, $contact, $hub);
return;
}
if ($contact['network'] === Protocol::FEED) {
Logger::log('Consume feeds', Logger::DEBUG);
Logger::info('Consume feeds');
self::import($xml, $importer, $contact);
return;
}
if ($contact['network'] === Protocol::DFRN) {
Logger::log('Consume DFRN messages', Logger::DEBUG);
Logger::info('Consume DFRN messages');
$dfrn_importer = DFRN::getImporter($contact['id'], $importer['uid']);
if (!empty($dfrn_importer)) {
Logger::log('Now import the DFRN feed');
Logger::info('Now import the DFRN feed');
DFRN::import($xml, $dfrn_importer, true);
return;
}