Merge pull request #13831 from friendica/warning

Fix warning concerning a missing "created" field
This commit is contained in:
Hypolite Petovan 2024-01-15 14:17:06 -05:00 committed by GitHub
commit dd534919d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 77 deletions

View File

@ -127,8 +127,6 @@ class Mail
*/
public static function send(int $sender_uid, int $recipient = 0, string $body = '', string $subject = '', string $replyto = ''): int
{
$a = DI::app();
if (!$recipient) {
return -1;
}
@ -246,77 +244,4 @@ class Mail
return -3;
}
}
/**
* @param array $recipient recipient, default empty
* @param string $body message body, default empty
* @param string $subject message subject, default empty
* @param string $replyto reply to, default empty
* @return int
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
public static function sendWall(array $recipient = [], string $body = '', string $subject = '', string $replyto = ''): int
{
if (!$recipient) {
return -1;
}
if (!strlen($subject)) {
$subject = DI::l10n()->t('[no subject]');
}
$guid = System::createUUID();
$uri = Item::newURI($guid);
$me = Contact::getByURL($replyto);
if (!$me['name']) {
return -2;
}
$conv_guid = System::createUUID();
$recip_handle = $recipient['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$sender_handle = $me['addr'];
$handles = $recip_handle . ';' . $sender_handle;
$convid = null;
$fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(),
'subject' => $subject, 'recips' => $handles];
if (DBA::insert('conv', $fields)) {
$convid = DBA::lastInsertId();
}
if (!$convid) {
Logger::warning('conversation not found.');
return -4;
}
self::insert(
[
'uid' => $recipient['uid'],
'guid' => $guid,
'convid' => $convid,
'from-name' => $me['name'],
'from-photo' => $me['photo'],
'from-url' => $me['url'],
'contact-id' => 0,
'title' => $subject,
'body' => $body,
'seen' => 0,
'reply' => 0,
'replied' => 0,
'uri' => $uri,
'parent-uri' => $me['url'],
'created' => DateTimeFormat::utcNow(),
'unknown' => 1
],
false
);
return 0;
}
}

View File

@ -762,9 +762,10 @@ class Photo
));
} else {
// This query doesn't do the count and is much faster
$albums = DBA::toArray(DBA::p("SELECT DISTINCT(`album`), '' AS `total`
$albums = DBA::toArray(DBA::p("SELECT '' AS `total`, `album`, MIN(`created`) AS `created`
FROM `photo` USE INDEX (`uid_album_scale_created`)
WHERE `uid` = ? AND `photo-type` IN (?, ?, ?) $sql_extra",
WHERE `uid` = ? AND `photo-type` IN (?, ?, ?) $sql_extra
GROUP BY `album` ORDER BY `created` DESC",
$uid,
self::DEFAULT,
$banner_type,