[COMPONENTS][Posting] Form is no longer added to RightPanel if not on a feed|conversation|groups route

This commit is contained in:
Eliseu Amaro 2022-02-15 12:36:45 +00:00 committed by Diogo Peralta Cordeiro
parent 9d9abf8afb
commit 5b94973079
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
5 changed files with 28 additions and 16 deletions

View File

@ -19,11 +19,7 @@
{% if notes is defined %}
<article>
<header class="feed-header">
{% if page_title is defined %}
<h1 class="heading-no-margin">{{ page_title | trans }}</h1>
{% else %}
<h1 class="heading-no-margin">{{ 'Notes' | trans }}</h1>
{% endif %}
<h1 class="section-title">{{ 'Notes' | trans }}</h1>
<nav class="feed-actions">
<details class="feed-actions-details">
<summary>

View File

@ -73,7 +73,7 @@ class Posting extends Component
*/
public function onAddMainRightPanelBlock(Request $request, array &$res): bool
{
if (\is_null($user = Common::user())) {
if (\is_null($user = Common::user()) || preg_match('(feed|conversation|group)', $request->get('_route')) === 0) {
return Event::next;
}
@ -100,9 +100,9 @@ class Posting extends Component
$form_params = [];
if (!empty($in_targets)) { // @phpstan-ignore-line
// Add "none" option to the first of choices
$in_targets = array_merge([_m('Public') => 'public'], $in_targets);
$in_targets = array_merge([_m('Public') => 'public'], $in_targets);
// Make the context actor the first In target option
if (!is_null($context_actor)) {
if (!\is_null($context_actor)) {
foreach ($in_targets as $it_nick => $it_id) {
if ($it_id === $context_actor->getId()) {
unset($in_targets[$it_nick]);
@ -119,7 +119,7 @@ class Posting extends Component
_m('Local') => VisibilityScope::LOCAL->value,
_m('Addressee') => VisibilityScope::ADDRESSEE->value,
];
if (!is_null($context_actor) && $context_actor->isGroup()) {
if (!\is_null($context_actor) && $context_actor->isGroup()) {
if ($actor->canModerate($context_actor)) {
if ($context_actor->getRoles() & ActorLocalRoles::PRIVATE_GROUP) {
$visibility_options = array_merge([_m('Group') => VisibilityScope::GROUP->value], $visibility_options);

View File

@ -53,7 +53,7 @@
</summary>
{% for block in extra %}
<section class="frame-section-padding">
<section class="posting-extra frame-section-padding">
{{ block | raw }}
</section>
{% endfor %}

View File

@ -406,6 +406,23 @@ embed header {
flex: 1;
}
.posting-extra .h-entry {
padding-left: var(--s);
padding-right: var(--s);
}
.posting-extra .note-sidebar {
all: unset;
}
.posting-extra .note-sidebar .avatar {
all: unset;
max-width: 1em;
max-height: 1em;
min-width: 1em;
margin-right: 4px;
}
@media only screen and (max-width: 1280px) {
.note-sidebar {
max-width: min-content !important;

View File

@ -52,17 +52,16 @@
<article
tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}"
id="{{ 'note-compact-anchor-' ~ note.getId() }}"
class="h-entry hentry note"
lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
lang="{{ note.getLanguageLocale() }}">
<div class="note-wrapper">
<header class="note-info">
<div class="note-info-start">
{{ block('note_author', 'cards/blocks/note.html.twig') }}
</div>
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
{{ block('note_author', 'cards/blocks/note.html.twig') }}
</header>
<section role="dialog" class="e-content entry-content note-content">
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}">
<small class="note-conversation-info">
<a href="{{ note.getConversationUrl() }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a>