Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable31] fix(call): Simplify wording for one-to-one calls #14495

Merged
merged 1 commit into from
Feb 25, 2025
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
27 changes: 24 additions & 3 deletions lib/Chat/Parser/SystemMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,26 @@ protected function parseMessage(Message $chatMessage): void {
if ($silentCall) {
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You started a silent call');
if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
$parsedMessage = $this->l->t('Outgoing silent call');
}
} else {
$parsedMessage = $this->l->t('{actor} started a silent call');
if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
$parsedMessage = $this->l->t('Incoming silent call');
}
}
} else {
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You started a call');
if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
$parsedMessage = $this->l->t('Outgoing call');
}
} else {
$parsedMessage = $this->l->t('{actor} started a call');
if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
$parsedMessage = $this->l->t('Incoming call');
}
}
}
} elseif ($message === 'call_joined') {
Expand Down Expand Up @@ -1072,7 +1084,7 @@ protected function getGuestName(Room $room, string $actorType, string $actorId):
protected function parseMissedCall(Room $room, array $parameters, ?string $currentActorId): array {
if ($parameters['users'][0] !== $currentActorId) {
return [
$this->l->t('You missed a call from {user}'),
$this->l->t('Missed call'),
[
'user' => $this->getUser($parameters['users'][0]),
],
Expand All @@ -1083,7 +1095,7 @@ protected function parseMissedCall(Room $room, array $parameters, ?string $curre
if ($room->getType() !== Room::TYPE_ONE_TO_ONE) {
// Can happen if a user was remove from a one-to-one room.
return [
$this->l->t('You tried to call {user}'),
$this->l->t('Missed call'),
[
'user' => [
'type' => 'highlight',
Expand All @@ -1104,7 +1116,7 @@ protected function parseMissedCall(Room $room, array $parameters, ?string $curre
}

return [
$this->l->t('You tried to call {user}'),
$this->l->t('Missed call'),
[
'user' => $this->getUser($other),
],
Expand All @@ -1118,6 +1130,15 @@ protected function parseCall(Room $room, string $message, array $parameters, arr
$maxDuration = $this->appConfig->getAppValueInt('max_call_duration');
$maxDurationWasReached = $message === 'call_ended_everyone' && $actorIsSystem && $maxDuration > 0 && $parameters['duration'] > $maxDuration;

if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) {
$subject = $this->l->t('Call ended (Duration {duration})');
$subject = str_replace('{duration}', $this->getDuration($parameters['duration']), $subject);
return [
$subject,
$params,
];
}

if ($message === 'call_ended_everyone') {
if ($params['actor']['type'] === 'user') {
$entry = array_keys($parameters['users'], $params['actor']['id'], true);
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/features/command/user-remove.feature
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Feature: command/user-remove
And user "participant1" leaves room "room" with 200 (v4)
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | systemMessage | message | messageParameters |
| room | users | participant1 | call_tried | You tried to call {user} | {"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} |
| room | users | participant1 | call_tried | Missed call | {"user":{"type":"user","id":"participant2","name":"participant2-displayname","mention-id":"participant2"}} |
| room | users | participant1 | call_left | You left the call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | call_started | You started a call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | call_started | Outgoing call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
When reset signaling server requests
And invoking occ with "talk:user:remove --user participant2"
Expand All @@ -99,7 +99,7 @@ Feature: command/user-remove
Then user "participant1" sees the following system messages in room "room" with 200
| room | actorType | actorId | systemMessage | message | messageParameters |
| room | guests | cli | read_only | An administrator locked the conversation | {"actor":{"type":"guest","id":"guest\/cli","name":"Guest","mention-id":"guest\/cli"}} |
| room | users | participant1 | call_tried | You tried to call {user} | {"user":{"type":"highlight","id":"deleted_users","name":"participant2-displayname"}} |
| room | users | participant1 | call_tried | Missed call | {"user":{"type":"highlight","id":"deleted_users","name":"participant2-displayname"}} |
| room | users | participant1 | call_left | You left the call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | call_started | You started a call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | call_started | Outgoing call | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
| room | users | participant1 | conversation_created | You created the conversation | {"actor":{"type":"user","id":"participant1","name":"participant1-displayname","mention-id":"participant1"}} |
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Feature: command/user-remove
Feature: command/user-transfer-ownership

Background:
Given user "participant1" exists
Expand Down
Loading