[RemoteFollow] Fix location display

This commit is contained in:
Alexei Sorokin 2020-07-22 19:49:24 +03:00 committed by Diogo Peralta Cordeiro
parent 2894eb9ed2
commit b79d97c4e1

View File

@ -100,12 +100,14 @@ class RemoteFollowSubAction extends Action
$this->elementStart('ul', 'form_data'); $this->elementStart('ul', 'form_data');
$this->elementStart('li'); $this->elementStart('li');
$this->input('profile', $this->input(
'profile',
// TRANS: Field label for a field that takes an user address. // TRANS: Field label for a field that takes an user address.
_m('Subscribe to'), _m('Subscribe to'),
$this->uri, $this->uri,
// TRANS: Tooltip for field label "Subscribe to". // TRANS: Tooltip for field label "Subscribe to".
_m('User\'s address, like nickname@example.com or http://example.net/nickname.')); _m('User\'s address, like nickname@example.com or http://example.net/nickname.')
);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementEnd('ul'); $this->elementEnd('ul');
// TRANS: Button text. // TRANS: Button text.
@ -138,13 +140,15 @@ class RemoteFollowSubAction extends Action
$this->elementStart('fieldset'); $this->elementStart('fieldset');
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->hidden('profile', $this->uri); $this->hidden('profile', $this->uri);
$this->submit('submit', $this->submit(
'submit',
// TRANS: Button text. // TRANS: Button text.
_m('BUTTON', 'Confirm'), _m('BUTTON', 'Confirm'),
'submit', 'submit',
null, null,
// TRANS: Tooltip for button "Confirm". // TRANS: Tooltip for button "Confirm".
_m('Subscribe to this user')); _m('Subscribe to this user')
);
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
$this->elementEnd('li'); $this->elementEnd('li');
@ -160,10 +164,12 @@ class RemoteFollowSubAction extends Action
public function preview(): bool public function preview(): bool
{ {
if ($this->scoped->isSubscribed($this->profile)) { if ($this->scoped->isSubscribed($this->profile)) {
$this->element('div', $this->element(
'div',
['class' => 'error'], ['class' => 'error'],
// TRANS: Extra paragraph in remote profile view when already subscribed. // TRANS: Extra paragraph in remote profile view when already subscribed.
_m('You are already subscribed to this user.')); _m('You are already subscribed to this user.')
);
$ok = false; $ok = false;
} else { } else {
$ok = true; $ok = true;
@ -171,10 +177,12 @@ class RemoteFollowSubAction extends Action
$avatarUrl = $this->profile->avatarUrl(AVATAR_PROFILE_SIZE); $avatarUrl = $this->profile->avatarUrl(AVATAR_PROFILE_SIZE);
$this->showEntity($this->profile, $this->showEntity(
$this->profile,
$this->profile->getUrl(), $this->profile->getUrl(),
$avatarUrl, $avatarUrl,
$this->profile->getDescription()); $this->profile->getDescription()
);
return $ok; return $ok;
} }
@ -209,9 +217,10 @@ class RemoteFollowSubAction extends Action
$this->elementEnd('div'); $this->elementEnd('div');
} }
if (!is_null($location)) { $location_name = (is_null($location) ? null : $location->getName());
if (!is_null($location_name)) {
$this->elementStart('div', 'label entity_location'); $this->elementStart('div', 'label entity_location');
$this->text($location); $this->text($location_name);
$this->elementEnd('div'); $this->elementEnd('div');
} }
@ -373,7 +382,7 @@ class RemoteFollowSubAction extends Action
* *
* @return string * @return string
*/ */
function selfLink(): string public function selfLink(): string
{ {
return common_local_url('RemoteFollowSub'); return common_local_url('RemoteFollowSub');
} }