Skip to content

Commit

Permalink
imp: Display the number of messages in tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
marien-probesys committed Feb 27, 2023
1 parent 6f4a6a7 commit cb055b8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Utils/Timeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@ public function getSortedItems(?string $type = null): array

return $items;
}

public function countItems(?string $type = null): int
{
$items = $this->getItems($type);
return count($items);
}
}
2 changes: 2 additions & 0 deletions templates/tickets/show.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
<time datetime="{{ ticket.createdAt | dateIso }}">
{{ 'tickets.show.opened_on' | trans({ 'date': ticket.createdAt | dateTrans }) }}
</time>

· {{ 'tickets.show.number_messages' | trans({ 'count': timeline.countItems('message') }) }}
</span>
</div>

Expand Down
1 change: 1 addition & 0 deletions translations/messages+intl-icu.en_GB.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ tickets.show.mark_as.confidential: confidential
tickets.show.mark_as.solution: solution
tickets.show.message.confidential: 'This message is confidential'
tickets.show.message.resolved: 'This message resolved the ticket'
tickets.show.number_messages: '{count, plural, =0 {No messages} one {1 message} other {# messages}}'
tickets.show.opened_incident: 'opened this <strong>incident</strong>'
tickets.show.opened_on: 'on {date}'
tickets.show.opened_request: 'opened this <strong>request</strong>'
Expand Down
1 change: 1 addition & 0 deletions translations/messages+intl-icu.fr_FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ tickets.show.mark_as.confidential: confidentiel
tickets.show.mark_as.solution: solution
tickets.show.message.confidential: 'Ce message est confidentiel'
tickets.show.message.resolved: 'Ce message a résolu le ticket'
tickets.show.number_messages: '{count, plural, =0 {Aucun message} one {1 message} other {# messages}}'
tickets.show.opened_incident: 'a ouvert cet <strong>incident</strong>'
tickets.show.opened_on: 'le {date}'
tickets.show.opened_request: 'a ouvert cette <strong>demande</strong>'
Expand Down

0 comments on commit cb055b8

Please sign in to comment.