Merge pull request #1008 from annando/update-avatar

Rearranged order for the "updateAvatar" function
This commit is contained in:
Hypolite Petovan 2020-07-25 08:33:51 -04:00 committed by GitHub
commit aa25a9d762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -203,7 +203,7 @@ function discourse_get_user($post, $hostaddr)
$avatar = $contact['photo']; $avatar = $contact['photo'];
unset($contact['photo']); unset($contact['photo']);
DBA::update('contact', $contact, ['id' => $contact['id']]); DBA::update('contact', $contact, ['id' => $contact['id']]);
Contact::updateAvatar($avatar, 0, $contact['id']); Contact::updateAvatar($contact['id'], $avatar);
$contact['photo'] = $avatar; $contact['photo'] = $avatar;
} }

View File

@ -1068,7 +1068,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
} }
if (!empty($contact->image->url)) { if (!empty($contact->image->url)) {
Contact::updateAvatar($contact->image->url, $uid, $contact_id); Contact::updateAvatar($contact_id, $contact->image->url);
} }
return $contact_id; return $contact_id;

View File

@ -1128,7 +1128,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
if (!empty($cid)) { if (!empty($cid)) {
DBA::update('contact', $fields, ['id' => $cid]); DBA::update('contact', $fields, ['id' => $cid]);
Contact::updateAvatar($avatar, 0, $cid); Contact::updateAvatar($cid, $avatar);
} }
$contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]); $contact = DBA::selectFirst('contact', [], ['uid' => $uid, 'alias' => "twitter::" . $data->id_str]);
@ -1160,7 +1160,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
Group::addMember(User::getDefaultGroup($uid), $contact_id); Group::addMember(User::getDefaultGroup($uid), $contact_id);
Contact::updateAvatar($avatar, $uid, $contact_id); Contact::updateAvatar($contact_id, $avatar);
} else { } else {
if ($contact["readonly"] || $contact["blocked"]) { if ($contact["readonly"] || $contact["blocked"]) {
Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", Logger::DEBUG); Logger::log("twitter_fetch_contact: Contact '" . $contact["nick"] . "' is blocked or readonly.", Logger::DEBUG);
@ -1176,7 +1176,7 @@ function twitter_fetch_contact($uid, $data, $create_user)
$update = true; $update = true;
} }
Contact::updateAvatar($avatar, $uid, $contact['id']); Contact::updateAvatar($contact['id'], $avatar);
if ($contact['name'] != $data->name) { if ($contact['name'] != $data->name) {
$fields['name-date'] = $fields['uri-date'] = DateTimeFormat::utcNow(); $fields['name-date'] = $fields['uri-date'] = DateTimeFormat::utcNow();