Merge remote-tracking branch 'upstream/2021.09-rc' into user-contact

This commit is contained in:
Michael 2021-09-18 20:27:24 +00:00
commit 3dddea96fa
30 changed files with 414 additions and 301 deletions

View file

@ -8,7 +8,6 @@ Adam Magness
Aditoo Aditoo
AgnesElisa AgnesElisa
Albert Albert
Alberto Díaz Tormo
Aleksandr "M.O.Z.G" Dikov Aleksandr "M.O.Z.G" Dikov
Alex Alex
Alexander An Alexander An
@ -31,7 +30,6 @@ Anthronaut
Antron Samurai Antron Samurai
Arian - Cazare Muncitori Arian - Cazare Muncitori
Asher Pen Asher Pen
Athalbert
aweiher aweiher
axelt axelt
balderino balderino
@ -98,6 +96,7 @@ Fabio Comuni
felixgilles felixgilles
Filip Bugaj Filip Bugaj
Filip H.F. "FiXato" Slagter Filip H.F. "FiXato" Slagter
Finn Dean
FlxAlbroscheit FlxAlbroscheit
foss foss
Francesco Apruzzese Francesco Apruzzese
@ -217,6 +216,7 @@ Ralf Thees
Ralph Ralph
Ratten Ratten
rcmaniac rcmaniac
RealKinetix
rebeka-catalina rebeka-catalina
René Wagner René Wagner
repat repat
@ -239,10 +239,12 @@ Senex Petrovic
Seth Seth
Silke Meyer Silke Meyer
Simon L'nu Simon L'nu
Simon Rupf
Simó Albert i Beltran Simó Albert i Beltran
softmetz softmetz
soko1 soko1
Spencer Dub Spencer Dub
SpencerDub
St John Karp St John Karp
Stanislav N. Stanislav N.
Steffen K9 Steffen K9
@ -256,6 +258,7 @@ szymon.filip
Sérgio Lima Sérgio Lima
Taekus Taekus
Tazman DeVille Tazman DeVille
Tealk
teho teho
Thecross Thecross
Thomas Thomas

View file

@ -419,7 +419,14 @@ function conversation(App $a, array $items, $mode, $update, $preview = false, $o
$tpl = 'search_item.tpl'; $tpl = 'search_item.tpl';
$uriids = [];
foreach ($items as $item) { foreach ($items as $item) {
if (in_array($item['uri-id'], $uriids)) {
continue;
}
$uriids[] = $item['uri-id'];
if (!visible_activity($item)) { if (!visible_activity($item)) {
continue; continue;
@ -1140,10 +1147,10 @@ function status_editor(App $a, array $x = [], $notes_cid = 0, $popup = false)
'$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : '', '$placeholdercategory' => Feature::isEnabled(local_user(), 'categories') ? DI::l10n()->t("Categories \x28comma-separated list\x29") : '',
'$scheduled_at' => Temporal::getDateTimeField( '$scheduled_at' => Temporal::getDateTimeField(
new DateTime(), new DateTime(),
DateTime::createFromFormat(DateTimeFormat::MYSQL, DateTimeFormat::local('now + 6 months')), new DateTime('now + 6 months'),
null, null,
DI::l10n()->t('Scheduled at'), DI::l10n()->t('Scheduled at'),
'scheduled_at', 'scheduled_at'
), ),
'$wait' => DI::l10n()->t('Please wait'), '$wait' => DI::l10n()->t('Please wait'),
'$permset' => DI::l10n()->t('Permission settings'), '$permset' => DI::l10n()->t('Permission settings'),

View file

@ -156,8 +156,8 @@ function follow_content(App $a)
DI::page()['aside'] = ''; DI::page()['aside'] = '';
if ($protocol != Protocol::PHANTOM) { if (!in_array($protocol, [Protocol::PHANTOM, Protocol::MAIL])) {
DI::page()['aside'] = Widget\VCard::getHTML(Contact::getByURL($contact['url'], false)); DI::page()['aside'] = Widget\VCard::getHTML($contact);
$o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'), $o .= Renderer::replaceMacros(Renderer::getMarkupTemplate('section_title.tpl'),
['$title' => DI::l10n()->t('Status Messages and Posts')] ['$title' => DI::l10n()->t('Status Messages and Posts')]

View file

@ -22,6 +22,8 @@
use Friendica\App; use Friendica\App;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\User;
use Friendica\Util\Proxy;
function msearch_post(App $a) function msearch_post(App $a)
{ {
@ -72,7 +74,7 @@ function msearch_post(App $a)
$results[] = [ $results[] = [
'name' => $search_result['name'], 'name' => $search_result['name'],
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'], 'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
'photo' => DI::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg', 'photo' => User::getAvatarUrlForId($search_result['uid'], Proxy::SIZE_THUMB),
'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords']) 'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords'])
]; ];
} }

View file

@ -1025,6 +1025,7 @@ function photos_content(App $a)
'$confirm' => DI::l10n()->t('Delete Album'), '$confirm' => DI::l10n()->t('Delete Album'),
'$confirm_url' => $drop_url, '$confirm_url' => $drop_url,
'$confirm_name' => 'dropalbum', '$confirm_name' => 'dropalbum',
'$confirm_value' => 'dropalbum',
'$cancel' => DI::l10n()->t('Cancel'), '$cancel' => DI::l10n()->t('Cancel'),
]); ]);
} }
@ -1131,6 +1132,7 @@ function photos_content(App $a)
'$confirm' => DI::l10n()->t('Delete Photo'), '$confirm' => DI::l10n()->t('Delete Photo'),
'$confirm_url' => $drop_url, '$confirm_url' => $drop_url,
'$confirm_name' => 'delete', '$confirm_name' => 'delete',
'$confirm_value' => 'delete',
'$cancel' => DI::l10n()->t('Cancel'), '$cancel' => DI::l10n()->t('Cancel'),
]); ]);
} }

View file

@ -5,6 +5,7 @@ bin/console.bat
bin/console.php bin/console.php
bin/daemon.php bin/daemon.php
bin/testargs.php bin/testargs.php
bin/wait-for-connection
bin/worker.php bin/worker.php
config/ config/
doc/ doc/

View file

@ -1461,8 +1461,12 @@ class Database
$row = $this->fetchFirst($sql, $condition); $row = $this->fetchFirst($sql, $condition);
// Ensure to always return either a "null" or a numeric value if (!isset($row['count'])) {
return is_numeric($row['count']) ? (int)$row['count'] : $row['count']; $this->logger->notice('Invalid count.', ['table' => $table, 'row' => $row, 'expression' => $expression, 'condition' => $condition_string, 'callstack' => System::callstack()]);
return 0;
} else {
return (int)$row['count'];
}
} }
/** /**

View file

@ -653,9 +653,9 @@ class Contact
'nick' => $user['nickname'], 'nick' => $user['nickname'],
'pubkey' => $user['pubkey'], 'pubkey' => $user['pubkey'],
'prvkey' => $user['prvkey'], 'prvkey' => $user['prvkey'],
'photo' => DI::baseUrl() . '/photo/profile/' . $user['uid'] . '.jpg', 'photo' => User::getAvatarUrlForId($user['uid']),
'thumb' => DI::baseUrl() . '/photo/avatar/' . $user['uid'] . '.jpg', 'thumb' => User::getAvatarUrlForId($user['uid'], Proxy::SIZE_THUMB),
'micro' => DI::baseUrl() . '/photo/micro/' . $user['uid'] . '.jpg', 'micro' => User::getAvatarUrlForId($user['uid'], Proxy::SIZE_MICRO),
'blocked' => 0, 'blocked' => 0,
'pending' => 0, 'pending' => 0,
'url' => DI::baseUrl() . '/profile/' . $user['nickname'], 'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
@ -768,7 +768,7 @@ class Contact
$fields['micro'] = self::getDefaultAvatar($fields, Proxy::SIZE_MICRO); $fields['micro'] = self::getDefaultAvatar($fields, Proxy::SIZE_MICRO);
} }
$fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix; $fields['avatar'] = User::getAvatarUrlForId($uid);
$fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP; $fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP;
$fields['unsearchable'] = !$profile['net-publish']; $fields['unsearchable'] = !$profile['net-publish'];
@ -794,8 +794,11 @@ class Contact
self::update($fields, ['uid' => 0, 'nurl' => $self['nurl']]); self::update($fields, ['uid' => 0, 'nurl' => $self['nurl']]);
// Update the profile // Update the profile
$fields = ['photo' => DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix, $fields = [
'thumb' => DI::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix]; 'photo' => User::getAvatarUrlForId($uid),
'thumb' => User::getAvatarUrlForId($uid, Proxy::SIZE_THUMB)
];
DBA::update('profile', $fields, ['uid' => $uid]); DBA::update('profile', $fields, ['uid' => $uid]);
} }
@ -2780,12 +2783,14 @@ class Contact
return null; return null;
} }
public static function removeFollower($importer, $contact) public static function removeFollower(array $contact)
{ {
if (($contact['rel'] == self::FRIEND) || ($contact['rel'] == self::SHARING)) { if (in_array($contact['rel'] ?? [], [self::FRIEND, self::SHARING])) {
self::update(['rel' => self::SHARING], ['id' => $contact['id']]); DBA::update('contact', ['rel' => self::SHARING], ['id' => $contact['id']]);
} else { } elseif (!empty($contact['id'])) {
self::remove($contact['id']); self::remove($contact['id']);
} else {
DI::logger()->info('Couldn\'t remove follower because of invalid contact array', ['contact' => $contact, 'callstack' => System::callstack()]);
} }
} }

View file

@ -547,7 +547,7 @@ class Media
return $attachments; return $attachments;
} }
$height = 0; $heights = [];
$selected = ''; $selected = '';
$previews = []; $previews = [];
@ -591,14 +591,11 @@ class Media
in_array($filetype, ['audio', 'image'])) { in_array($filetype, ['audio', 'image'])) {
$attachments['visual'][] = $medium; $attachments['visual'][] = $medium;
} elseif (($medium['type'] == self::VIDEO) || ($filetype == 'video')) { } elseif (($medium['type'] == self::VIDEO) || ($filetype == 'video')) {
if (strpos($medium['url'], $guid) !== false) { if (!empty($medium['height'])) {
// Peertube videos are delivered in many different resolutions. We pick a moderate one. // Peertube videos are delivered in many different resolutions. We pick a moderate one.
// By checking against the GUID we also ensure to only work this way on Peertube posts. // Since only Peertube provides a "height" parameter, this wouldn't be executed
// This wouldn't be executed when someone for example on Mastodon was sharing multiple videos in a single post. // when someone for example on Mastodon was sharing multiple videos in a single post.
if (empty($height) || ($height > $medium['height']) && ($medium['height'] >= 480)) { $heights[$medium['height']] = $medium['url'];
$height = $medium['height'];
$selected = $medium['url'];
}
$video[$medium['url']] = $medium; $video[$medium['url']] = $medium;
} else { } else {
$attachments['visual'][] = $medium; $attachments['visual'][] = $medium;
@ -607,13 +604,24 @@ class Media
$attachments['additional'][] = $medium; $attachments['additional'][] = $medium;
} }
} }
if (!empty($selected)) {
$attachments['visual'][] = $video[$selected]; if (!empty($heights)) {
unset($video[$selected]); ksort($heights);
foreach ($video as $element) { foreach ($heights as $height => $url) {
$attachments['additional'][] = $element; if (empty($selected) || $height <= 480) {
$selected = $url;
}
}
if (!empty($selected)) {
$attachments['visual'][] = $video[$selected];
unset($video[$selected]);
foreach ($video as $element) {
$attachments['additional'][] = $element;
}
} }
} }
return $attachments; return $attachments;
} }

View file

@ -840,6 +840,57 @@ class User
return false; return false;
} }
/**
* Get avatar link for given user id
*
* @param integer $uid user id
* @param string $size One of the ProxyUtils::SIZE_* constants
* @return string avatar link
*/
public static function getAvatarUrlForId(int $uid, string $size = ''):string
{
$url = DI::baseUrl() . '/photo/';
switch ($size) {
case Proxy::SIZE_MICRO:
$url .= 'micro/';
$scale = 6;
break;
case Proxy::SIZE_THUMB:
$url .= 'avatar/';
$scale = 5;
break;
default:
$url .= 'profile/';
$scale = 4;
break;
}
$updated = '';
$imagetype = IMAGETYPE_JPEG;
$photo = Photo::selectFirst(['type', 'created', 'edited', 'updated'], ["scale" => $scale, 'uid' => $uid, 'profile' => true]);
if (!empty($photo)) {
$updated = max($photo['created'], $photo['edited'], $photo['updated']);
switch ($photo['type']) {
case 'image/png':
$imagetype = IMAGETYPE_PNG;
break;
case 'image/gif':
$imagetype = IMAGETYPE_PNG;
break;
default:
$imagetype = IMAGETYPE_JPEG;
break;
}
}
return $url . $uid . image_type_to_extension($imagetype) . ($updated ? '?ts=' . strtotime($updated) : '');
}
/** /**
* Catch-all user creation function * Catch-all user creation function
* *
@ -1054,8 +1105,8 @@ class User
$insert_result = DBA::insert('profile', [ $insert_result = DBA::insert('profile', [
'uid' => $uid, 'uid' => $uid,
'name' => $username, 'name' => $username,
'photo' => DI::baseUrl() . "/photo/profile/{$uid}.jpg", 'photo' => self::getAvatarUrlForId($uid),
'thumb' => DI::baseUrl() . "/photo/avatar/{$uid}.jpg", 'thumb' => self::getAvatarUrlForId($uid, Proxy::SIZE_THUMB),
'publish' => $publish, 'publish' => $publish,
'net-publish' => $netpublish, 'net-publish' => $netpublish,
]); ]);

View file

@ -290,11 +290,17 @@ class Contact extends BaseModule
$contact_id = $data['user']; $contact_id = $data['user'];
} }
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id, 'uid' => [0, local_user()], 'deleted' => false]); if (!empty($data)) {
$contact = DBA::selectFirst('contact', [], [
'id' => $contact_id,
'uid' => [0, local_user()],
'deleted' => false
]);
// Don't display contacts that are about to be deleted // Don't display contacts that are about to be deleted
if ($contact['network'] == Protocol::PHANTOM) { if (DBA::isResult($contact) && !empty($contact['network']) && $contact['network'] == Protocol::PHANTOM) {
$contact = false; $contact = false;
}
} }
} }
@ -432,7 +438,8 @@ class Contact extends BaseModule
'$message' => DI::l10n()->t('Do you really want to delete this contact?'), '$message' => DI::l10n()->t('Do you really want to delete this contact?'),
'$confirm' => DI::l10n()->t('Yes'), '$confirm' => DI::l10n()->t('Yes'),
'$confirm_url' => DI::args()->getCommand(), '$confirm_url' => DI::args()->getCommand(),
'$confirm_name' => 'confirmed', '$confirm_name' => 't',
'$confirm_value' => BaseModule::getFormSecurityToken('contact_action'),
'$cancel' => DI::l10n()->t('Cancel'), '$cancel' => DI::l10n()->t('Cancel'),
]); ]);
} }

View file

@ -27,7 +27,6 @@ use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Notification; use Friendica\Model\Notification;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\HTTPException\ForbiddenException; use Friendica\Network\HTTPException\ForbiddenException;
@ -123,12 +122,7 @@ class Delegation extends BaseModule
//getting additinal information for each identity //getting additinal information for each identity
foreach ($identities as $key => $identity) { foreach ($identities as $key => $identity) {
$self = Contact::selectFirst(['id', 'updated'], ['uid' => $identity['uid'], 'self' => true]); $identities[$key]['thumb'] = User::getAvatarUrlForId($identity['uid'], Proxy::SIZE_THUMB);
if (!DBA::isResult($self)) {
continue;
}
$identities[$key]['thumb'] = Contact::getAvatarUrlForId($self['id'], Proxy::SIZE_THUMB, $self['updated']);
$identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getLoggedInUserNickname()); $identities[$key]['selected'] = ($identity['nickname'] === DI::app()->getLoggedInUserNickname());

View file

@ -167,13 +167,12 @@ class Compose extends BaseModule
'$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t('Categories (comma-separated list)') : ''), '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? DI::l10n()->t('Categories (comma-separated list)') : ''),
'$scheduled_at' => Temporal::getDateTimeField( '$scheduled_at' => Temporal::getDateTimeField(
new DateTime(), new DateTime(),
DateTime::createFromFormat(DateTimeFormat::MYSQL, DateTimeFormat::local('now + 6 months')), new DateTime('now + 6 months'),
null, null,
DI::l10n()->t('Scheduled at'), DI::l10n()->t('Scheduled at'),
'scheduled_at', 'scheduled_at'
), ),
'$title' => $title, '$title' => $title,
'$category' => $category, '$category' => $category,
'$body' => $body, '$body' => $body,

View file

@ -26,7 +26,6 @@ use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\User; use Friendica\Model\User;
/** /**
@ -81,7 +80,7 @@ class NoScrape extends BaseModule
$keywords = explode(',', $keywords); $keywords = explode(',', $keywords);
$json_info['fn'] = $profile['name']; $json_info['fn'] = $profile['name'];
$json_info['photo'] = Contact::getAvatarUrlForUrl($profile['url'], $profile['uid']); $json_info['photo'] = User::getAvatarUrlForId($profile['uid']);
$json_info['tags'] = $keywords; $json_info['tags'] = $keywords;
$json_info['language'] = $profile['language']; $json_info['language'] = $profile['language'];

View file

@ -31,6 +31,8 @@ use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model; use Friendica\Model;
use Friendica\Model\User;
use Friendica\Util\Proxy;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -372,7 +374,7 @@ class Register extends BaseModule
'source_mail' => $user['email'], 'source_mail' => $user['email'],
'source_nick' => $user['nickname'], 'source_nick' => $user['nickname'],
'source_link' => $base_url . '/admin/users/', 'source_link' => $base_url . '/admin/users/',
'source_photo' => $base_url . '/photo/avatar/' . $user['uid'] . '.jpg', 'source_photo' => User::getAvatarUrlForId($user['uid'], Proxy::SIZE_THUMB),
'show_in_notification_page' => false 'show_in_notification_page' => false
]); ]);
} }

View file

@ -26,7 +26,6 @@ use Friendica\Core\Hook;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\ActivityNamespace; use Friendica\Protocol\ActivityNamespace;
@ -197,7 +196,7 @@ class Xrd extends BaseModule
[ [
'rel' => 'http://webfinger.net/rel/avatar', 'rel' => 'http://webfinger.net/rel/avatar',
'type' => $avatar['type'], 'type' => $avatar['type'],
'href' => Contact::getAvatarUrlForUrl($owner['url'], $owner['uid']), 'href' => User::getAvatarUrlForId($owner['uid']),
], ],
[ [
'rel' => 'http://joindiaspora.com/seed_location', 'rel' => 'http://joindiaspora.com/seed_location',
@ -253,7 +252,7 @@ class Xrd extends BaseModule
'$hcard_url' => $baseURL . '/hcard/' . $owner['nickname'], '$hcard_url' => $baseURL . '/hcard/' . $owner['nickname'],
'$atom' => $owner['poll'], '$atom' => $owner['poll'],
'$poco_url' => $owner['poco'], '$poco_url' => $owner['poco'],
'$photo' => Contact::getAvatarUrlForUrl($owner['url'], $owner['uid']), '$photo' => User::getAvatarUrlForId($owner['uid']),
'$type' => $avatar['type'], '$type' => $avatar['type'],
'$salmon' => $baseURL . '/salmon/' . $owner['nickname'], '$salmon' => $baseURL . '/salmon/' . $owner['nickname'],
'$salmen' => $baseURL . '/salmon/' . $owner['nickname'] . '/mention', '$salmen' => $baseURL . '/salmon/' . $owner['nickname'] . '/mention',

View file

@ -101,7 +101,7 @@ class Probe
if (isset($data[$field])) { if (isset($data[$field])) {
if (in_array($field, $numeric_fields)) { if (in_array($field, $numeric_fields)) {
$newdata[$field] = (int)$data[$field]; $newdata[$field] = (int)$data[$field];
} else { } else {
$newdata[$field] = $data[$field]; $newdata[$field] = $data[$field];
} }
} elseif (!in_array($field, $numeric_fields)) { } elseif (!in_array($field, $numeric_fields)) {
@ -2229,11 +2229,11 @@ class Probe
$data = [ $data = [
'name' => $profile['name'], 'nick' => $profile['nick'], 'guid' => $approfile['diaspora:guid'] ?? '', 'name' => $profile['name'], 'nick' => $profile['nick'], 'guid' => $approfile['diaspora:guid'] ?? '',
'url' => $profile['url'], 'addr' => $profile['addr'], 'alias' => $profile['alias'], 'url' => $profile['url'], 'addr' => $profile['addr'], 'alias' => $profile['alias'],
'photo' => Contact::getAvatarUrlForId($profile['id'], '', $profile['updated']), 'photo' => User::getAvatarUrlForId($uid),
'header' => $profile['header'] ? Contact::getHeaderUrlForId($profile['id'], $profile['updated']) : '', 'header' => $profile['header'] ? Contact::getHeaderUrlForId($profile['id'], $profile['updated']) : '',
'account-type' => $profile['contact-type'], 'community' => ($profile['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY), 'account-type' => $profile['contact-type'], 'community' => ($profile['contact-type'] == User::ACCOUNT_TYPE_COMMUNITY),
'keywords' => $profile['keywords'], 'location' => $profile['location'], 'about' => $profile['about'], 'keywords' => $profile['keywords'], 'location' => $profile['location'], 'about' => $profile['about'],
'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'], 'xmpp' => $profile['xmpp'], 'matrix' => $profile['matrix'],
'hide' => !$profile['net-publish'], 'batch' => '', 'notify' => $profile['notify'], 'hide' => !$profile['net-publish'], 'batch' => '', 'notify' => $profile['notify'],
'poll' => $profile['poll'], 'request' => $profile['request'], 'confirm' => $profile['confirm'], 'poll' => $profile['poll'], 'request' => $profile['request'], 'confirm' => $profile['confirm'],
'subscribe' => $approfile['generator']['url'] . '/follow?url={uri}', 'poco' => $profile['poco'], 'subscribe' => $approfile['generator']['url'] . '/follow?url={uri}', 'poco' => $profile['poco'],

View file

@ -64,10 +64,14 @@ class ActivityPub
'diaspora' => 'https://diasporafoundation.org/ns/', 'diaspora' => 'https://diasporafoundation.org/ns/',
'litepub' => 'http://litepub.social/ns#', 'litepub' => 'http://litepub.social/ns#',
'toot' => 'http://joinmastodon.org/ns#', 'toot' => 'http://joinmastodon.org/ns#',
'schema' => 'http://schema.org#',
'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag', 'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
'directMessage' => 'litepub:directMessage', 'directMessage' => 'litepub:directMessage',
'discoverable' => 'toot:discoverable']]; 'discoverable' => 'toot:discoverable',
'PropertyValue' => 'schema:PropertyValue',
'value' => 'schema:value',
]];
const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone']; const ACCOUNT_TYPES = ['Person', 'Organization', 'Service', 'Group', 'Application', 'Tombstone'];
/** /**
* Checks if the web request is done for the AP protocol * Checks if the web request is done for the AP protocol

View file

@ -1102,7 +1102,7 @@ class Processor
return; return;
} }
Contact::removeFollower($owner, $contact); Contact::removeFollower($contact);
Logger::info('Undo following request', ['contact' => $cid, 'user' => $uid]); Logger::info('Undo following request', ['contact' => $cid, 'user' => $uid]);
} }

View file

@ -370,7 +370,7 @@ class Transmitter
'owner' => $owner['url'], 'owner' => $owner['url'],
'publicKeyPem' => $owner['pubkey']]; 'publicKeyPem' => $owner['pubkey']];
$data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox']; $data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
$data['icon'] = ['type' => 'Image', 'url' => Contact::getAvatarUrlForId($owner['id'], '', $owner['updated'])]; $data['icon'] = ['type' => 'Image', 'url' => User::getAvatarUrlForId($uid)];
$resourceid = Photo::ridFromURI($owner['photo']); $resourceid = Photo::ridFromURI($owner['photo']);
if (!empty($resourceid)) { if (!empty($resourceid)) {
@ -392,6 +392,20 @@ class Transmitter
} }
} }
$custom_fields = [];
foreach (DI::profileField()->selectByContactId(0, $uid) as $profile_field) {
$custom_fields[] = [
'type' => 'PropertyValue',
'name' => $profile_field->label,
'value' => BBCode::convertForUriId($owner['uri-id'], $profile_field->value)
];
};
if (!empty($custom_fields)) {
$data['attachment'] = $custom_fields;
}
$data['generator'] = self::getService(); $data['generator'] = self::getService();
// tags: https://kitty.town/@inmysocks/100656097926961126.json // tags: https://kitty.town/@inmysocks/100656097926961126.json

View file

@ -449,7 +449,7 @@ class DFRN
$attributes = ["rel" => "photo", "type" => "image/jpeg", $attributes = ["rel" => "photo", "type" => "image/jpeg",
"media:width" => Proxy::PIXEL_SMALL, "media:height" => Proxy::PIXEL_SMALL, "media:width" => Proxy::PIXEL_SMALL, "media:height" => Proxy::PIXEL_SMALL,
"href" => Contact::getAvatarUrlForId($owner['id'], Proxy::SIZE_SMALL, $owner['updated'])]; "href" => User::getAvatarUrlForId($owner['uid'], Proxy::SIZE_SMALL)];
if (!$public || !$hide) { if (!$public || !$hide) {
$attributes["dfrn:updated"] = $picdate; $attributes["dfrn:updated"] = $picdate;
@ -1584,7 +1584,7 @@ class DFRN
} }
if ($activity->match($item["verb"], Activity::UNFOLLOW)) { if ($activity->match($item["verb"], Activity::UNFOLLOW)) {
Logger::log("Lost follower"); Logger::log("Lost follower");
Contact::removeFollower($importer, $contact, $item); Contact::removeFollower($contact);
return false; return false;
} }
if ($activity->match($item["verb"], Activity::REQ_FRIEND)) { if ($activity->match($item["verb"], Activity::REQ_FRIEND)) {

View file

@ -2211,7 +2211,7 @@ class Diaspora
return true; return true;
} else { } else {
Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG); Logger::log("Author ".$author." doesn't want to follow us anymore.", Logger::DEBUG);
Contact::removeFollower($importer, $contact); Contact::removeFollower($contact);
return true; return true;
} }
} }

View file

@ -965,7 +965,7 @@ class Feed
XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]); XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
XML::addElement($doc, $root, "title", $title); XML::addElement($doc, $root, "title", $title);
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename'))); XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
XML::addElement($doc, $root, "logo", Contact::getAvatarUrlForId($owner['id'], Proxy::SIZE_SMALL, $owner['updated'])); XML::addElement($doc, $root, "logo", User::getAvatarUrlForId($owner['uid'], Proxy::SIZE_SMALL));
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM)); XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
$author = self::addAuthor($doc, $owner); $author = self::addAuthor($doc, $owner);

View file

@ -471,7 +471,7 @@ class OStatus
if ($item["verb"] == Activity::O_UNFOLLOW) { if ($item["verb"] == Activity::O_UNFOLLOW) {
$dummy = null; $dummy = null;
Contact::removeFollower($importer, $contact, $item, $dummy); Contact::removeFollower($contact);
continue; continue;
} }
@ -1275,7 +1275,7 @@ class OStatus
XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]); XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
XML::addElement($doc, $root, "title", $title); XML::addElement($doc, $root, "title", $title);
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename'))); XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], DI::config()->get('config', 'sitename')));
XML::addElement($doc, $root, "logo", Contact::getAvatarUrlForId($owner['id'], ProxyUtils::SIZE_SMALL, $owner['updated'])); XML::addElement($doc, $root, "logo", User::getAvatarUrlForId($owner['uid'], ProxyUtils::SIZE_SMALL));
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM)); XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
$author = self::addAuthor($doc, $owner, true); $author = self::addAuthor($doc, $owner, true);
@ -1432,7 +1432,7 @@ class OStatus
"type" => "image/jpeg", // To-Do? "type" => "image/jpeg", // To-Do?
"media:width" => ProxyUtils::PIXEL_SMALL, "media:width" => ProxyUtils::PIXEL_SMALL,
"media:height" => ProxyUtils::PIXEL_SMALL, "media:height" => ProxyUtils::PIXEL_SMALL,
"href" => Contact::getAvatarUrlForId($owner['id'], ProxyUtils::SIZE_SMALL, $owner['updated'])]; "href" => User::getAvatarUrlForId($owner['uid'], ProxyUtils::SIZE_SMALL)];
XML::addElement($doc, $author, "link", "", $attributes); XML::addElement($doc, $author, "link", "", $attributes);
if (isset($owner["thumb"])) { if (isset($owner["thumb"])) {
@ -1441,7 +1441,7 @@ class OStatus
"type" => "image/jpeg", // To-Do? "type" => "image/jpeg", // To-Do?
"media:width" => ProxyUtils::PIXEL_THUMB, "media:width" => ProxyUtils::PIXEL_THUMB,
"media:height" => ProxyUtils::PIXEL_THUMB, "media:height" => ProxyUtils::PIXEL_THUMB,
"href" => Contact::getAvatarUrlForId($owner['id'], ProxyUtils::SIZE_THUMB, $owner['updated'])]; "href" => User::getAvatarUrlForId($owner['uid'], ProxyUtils::SIZE_THUMB)];
XML::addElement($doc, $author, "link", "", $attributes); XML::addElement($doc, $author, "link", "", $attributes);
} }

File diff suppressed because it is too large Load diff

View file

@ -1326,6 +1326,8 @@ $a->strings["Don't embed private images in posts"] = "Ne ágyazzon be személyes
$a->strings["Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while."] = "Ne cserélje ki a bejegyzésekben lévő helyileg kiszolgált személyes fényképeket a kép beágyazott másolatával. Ez azt jelenti, hogy a személyes fényképeket tartalmazó bejegyzéseket fogadó partnereknek hitelesíteniük kell magukat és be kell tölteniük minden egyes képet, ami eltarthat egy ideig."; $a->strings["Don't replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while."] = "Ne cserélje ki a bejegyzésekben lévő helyileg kiszolgált személyes fényképeket a kép beágyazott másolatával. Ez azt jelenti, hogy a személyes fényképeket tartalmazó bejegyzéseket fogadó partnereknek hitelesíteniük kell magukat és be kell tölteniük minden egyes képet, ami eltarthat egy ideig.";
$a->strings["Explicit Content"] = "Felnőtteknek szánt tartalom"; $a->strings["Explicit Content"] = "Felnőtteknek szánt tartalom";
$a->strings["Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page."] = "Állítsa be ezt annak közléséhez, hogy a csomópontját főként felnőtteknek szóló tartalomhoz használják, ami lehet, hogy nem alkalmas kiskorúak számára. Ez az információ közzé lesz téve a csomópont információiban, és használhatja például a globális könyvtár is, hogy kiszűrje a csomópontját a csatlakozáshoz felajánlott csomópontok listájából. Ezenkívül egy megjegyzés is meg lesz jelenítve ezzel kapcsolatban a felhasználó regisztrációs oldalán."; $a->strings["Set this to announce that your node is used mostly for explicit content that might not be suited for minors. This information will be published in the node information and might be used, e.g. by the global directory, to filter your node from listings of nodes to join. Additionally a note about this will be shown at the user registration page."] = "Állítsa be ezt annak közléséhez, hogy a csomópontját főként felnőtteknek szóló tartalomhoz használják, ami lehet, hogy nem alkalmas kiskorúak számára. Ez az információ közzé lesz téve a csomópont információiban, és használhatja például a globális könyvtár is, hogy kiszűrje a csomópontját a csatlakozáshoz felajánlott csomópontok listájából. Ezenkívül egy megjegyzés is meg lesz jelenítve ezzel kapcsolatban a felhasználó regisztrációs oldalán.";
$a->strings["Proxify external content"] = "Külső tartalom proxyzása";
$a->strings["Route external content via the proxy functionality. This is used for example for some OEmbed accesses and in some other rare cases."] = "Külső tartalom átirányítása a proxy funkción keresztül. Ezt például néhány OEmbed-hozzáférésnél és egyéb ritka esetekben használják.";
$a->strings["Allow Users to set remote_self"] = "Távoli önmaguk beállításának engedélyezése a felhasználóknak"; $a->strings["Allow Users to set remote_self"] = "Távoli önmaguk beállításának engedélyezése a felhasználóknak";
$a->strings["With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream."] = "Ennek bejelölésével minden egyes felhasználó számára engedélyezett, hogy az egyes partnereket távoli önmagukként jelöljék meg a partner javítása párbeszédablakban. Ezen jelző beállítása egy partnernél a tartalom minden egyes beküldésének tükrözését okozza a felhasználók adatfolyamában."; $a->strings["With checking this, every user is allowed to mark every contact as a remote_self in the repair contact dialog. Setting this flag on a contact causes mirroring every posting of that contact in the users stream."] = "Ennek bejelölésével minden egyes felhasználó számára engedélyezett, hogy az egyes partnereket távoli önmagukként jelöljék meg a partner javítása párbeszédablakban. Ezen jelző beállítása egy partnernél a tartalom minden egyes beküldésének tükrözését okozza a felhasználók adatfolyamában.";
$a->strings["Enable multiple registrations"] = "Többszörös regisztrációk engedélyezése"; $a->strings["Enable multiple registrations"] = "Többszörös regisztrációk engedélyezése";

View file

@ -4,8 +4,8 @@
<h3 id="confirm-message">{{$message}}</h3> <h3 id="confirm-message">{{$message}}</h3>
<input class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm}}" /> <button class="confirm-button" id="confirm-submit-button" type="submit" name="{{$confirm_name}}" value="{{$confirm_value}}">{{$confirm}}</button>
<input class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel}}" /> <button class="confirm-button" id="confirm-cancel-button" type="submit" name="canceled" value="{{$cancel}}">{{$cancel}}</button>
</form> </form>
</center> </center>

View file

@ -3,7 +3,7 @@
<div id="confirm-message">{{$message}}</div> <div id="confirm-message">{{$message}}</div>
<div class="form-group pull-right settings-submit-wrapper"> <div class="form-group pull-right settings-submit-wrapper">
<button type="submit" name="{{$confirm_name}}" id="confirm-submit-button" class="btn btn-primary confirm-button" value="{{$confirm}}">{{$confirm}}</button> <button type="submit" name="{{$confirm_name}}" id="confirm-submit-button" class="btn btn-primary confirm-button" value="{{$confirm_value}}">{{$confirm}}</button>
<button type="submit" name="canceled" id="confirm-cancel-button" class="btn confirm-button" data-dismiss="modal">{{$cancel}}</button> <button type="submit" name="canceled" value="{{$cancel}} id="confirm-cancel-button" class="btn confirm-button" data-dismiss="modal">{{$cancel}}</button>
</div> </div>
</form> </form>

View file

@ -27,7 +27,7 @@
{{/if}} {{/if}}
<li role="presentation"><a role="menuitem" href="{{$contact_actions.block.url}}" title="{{$contact_actions.block.title}}">{{$contact_actions.block.label}}</a></li> <li role="presentation"><a role="menuitem" href="{{$contact_actions.block.url}}" title="{{$contact_actions.block.title}}">{{$contact_actions.block.label}}</a></li>
<li role="presentation"><a role="menuitem" href="{{$contact_actions.ignore.url}}" title="{{$contact_actions.ignore.title}}">{{$contact_actions.ignore.label}}</a></li> <li role="presentation"><a role="menuitem" href="{{$contact_actions.ignore.url}}" title="{{$contact_actions.ignore.title}}">{{$contact_actions.ignore.label}}</a></li>
{{if $contact_actions.delete.url}}<li role="presentation"><button role="menuitem" type="button" class="btn-link" title="{{$contact_actions.delete.title}}" onclick="addToModal('{{$contact_actions.delete.url}}?confirm=1');">{{$contact_actions.delete.label}}</button></li>{{/if}} {{if $contact_actions.delete.url}}<li role="presentation"><button role="menuitem" type="button" class="btn-link" title="{{$contact_actions.delete.title}}" onclick="addToModal('{{$contact_actions.delete.url}}&confirm=1');">{{$contact_actions.delete.label}}</button></li>{{/if}}
</ul> </ul>
</li> </li>
</ul> </ul>
@ -76,7 +76,7 @@
<div id="contact-edit-profile-collapse" class="panel-body panel-collapse collapse in" role="tabpanel" aria-labelledby="contact-edit-profile"> <div id="contact-edit-profile-collapse" class="panel-body panel-collapse collapse in" role="tabpanel" aria-labelledby="contact-edit-profile">
<div class="section-content-tools-wrapper"> <div class="section-content-tools-wrapper">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$profileurllabel}}</div><a target="blank" href="{{$url}}">{{$profileurl}}</a> <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12 text-muted">{{$profileurllabel}}</div><a target="blank" href="{{$profileurl}}">{{$profileurl}}</a>
</div> </div>
{{if $location}} {{if $location}}

View file

@ -48,7 +48,7 @@
</div> {{* End of contact-edit-status-wrapper *}} </div> {{* End of contact-edit-status-wrapper *}}
{{* Some information about the contact from the profile *}} {{* Some information about the contact from the profile *}}
<dl><dt>{{$profileurllabel}}</dt><dd><a target="blank" href="{{$url}}">{{$profileurl}}</a></dd></dl> <dl><dt>{{$profileurllabel}}</dt><dd><a target="blank" href="{{$profileurl}}">{{$profileurl}}</a></dd></dl>
{{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location nofilter}}</dd></dl>{{/if}} {{if $location}}<dl><dt>{{$location_label}}</dt><dd>{{$location nofilter}}</dd></dl>{{/if}}
{{if $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}} {{if $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}}
{{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}} {{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}}