Merge pull request #10588 from annando/matrix

Matrix addresses can be entered in the profile
This commit is contained in:
Hypolite Petovan 2021-08-09 10:56:12 -04:00 committed by GitHub
commit 3e1e3c8b3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 375 additions and 256 deletions

View file

@ -609,6 +609,8 @@ class Contact extends BaseModule
'$location_label' => DI::l10n()->t('Location:'),
'$xmpp' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['xmpp']),
'$xmpp_label' => DI::l10n()->t('XMPP:'),
'$matrix' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['matrix']),
'$matrix_label' => DI::l10n()->t('Matrix:'),
'$about' => BBCode::convertForUriId($contact['uri-id'] ?? 0, $contact['about'], BBCode::EXTERNAL),
'$about_label' => DI::l10n()->t('About:'),
'$keywords' => $contact['keywords'],

View file

@ -120,7 +120,7 @@ class NoScrape extends BaseModule
$json_info['last-activity'] = date('o-W', $last_active);
//These are optional fields.
$profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name'];
$profile_fields = ['about', 'locality', 'region', 'postal-code', 'country-name', 'xmpp', 'matrix'];
foreach ($profile_fields as $field) {
if (!empty($profile[$field])) {
$json_info["$field"] = $profile[$field];

View file

@ -177,6 +177,10 @@ class Profile extends BaseProfile
$basic_fields += self::buildField('xmpp', DI::l10n()->t('XMPP:'), $profile['xmpp']);
}
if ($profile['matrix']) {
$basic_fields += self::buildField('matrix', DI::l10n()->t('Matrix:'), $profile['matrix']);
}
if ($profile['homepage']) {
$basic_fields += self::buildField('homepage', DI::l10n()->t('Homepage:'), HTML::toLink($profile['homepage']));
}

View file

@ -95,6 +95,7 @@ class Index extends BaseSettings
$pub_keywords = self::cleanKeywords(Strings::escapeTags(trim($_POST['pub_keywords'])));
$prv_keywords = self::cleanKeywords(Strings::escapeTags(trim($_POST['prv_keywords'])));
$xmpp = Strings::escapeTags(trim($_POST['xmpp']));
$matrix = Strings::escapeTags(trim($_POST['matrix']));
$homepage = Strings::escapeTags(trim($_POST['homepage']));
if ((strpos($homepage, 'http') !== 0) && (strlen($homepage))) {
// neither http nor https in URL, add them
@ -123,6 +124,7 @@ class Index extends BaseSettings
'postal-code' => $postal_code,
'country-name' => $country_name,
'xmpp' => $xmpp,
'matrix' => $matrix,
'homepage' => $homepage,
'pub_keywords' => $pub_keywords,
'prv_keywords' => $prv_keywords,
@ -242,7 +244,8 @@ class Index extends BaseSettings
'$postal_code' => ['postal_code', DI::l10n()->t('Postal/Zip Code:'), $profile['postal-code']],
'$country_name' => ['country_name', DI::l10n()->t('Country:'), $profile['country-name']],
'$age' => ((intval($profile['dob'])) ? '(' . DI::l10n()->t('Age: ') . DI::l10n()->tt('%d year old', '%d years old', Temporal::getAgeByTimezone($profile['dob'], $a->user['timezone'])) . ')' : ''),
'$xmpp' => ['xmpp', DI::l10n()->t('XMPP (Jabber) address:'), $profile['xmpp'], DI::l10n()->t('The XMPP address will be propagated to your contacts so that they can follow you.')],
'$xmpp' => ['xmpp', DI::l10n()->t('XMPP (Jabber) address:'), $profile['xmpp'], DI::l10n()->t('The XMPP address will be published so that people can follow you there.')],
'$matrix' => ['matrix', DI::l10n()->t('Matrix (Element) address:'), $profile['matrix'], DI::l10n()->t('The Matrix address will be published so that people can follow you there.')],
'$homepage' => ['homepage', DI::l10n()->t('Homepage URL:'), $profile['homepage']],
'$pub_keywords' => ['pub_keywords', DI::l10n()->t('Public Keywords:'), $profile['pub_keywords'], DI::l10n()->t('(Used for suggesting potential friends, can be seen by others)')],
'$prv_keywords' => ['prv_keywords', DI::l10n()->t('Private Keywords:'), $profile['prv_keywords'], DI::l10n()->t('(Used for searching profiles, never shown to others)')],