Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
fix: Disable reply on closed conversations (#61)
Browse files Browse the repository at this point in the history
* feat: OLCS composer packages to dev-project/messaging (#19)

* feat: Messaging conversation list (#22)

* feat: Messaging conversation list

* fix: Missing route from branch re-create

* fix: Rename messages to conversations

* fix: Unused null check

* feat: Update olcs-comon lock

* feat: List messages in a conversation. (#23)

* feat: Conversation messages list

* feat: Controller view test

* fix: Unused null check

* fix: Test PR changes (case and unused var)

* fix: Just added whitespace!

* feat: Messaging tab visibility (#32)

* Update README.md

* WIP

* Tab WIP

* Messaging tab view based on feature toggle only

* Messaging tab logic without extra query

* Change routing to conversations

* Clean unused

* Review improvement

* Revert whitespace from bad resolution

---------

Co-authored-by: Joshua License <[email protected]>
Co-authored-by: Saul Wilcox <[email protected]>

* feat: Project branch change for composer.lock

* feat: Composer update due to common and transfer merges from main

* fix: Navigation unit test (#36)

* Add messaging feature in NavigationTest

* fix: Add once() assertions to shouldReceive()

* Fix test to match CI error_reporting

* Formatting improvements

---------

Co-authored-by: Saul Wilcox <[email protected]>

* feat: Message list split in to two columns (#41)

* feat: Message list split in to two columns

* feat: composer.lock

* feat: Start conversation link (#45)

* feat: Start a new conversation link (and empty page)

* fix: PR: Rename newAction to addAction

* feat: Add header to new sidebar for start link (#50)

* feat: Reply to conversation (#49)

* feat: Reply to a conversation

* fix: Strong types on form

* feat: Messsaging new conversation form (#53)

* chore: so far

* chore: so far

* chore: so far

* olcs-transfer bump

* feat: use GOVUK-SELECT class

* chore: code clean-up

* bump: olcs-common

* chore: bump olcs-common and olcs-transfer

* Add "Messaging not disabled" to tab display conditions (#57)

* Add condition for messaging disabled for organisation

* Adjust to match call count

* Add full return to tests

* Whitespace

---------

Co-authored-by: Saul Wilcox <[email protected]>

* fix: Trying to access array key on null in navigation (#60)

* fix: Disable reply on closed conversations

* fix: Test fix

* fix: Pull composer.json from main

---------

Co-authored-by: Saul Wilcox <[email protected]>
Co-authored-by: Joshua License <[email protected]>
Co-authored-by: Saul Wilcox <[email protected]>
Co-authored-by: James Wragg <[email protected]>
  • Loading branch information
5 people authored Feb 19, 2024
1 parent 4781f02 commit 49b2cdc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
8 changes: 6 additions & 2 deletions module/Olcs/src/Controller/ConversationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,12 @@ public function viewAction()
];

$response = $this->handleQuery(ByConversationQuery::create($params));
$canReply = false;

if ($response->isOk()) {
$messages = $response->getResult();
$canReply = !$messages['extra']['conversation']['isClosed'];
unset($messages['extra']);
} else {
$this->flashMessengerHelper->addErrorMessage('unknown-error');
$messages = [];
Expand All @@ -174,8 +177,9 @@ public function viewAction()

$view = new ViewModel(
[
'table' => $table,
'form' => $form,
'table' => $table,
'form' => $form,
'canReply' => $canReply,
],
);
$view->setTemplate('messages-view');
Expand Down
29 changes: 16 additions & 13 deletions module/Olcs/view/messages-view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@ echo $this->partial(
->setMaxDepth(0)
->setPartial('partials/tabs-nav');
?>
<details class="govuk-details" data-module="govuk-details">
<summary class="govuk-details__summary" aria-controls="details-content-operating-centre">
<span class="govuk-details__summary-text">
Send a reply
</span>
</summary>
<div class="govuk-details__text" id="details-content-operating-centre">
<?php
echo $this->formErrors($this->form);
echo $this->form($this->form);
?>
</div>
</details>

<?php if ($this->canReply): ?>
<details class="govuk-details" data-module="govuk-details">
<summary class="govuk-details__summary" aria-controls="details-content-operating-centre">
<span class="govuk-details__summary-text">
Send a reply
</span>
</summary>
<div class="govuk-details__text" id="details-content-operating-centre">
<?php
echo $this->formErrors($this->form);
echo $this->form($this->form);
?>
</div>
</details>
<?php endif; ?>
<?php
echo $this->table;
?>
Expand Down
8 changes: 7 additions & 1 deletion test/Olcs/src/Controller/ConversationsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ public function testViewAction(): void
$mockResponse->shouldReceive('isOk')
->andReturn(true);
$mockResponse->shouldReceive('getResult')
->andReturn([]);
->andReturn([
'extra' => [
'conversation' => [
'isClosed' => true,
],
],
]);

$mockHandleQuery = m::mock(HandleQuery::class)
->makePartial();
Expand Down

0 comments on commit 49b2cdc

Please sign in to comment.