Skip to content

Commit

Permalink
Avoid fatal error when conversation status is zero - closes #2237
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Sep 16, 2022
1 parent b65373b commit ebcd11a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions app/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,15 @@ public static function stateCodeToName($status)
}
}

public function getStatus()
{
if (array_key_exists($this->status, self::$statuses)) {
return $this->status;
} else {
return self::STATUS_ACTIVE;
}
}

/**
* Set conersation status and all related fields.
*
Expand Down
4 changes: 2 additions & 2 deletions resources/views/conversations/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
<li>
<div class="btn-group" id="conv-status" data-toggle="tooltip" title="{{ __("Status") }}: {{ $conversation->getStatusName() }}">
@if ($conversation->state != App\Conversation::STATE_DELETED)
<button type="button" class="btn btn-{{ App\Conversation::$status_classes[$conversation->status] }} btn-light conv-info-icon" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{{ __("Status") }}: {{ $conversation->getStatusName() }}"><i class="glyphicon glyphicon-{{ App\Conversation::$status_icons[$conversation->status] }}"></i></button>
<button type="button" class="btn btn-{{ App\Conversation::$status_classes[$conversation->status] }} btn-light dropdown-toggle conv-info-val" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{{ __("Status") }}">
<button type="button" class="btn btn-{{ App\Conversation::$status_classes[$conversation->getStatus()] }} btn-light conv-info-icon" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{{ __("Status") }}: {{ $conversation->getStatusName() }}"><i class="glyphicon glyphicon-{{ App\Conversation::$status_icons[$conversation->getStatus()] }}"></i></button>
<button type="button" class="btn btn-{{ App\Conversation::$status_classes[$conversation->getStatus()] }} btn-light dropdown-toggle conv-info-val" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" aria-label="{{ __("Status") }}">
<span>{{ $conversation->getStatusName() }}</span> <span class="caret"></span>
</button>
<ul class="dropdown-menu conv-status">
Expand Down

0 comments on commit ebcd11a

Please sign in to comment.