Browse Source

Implement code review from nupplaphil

pull/8089/head
Matthew Exon 1 year ago
parent
commit
5d0a3be4f6
3 changed files with 5 additions and 5 deletions
  1. +1
    -1
      src/Model/Contact.php
  2. +1
    -1
      src/Model/Mail.php
  3. +3
    -3
      src/Model/Photo.php

+ 1
- 1
src/Model/Contact.php View File

@ -1899,7 +1899,7 @@ class Contact
foreach ($data as $image_uri) {
$image_rid = Photo::ridFromURI($image_uri);
if ($image_rid && !Photo::exists(['resource-id' => $image_rid, 'uid' => $uid])) {
Logger::info('Regenerating avatar for contact uid ' . $uid . ' cid ' . $cid . ' missing photo ' . $image_rid . ' avatar ' . $contact['avatar']);
Logger::info('Regenerating avatar', ['contact uid' => $uid, 'cid' => $cid, 'missing photo' => $image_rid, 'avatar' => $contact['avatar']]);
$force = true;
}
}


+ 1
- 1
src/Model/Mail.php View File

@ -216,7 +216,7 @@ class Mail
if (count($images)) {
foreach ($images as $image) {
$image_rid = Photo::ridFromURI($image);
if ($image_rid) {
if (!empty($image_rid)) {
Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => local_user()]);
}
}


+ 3
- 3
src/Model/Photo.php View File

@ -605,12 +605,12 @@ class Photo
public static function ridFromURI($image_uri)
{
if (!stristr($image_uri, DI::baseUrl() . '/photo/')) {
return;
return '';
}
$image_uri = substr($image_uri, strrpos($image_uri, '/') + 1);
$image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
if (!strlen($image_uri)) {
return;
return '';
}
return $image_uri;
}
@ -642,7 +642,7 @@ class Photo
foreach ($images as $image) {
$image_rid = self::ridFromURI($image);
if (!$image_rid) {
if (empty($image_rid)) {
continue;
}


Loading…
Cancel
Save