Replace references to profile.name by user.username
This commit is contained in:
parent
7e971a2ec6
commit
e31d90eadb
|
@ -791,7 +791,7 @@ class Contact
|
||||||
* @param int $uid
|
* @param int $uid
|
||||||
* @param bool $update_avatar Force the avatar update
|
* @param bool $update_avatar Force the avatar update
|
||||||
* @return bool "true" if updated
|
* @return bool "true" if updated
|
||||||
* @throws HTTPException\InternalServerErrorException
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function updateSelfFromUserID(int $uid, bool $update_avatar = false): bool
|
public static function updateSelfFromUserID(int $uid, bool $update_avatar = false): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,6 +37,7 @@ use Friendica\DI;
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Security\PermissionSet\Entity\PermissionSet;
|
use Friendica\Security\PermissionSet\Entity\PermissionSet;
|
||||||
|
@ -97,6 +98,7 @@ class Profile
|
||||||
* @param integer $uid User id
|
* @param integer $uid User id
|
||||||
*
|
*
|
||||||
* @return boolean Whether update was successful
|
* @return boolean Whether update was successful
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public static function update(array $fields, int $uid): bool
|
public static function update(array $fields, int $uid): bool
|
||||||
{
|
{
|
||||||
|
@ -116,10 +118,6 @@ class Profile
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_owner['name'] != $owner['name']) {
|
|
||||||
User::update(['username' => $owner['name']], $uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
$profile_fields = ['postal-code', 'dob', 'prv_keywords', 'homepage'];
|
$profile_fields = ['postal-code', 'dob', 'prv_keywords', 'homepage'];
|
||||||
foreach ($profile_fields as $field) {
|
foreach ($profile_fields as $field) {
|
||||||
if ($old_owner[$field] != $owner[$field]) {
|
if ($old_owner[$field] != $owner[$field]) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module;
|
use Friendica\Module;
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
||||||
|
use Friendica\Network\HTTPException\InternalServerErrorException;
|
||||||
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
use Friendica\Security\TwoFactor\Model\AppSpecificPassword;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
|
@ -1331,30 +1332,15 @@ class User
|
||||||
* @param array $fields
|
* @param array $fields
|
||||||
* @param integer $uid
|
* @param integer $uid
|
||||||
* @return boolean
|
* @return boolean
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static function update(array $fields, int $uid): bool
|
public static function update(array $fields, int $uid): bool
|
||||||
{
|
{
|
||||||
$old_owner = self::getOwnerDataById($uid);
|
|
||||||
if (empty($old_owner)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DBA::update('user', $fields, ['uid' => $uid])) {
|
if (!DBA::update('user', $fields, ['uid' => $uid])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$update = Contact::updateSelfFromUserID($uid);
|
if (Contact::updateSelfFromUserID($uid)) {
|
||||||
|
|
||||||
$owner = self::getOwnerDataById($uid);
|
|
||||||
if (empty($owner)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($old_owner['name'] != $owner['name']) {
|
|
||||||
Profile::update(['name' => $owner['name']], $uid);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($update) {
|
|
||||||
Profile::publishUpdate($uid);
|
Profile::publishUpdate($uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -573,7 +573,7 @@ class Account extends BaseSettings
|
||||||
'$delete_openid' => ['delete_openid', DI::l10n()->t('Delete OpenID URL'), false, ''],
|
'$delete_openid' => ['delete_openid', DI::l10n()->t('Delete OpenID URL'), false, ''],
|
||||||
|
|
||||||
'$h_basic' => DI::l10n()->t('Basic Settings'),
|
'$h_basic' => DI::l10n()->t('Basic Settings'),
|
||||||
'$username' => ['username', DI::l10n()->t('Full Name:'), $username, '', false, 'autocomplete="off"'],
|
'$username' => ['username', DI::l10n()->t('Display name:'), $username, '', false, 'autocomplete="off"'],
|
||||||
'$email' => ['email', DI::l10n()->t('Email Address:'), $email, '', '', 'autocomplete="off"', 'email'],
|
'$email' => ['email', DI::l10n()->t('Email Address:'), $email, '', '', 'autocomplete="off"', 'email'],
|
||||||
'$timezone' => ['timezone_select', DI::l10n()->t('Your Timezone:'), Temporal::getTimezoneSelect($timezone), ''],
|
'$timezone' => ['timezone_select', DI::l10n()->t('Your Timezone:'), Temporal::getTimezoneSelect($timezone), ''],
|
||||||
'$language' => ['language', DI::l10n()->t('Your Language:'), $language, DI::l10n()->t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
|
'$language' => ['language', DI::l10n()->t('Your Language:'), $language, DI::l10n()->t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
|
||||||
|
|
|
@ -111,8 +111,8 @@ class Index extends BaseSettings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$name = trim($request['name'] ?? '');
|
$username = trim($request['username'] ?? '');
|
||||||
if (!$name) {
|
if (!$username) {
|
||||||
$this->systemMessages->addNotice($this->t('Display Name is required.'));
|
$this->systemMessages->addNotice($this->t('Display Name is required.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +141,10 @@ class Index extends BaseSettings
|
||||||
|
|
||||||
$this->profileFieldRepo->saveCollectionForUser($this->session->getLocalUserId(), $profileFieldsNew);
|
$this->profileFieldRepo->saveCollectionForUser($this->session->getLocalUserId(), $profileFieldsNew);
|
||||||
|
|
||||||
|
User::update(['username' => $username], $this->session->getLocalUserId());
|
||||||
|
|
||||||
$result = Profile::update(
|
$result = Profile::update(
|
||||||
[
|
[
|
||||||
'name' => $name,
|
|
||||||
'about' => $about,
|
'about' => $about,
|
||||||
'dob' => $dob,
|
'dob' => $dob,
|
||||||
'address' => $address,
|
'address' => $address,
|
||||||
|
@ -279,7 +280,7 @@ class Index extends BaseSettings
|
||||||
'$profpiclink' => '/profile/' . $owner['nickname'] . '/photos',
|
'$profpiclink' => '/profile/' . $owner['nickname'] . '/photos',
|
||||||
|
|
||||||
'$nickname' => $owner['nickname'],
|
'$nickname' => $owner['nickname'],
|
||||||
'$name' => ['name', $this->t('Display name:'), $owner['name']],
|
'$username' => ['username', $this->t('Display name:'), $owner['name']],
|
||||||
'$about' => ['about', $this->t('Description:'), $owner['about']],
|
'$about' => ['about', $this->t('Description:'), $owner['about']],
|
||||||
'$dob' => Temporal::getDateofBirthField($owner['dob'], $owner['timezone']),
|
'$dob' => Temporal::getDateofBirthField($owner['dob'], $owner['timezone']),
|
||||||
'$address' => ['address', $this->t('Street Address:'), $owner['address']],
|
'$address' => ['address', $this->t('Street Address:'), $owner['address']],
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<h2><a class="section-caption js-section-toggler" href="javascript:;">{{$l10n.personal_section}} »</a></h2>
|
<h2><a class="section-caption js-section-toggler" href="javascript:;">{{$l10n.personal_section}} »</a></h2>
|
||||||
<div class="js-section toggle-section-content hidden">
|
<div class="js-section toggle-section-content hidden">
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$name}}
|
{{include file="field_input.tpl" field=$username}}
|
||||||
|
|
||||||
{{include file="field_textarea.tpl" field=$about}}
|
{{include file="field_textarea.tpl" field=$about}}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
{{* for the $detailed_profile we use bootstraps collapsable panel-groups to have expandable groups *}}
|
{{* for the $detailed_profile we use bootstraps collapsable panel-groups to have expandable groups *}}
|
||||||
<div id="personal-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="personal">
|
<div id="personal-collapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="personal">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{{include file="field_input.tpl" field=$name}}
|
{{include file="field_input.tpl" field=$username}}
|
||||||
|
|
||||||
{{include file="field_textarea.tpl" field=$about}}
|
{{include file="field_textarea.tpl" field=$about}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user