Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions public/assets/css/pages/messages.css
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,18 @@ rb-composer {
text-align: center;
}

.rb-chat-hint {
margin: 0;
padding: var(--rb-space-2) var(--rb-space-3);
color: var(--rb-text-3);
font-size: 0.8125rem;
text-align: center;
}

.rb-chat-hint a {
color: var(--rb-accent);
}

.rb-chat-label {
margin: 0;
color: var(--rb-text-3);
Expand Down
4 changes: 4 additions & 0 deletions templates/messages/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<?php if ($draft !== null && $draft['blocked']): ?>
<p class="rb-chat-notice" role="alert">Vous devez appartenir à un autre groupe pour écrire à celui-ci.</p>
<?php endif; ?>
<?php if ($draft !== null && !$draft['blocked']): ?>
<?php /* #456 : un échange de créneau décidé ici n'arriverait jamais dans le planning. */ ?>
<p class="rb-chat-hint">Pour échanger un créneau, passez par <a href="/bookings">Réserver le local</a> : le planning reste à jour.</p>
<?php endif; ?>
<?php /* #187 : ancre de hauteur nulle posée entre le fil et la ligne d'état ; le bouton flotte juste au-dessus. */ ?>
<div class="rb-chat-new-anchor"><button type="button" class="rb-chat-new-messages" data-chat-new-messages hidden>↓ Nouveaux messages</button></div>
<p class="rb-chat-status<?= $thread !== null && $thread['typing'] ? ' rb-chat-status--typing' : '' ?>" data-chat-status aria-live="polite"><?= $thread !== null ? e($thread['status']) : '' ?></p>
Expand Down
30 changes: 30 additions & 0 deletions tests/Messaging/Controller/MessagesPageControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,36 @@ public function testDirectComposeRendersAnEmptyThreadAddressedToThePersonWithout
self::assertSame([], $this->reader->listFor($alice->id(), 'active'), 'ouvrir la page ne crée rien');
}

#[Test]
public function testDraftPagesRemindToGoThroughBookTheRoomForASlotExchangeButExistingThreadsDoNot(): void
{
$alice = $this->user('Alice');
$this->group('Alpha', $alice);
$target = $this->group('Beta Rockers');
$bob = $this->user('Bob');
$this->loginAs($alice);

foreach ([
$this->controller->compose($this->request(), (string) $target->id())->body(),
$this->controller->directCompose($this->request(), (string) $bob->id())->body(),
] as $body) {
self::assertStringContainsString('Pour échanger un créneau', $body);
self::assertStringContainsString('<a href="/bookings">Réserver le local</a>', $body);
}

self::assertStringNotContainsString('Pour échanger un créneau', $this->controller->list($this->request())->body());
}

#[Test]
public function testTheExchangeReminderIsHiddenWhenThePersonCannotWriteFromAnyGroup(): void
{
$alice = $this->user('Alice');
$target = $this->group('Beta Rockers');
$this->loginAs($alice);

self::assertStringNotContainsString('Pour échanger un créneau', $this->controller->compose($this->request(), (string) $target->id())->body());
}

#[Test]
public function testDirectComposeRefusesYourselfUnknownInactiveAndMalformedTargets(): void
{
Expand Down
Loading