Fix connection acknowledgement not appearing on contact page

- Remove obsolete template variables
- Move contact_edit vier template to base template
This commit is contained in:
Hypolite Petovan 2023-01-20 12:13:17 -05:00
parent 0681f94334
commit dcfb8bb73e
3 changed files with 34 additions and 145 deletions

View File

@ -197,7 +197,7 @@ class Profile extends BaseModule
Contact\User::setIgnored($contact['id'], DI::userSession()->getLocalUserId(), true);
$message = $this->t('Contact has been ignored');
}
// @TODO: add $this->localRelationship->save($localRelationship);
DI::sysmsg()->addInfo($message);
}
@ -213,7 +213,7 @@ class Profile extends BaseModule
Contact\User::setCollapsed($contact['id'], DI::userSession()->getLocalUserId(), true);
$message = $this->t('Contact has been collapsed');
}
// @TODO: add $this->localRelationship->save($localRelationship);
DI::sysmsg()->addInfo($message);
}
@ -239,9 +239,6 @@ class Profile extends BaseModule
'$baseurl' => $this->baseUrl->get(true),
]);
$contact['blocked'] = Contact\User::isBlocked($contact['id'], DI::userSession()->getLocalUserId());
$contact['readonly'] = Contact\User::isIgnored($contact['id'], DI::userSession()->getLocalUserId());
switch ($localRelationship->rel) {
case Contact::FRIEND: $relation_text = $this->t('You are mutual friends with %s', $contact['name']); break;
case Contact::FOLLOWER: $relation_text = $this->t('You are sharing with %s', $contact['name']); break;
@ -361,16 +358,13 @@ class Profile extends BaseModule
'$last_update' => $last_update,
'$udnow' => $this->t('Update now'),
'$contact_id' => $contact['id'],
'$block_text' => ($contact['blocked'] ? $this->t('Unblock') : $this->t('Block')),
'$ignore_text' => ($contact['readonly'] ? $this->t('Unignore') : $this->t('Ignore')),
'$insecure' => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
'$info' => $localRelationship->info,
'$cinfo' => ['info', '', $localRelationship->info, ''],
'$blocked' => ($contact['blocked'] ? $this->t('Currently blocked') : ''),
'$ignored' => ($contact['readonly'] ? $this->t('Currently ignored') : ''),
'$collapsed' => (Contact\User::isCollapsed($contact['id'], DI::userSession()->getLocalUserId()) ? $this->t('Currently collapsed') : ''),
'$pending' => $localRelationship->pending ? $this->t('Awaiting connection acknowledge') : '',
'$blocked' => $localRelationship->blocked ? $this->t('Currently blocked') : '',
'$ignored' => $localRelationship->ignored ? $this->t('Currently ignored') : '',
'$collapsed' => $localRelationship->collapsed ? $this->t('Currently collapsed') : '',
'$archived' => ($contact['archive'] ? $this->t('Currently archived') : ''),
'$pending' => ($contact['pending'] ? $this->t('Awaiting connection acknowledge') : ''),
'$insecure' => (in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::MAIL, Protocol::DIASPORA]) ? '' : $insecure),
'$cinfo' => ['info', '', $localRelationship->info, ''],
'$hidden' => ['hidden', $this->t('Hide this contact from others'), $localRelationship->hidden, $this->t('Replies/likes to your public posts <strong>may</strong> still be visible')],
'$notify_new_posts' => ['notify_new_posts', $this->t('Notification for new posts'), ($localRelationship->notifyNewPosts), $this->t('Send a notification of every new post of this contact')],
'$fetch_further_information' => $fetch_further_information,

View File

@ -1,3 +1,4 @@
<div id="contact-edit-wrapper">
{{* Insert Tab-Nav *}}
@ -12,7 +13,7 @@
{{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}}
<div id="contact-edit-actions">
<a class="btn" rel="#contact-actions-menu" href="#" id="contact-edit-actions-button">{{$contact_action_button}}</a>
<button class="btn" id="contact-edit-actions-button">{{$contact_action_button}}</button>
<ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
{{if $contact_actions.follow}}<li role="menuitem"><a href="{{$contact_actions.follow.url}}" title="{{$contact_actions.follow.title}}">{{$contact_actions.follow.label}}</a></li>{{/if}}
@ -23,7 +24,6 @@
<li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.collapse.title}}" onclick="window.location.href='{{$contact_actions.collapse.url}}'; return false;">{{$contact_actions.collapse.label}}</a></li>
{{if $contact_actions.revoke_follow.url}}<li role="menuitem"><a href="{{$contact_actions.revoke_follow.url}}" title="{{$contact_actions.revoke_follow.title}}">{{$contact_actions.revoke_follow.label}}</a></li>{{/if}}
</ul>
</div>
@ -34,9 +34,9 @@
{{if $poll_enabled}}
<li><div id="contact-edit-last-update-text">{{$lastupdtext}} <span id="contact-edit-last-updated">{{$last_update}}</span></div>
{{if $poll_interval}}
<span id="contact-edit-poll-text">{{$updpub}}</span> {{$poll_interval nofilter}}
{{/if}}
{{if $poll_interval}}
<span id="contact-edit-poll-text">{{$updpub}}</span> {{$poll_interval nofilter}}
{{/if}}
</li>
{{/if}}
@ -45,13 +45,12 @@
{{if $blocked && !$pending}}<li><div id="block-message">{{$blocked}}</div></li>{{/if}}
{{if $pending}}<li><div id="pending-message">{{$pending}}</div></li>{{/if}}
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $collapsed}}<li><div id="collapse-message">{{$collapsed}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
{{* 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 $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}}
{{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}}
@ -63,40 +62,39 @@
<hr />
{{if $contact_settings_label}}
{{if $contact_settings_label}}
<h4 id="contact-edit-settings-label" class="fakelink" onclick="openClose('contact-edit-settings')">{{$contact_settings_label}}</h4>
<div id="contact-edit-settings">
<input type="hidden" name="contact_id" value="{{$contact_id}}">
<div id="contact-edit-end"></div>
{{include file="field_checkbox.tpl" field=$notify_new_posts}}
{{if $fetch_further_information}}
{{include file="field_select.tpl" field=$fetch_further_information}}
{{if $fetch_further_information.2 == 2 || $fetch_further_information.2 == 3}} {{include file="field_textarea.tpl" field=$ffi_keyword_denylist}} {{/if}}
{{/if}}
{{if $allow_remote_self}}
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
<div id="contact-edit-end"></div>
{{include file="field_checkbox.tpl" field=$hidden}}
{{include file="field_checkbox.tpl" field=$notify_new_posts}}
<div id="contact-edit-info-wrapper">
<h4>{{$lbl_info1}}</h4>
<textarea id="contact-edit-info" rows="8" cols="60" name="info">{{$info}}</textarea>
</div>
<div id="contact-edit-info-end"></div>
{{if $fetch_further_information}}
{{include file="field_select.tpl" field=$fetch_further_information}}
{{if $fetch_further_information.2 == 2 || $fetch_further_information.2 == 3}} {{include file="field_textarea.tpl" field=$ffi_keyword_denylist}} {{/if}}
{{/if}}
{{if $reason}}
{{if $allow_remote_self}}
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
{{include file="field_checkbox.tpl" field=$hidden}}
{{include file="field_textarea.tpl" field=$cinfo}}
{{if $reason}}
<div id="contact-info-wrapper">
<h4>{{$lbl_info2}}</h4>
<p>{{$reason}}</p>
</div>
<div id="contact-info-end"></div>
{{/if}}
</div>
<input class="contact-edit-submit" type="submit" name="submit" value="{{$submit}}" />
{{/if}}
</div>
<input class="contact-edit-submit" type="submit" name="submit" value="{{$submit}}" />
{{/if}}
<div class="contact-edit-submit-end clearfix"></div>
</form>{{* End of the form *}}

View File

@ -1,103 +0,0 @@
<div id="contact-edit-wrapper">
{{* Insert Tab-Nav *}}
{{$tab_str nofilter}}
<div id="contact-edit-nav-wrapper">
<form action="contact/{{$contact_id}}" method="post">
<div id="contact-edit-links">
<div id="contact-edit-status-wrapper">
<span id="contact-edit-contact-status">{{$contact_status}}</span>
{{* This is the Action menu where contact related actions like 'ignore', 'hide' can be performed *}}
<div id="contact-edit-actions">
<a class="btn" id="contact-edit-actions-button">{{$contact_action_button}}</a>
<ul role="menu" aria-haspopup="true" id="contact-actions-menu" class="menu-popup">
{{if $contact_actions.follow}}<li role="menuitem"><a href="{{$contact_actions.follow.url}}" title="{{$contact_actions.follow.title}}">{{$contact_actions.follow.label}}</a></li>{{/if}}
{{if $contact_actions.unfollow}}<li role="menuitem"><a href="{{$contact_actions.unfollow.url}}" title="{{$contact_actions.unfollow.title}}">{{$contact_actions.unfollow.label}}</a></li>{{/if}}
{{if $lblsuggest}}<li role="menuitem"><a href="{{$contact_actions.suggest.url}}" title="{{$contact_actions.suggest.title}}">{{$contact_actions.suggest.label}}</a></li>{{/if}}
{{if $poll_enabled}}<li role="menuitem"><a href="{{$contact_actions.update.url}}" title="{{$contact_actions.update.title}}">{{$contact_actions.update.label}}</a></li>{{/if}}
{{if $contact_actions.updateprofile}}<li role="menuitem"><a href="{{$contact_actions.updateprofile.url}}" title="{{$contact_actions.updateprofile.title}}">{{$contact_actions.updateprofile.label}}</a></li>{{/if}}
<li class="divider"></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.block.title}}" onclick="window.location.href='{{$contact_actions.block.url}}'; return false;">{{$contact_actions.block.label}}</a></li>
<li role="menuitem"><a href="#" title="{{$contact_actions.ignore.title}}" onclick="window.location.href='{{$contact_actions.ignore.url}}'; return false;">{{$contact_actions.ignore.label}}</a></li>
{{if $contact_actions.revoke_follow.url}}<li role="menuitem"><a href="{{$contact_actions.revoke_follow.url}}" title="{{$contact_actions.revoke_follow.title}}">{{$contact_actions.revoke_follow.label}}</a></li>{{/if}}
</ul>
</div>
{{* Block with status information about the contact *}}
<ul>
{{if $relation_text}}<li><div id="contact-edit-rel">{{$relation_text}}</div></li>{{/if}}
{{if $poll_enabled}}
<li><div id="contact-edit-last-update-text">{{$lastupdtext}} <span id="contact-edit-last-updated">{{$last_update}}</span></div>
{{if $poll_interval}}
<span id="contact-edit-poll-text">{{$updpub}}</span> {{$poll_interval nofilter}}
{{/if}}
</li>
{{/if}}
{{if $lost_contact}}<li><div id="lost-contact-message">{{$lost_contact}}</div></li>{{/if}}
{{if $insecure}}<li><div id="insecure-message">{{$insecure}}</div></li> {{/if}}
{{if $blocked && !$pending}}<li><div id="block-message">{{$blocked}}</div></li>{{/if}}
{{if $pending}}<li><div id="pending-message">{{$pending}}</div></li>{{/if}}
{{if $ignored}}<li><div id="ignore-message">{{$ignored}}</div></li>{{/if}}
{{if $archived}}<li><div id="archive-message">{{$archived}}</div></li>{{/if}}
</ul>
</div> {{* End of contact-edit-status-wrapper *}}
{{* Some information about the contact from the profile *}}
<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 $xmpp}}<dl><dt>{{$xmpp_label}}</dt><dd>{{$xmpp}}</dd></dl>{{/if}}
{{if $matrix}}<dl><dt>{{$matrix_label}}</dt><dd>{{$matrix}}</dd></dl>{{/if}}
{{if $keywords}}<dl><dt>{{$keywords_label}}</dt><dd>{{$keywords}}</dd></dl>{{/if}}
{{if $about}}<dl><dt>{{$about_label}}</dt><dd>{{$about nofilter}}</dd></dl>{{/if}}
</div>{{* End of contact-edit-links *}}
<div id="contact-edit-links-end"></div>
<hr />
{{if $contact_settings_label}}
<h4 id="contact-edit-settings-label" class="fakelink" onclick="openClose('contact-edit-settings')">{{$contact_settings_label}}</h4>
<div id="contact-edit-settings">
<input type="hidden" name="contact_id" value="{{$contact_id}}">
<div id="contact-edit-end"></div>
{{include file="field_checkbox.tpl" field=$notify_new_posts}}
{{if $fetch_further_information}}
{{include file="field_select.tpl" field=$fetch_further_information}}
{{if $fetch_further_information.2 == 2 || $fetch_further_information.2 == 3}} {{include file="field_textarea.tpl" field=$ffi_keyword_denylist}} {{/if}}
{{/if}}
{{if $allow_remote_self}}
{{include file="field_select.tpl" field=$remote_self}}
{{/if}}
{{include file="field_checkbox.tpl" field=$hidden}}
<div id="contact-edit-info-wrapper">
<h4>{{$lbl_info1}}</h4>
<textarea id="contact-edit-info" rows="8" cols="60" name="info">{{$info}}</textarea>
</div>
<div id="contact-edit-info-end"></div>
{{if $reason}}
<div id="contact-info-wrapper">
<h4>{{$lbl_info2}}</h4>
<p>{{$reason}}</p>
</div>
<div id="contact-info-end"></div>
{{/if}}
</div>
<input class="contact-edit-submit" type="submit" name="submit" value="{{$submit}}" />
{{/if}}
<div class="contact-edit-submit-end clearfix"></div>
</form>{{* End of the form *}}
</div>{{* End of contact-edit-nav-wrapper *}}
</div>