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

Calls are Conversations #919

Merged
merged 1 commit into from
May 30, 2018
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
4 changes: 2 additions & 2 deletions lib/Activity/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ protected function getRoom(IL10N $l, Room $room) {
return [
'type' => 'call',
'id' => $room->getId(),
'name' => $room->getName() ?: $l->t('a call'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably remain "a call" since it's of type call?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually might be right, since notifier users different stuff for sending a call.

'name' => $room->getName() ?: $l->t('a conversation'),
'call-type' => $stringType,
];
}
Expand All @@ -140,7 +140,7 @@ protected function getFormerRoom(IL10N $l, $roomId) {
return [
'type' => 'call',
'id' => $roomId,
'name' => $l->t('a call'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

'name' => $l->t('a conversation'),
'call-type' => Room::UNKNOWN_CALL,
];
}
Expand Down
40 changes: 20 additions & 20 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ protected function parseMention(INotification $notification, Room $room, IL10N $
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
$notification
->setParsedSubject(
$l->t('%s mentioned you in a private chat', [$user->getDisplayName()])
$l->t('%s mentioned you in a private conversation', [$user->getDisplayName()])
)
->setRichSubject(
$l->t('{user} mentioned you in a private chat'), [
$l->t('{user} mentioned you in a private conversation'), [
'user' => $richSubjectUser
]
);
Expand All @@ -174,59 +174,59 @@ protected function parseMention(INotification $notification, Room $room, IL10N $
if ($richSubjectUser && $richSubjectCall) {
$notification
->setParsedSubject(
$l->t('%s mentioned you in a group chat: %s', [$user->getDisplayName(), $room->getName()])
$l->t('%s mentioned you in a group conversation: %s', [$user->getDisplayName(), $room->getName()])
)
->setRichSubject(
$l->t('{user} mentioned you in a group chat: {call}'), [
$l->t('{user} mentioned you in a group conversation: {call}'), [
'user' => $richSubjectUser,
'call' => $richSubjectCall
]
);
} else if ($richSubjectUser && !$richSubjectCall) {
$notification
->setParsedSubject(
$l->t('%s mentioned you in a group chat', [$user->getDisplayName()])
$l->t('%s mentioned you in a group conversation', [$user->getDisplayName()])
)
->setRichSubject(
$l->t('{user} mentioned you in a group chat'), [
$l->t('{user} mentioned you in a group conversation'), [
'user' => $richSubjectUser
]
);
} else if (!$richSubjectUser && !$isGuest && $richSubjectCall) {
$notification
->setParsedSubject(
$l->t('You were mentioned in a group chat by a user that has since been deleted: %s', [$room->getName()])
$l->t('You were mentioned in a group conversation by a user that has since been deleted: %s', [$room->getName()])
)
->setRichSubject(
$l->t('You were mentioned in a group chat by a user that has since been deleted: {call}'), [
$l->t('You were mentioned in a group conversation by a user that has since been deleted: {call}'), [
'call' => $richSubjectCall
]
);
} else if (!$richSubjectUser && !$isGuest && !$richSubjectCall) {
$notification
->setParsedSubject(
$l->t('You were mentioned in a group chat by a user that has since been deleted')
$l->t('You were mentioned in a group conversation by a user that has since been deleted')
)
->setRichSubject(
$l->t('You were mentioned in a group chat by a user that has since been deleted')
$l->t('You were mentioned in a group conversation by a user that has since been deleted')
);
} else if (!$richSubjectUser && $isGuest && $richSubjectCall) {
$notification
->setParsedSubject(
$l->t('A guest mentioned you in a group chat: %s', [$room->getName()])
$l->t('A guest mentioned you in a group conversation: %s', [$room->getName()])
)
->setRichSubject(
$l->t('A guest mentioned you in a group chat: {call}'), [
$l->t('A guest mentioned you in a group conversation: {call}'), [
'call' => $richSubjectCall
]
);
} else if (!$richSubjectUser && $isGuest && !$richSubjectCall) {
$notification
->setParsedSubject(
$l->t('A guest mentioned you in a group chat')
$l->t('A guest mentioned you in a group conversation')
)
->setRichSubject(
$l->t('A guest mentioned you in a group chat')
$l->t('A guest mentioned you in a group conversation')
);
}
} else {
Expand Down Expand Up @@ -277,10 +277,10 @@ protected function parseInvitation(INotification $notification, Room $room, IL10
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
$notification
->setParsedSubject(
$l->t('%s invited you to a private call', [$user->getDisplayName()])
$l->t('%s invited you to a private conversation', [$user->getDisplayName()])
)
->setRichSubject(
$l->t('{user} invited you to a private call'), [
$l->t('{user} invited you to a private conversation'), [
'user' => [
'type' => 'user',
'id' => $uid,
Expand All @@ -293,10 +293,10 @@ protected function parseInvitation(INotification $notification, Room $room, IL10
if ($room->getName() !== '') {
$notification
->setParsedSubject(
$l->t('%s invited you to a group call: %s', [$user->getDisplayName(), $room->getName()])
$l->t('%s invited you to a group conversation: %s', [$user->getDisplayName(), $room->getName()])
)
->setRichSubject(
$l->t('{user} invited you to a group call: {call}'), [
$l->t('{user} invited you to a group conversation: {call}'), [
'user' => [
'type' => 'user',
'id' => $uid,
Expand All @@ -313,10 +313,10 @@ protected function parseInvitation(INotification $notification, Room $room, IL10
} else {
$notification
->setParsedSubject(
$l->t('%s invited you to a group call', [$user->getDisplayName()])
$l->t('%s invited you to a group conversation', [$user->getDisplayName()])
)
->setRichSubject(
$l->t('{user} invited you to a group call'), [
$l->t('{user} invited you to a group conversation'), [
'user' => [
'type' => 'user',
'id' => $uid,
Expand Down
6 changes: 3 additions & 3 deletions tests/php/Activity/Provider/BaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public function dataGetRoom() {
[Room::ONE_TO_ONE_CALL, 23, 'private-call', 'private-call', 'one2one'],
[Room::GROUP_CALL, 42, 'group-call', 'group-call', 'group'],
[Room::PUBLIC_CALL, 128, 'public-call', 'public-call', 'public'],
[Room::ONE_TO_ONE_CALL, 23, '', 'a call', 'one2one'],
[Room::GROUP_CALL, 42, '', 'a call', 'group'],
[Room::PUBLIC_CALL, 128, '', 'a call', 'public'],
[Room::ONE_TO_ONE_CALL, 23, '', 'a conversation', 'one2one'],
[Room::GROUP_CALL, 42, '', 'a conversation', 'group'],
[Room::PUBLIC_CALL, 128, '', 'a conversation', 'public'],
];
}

Expand Down
60 changes: 30 additions & 30 deletions tests/php/Notification/NotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function setUp() {

public function dataPrepareOne2One() {
return [
['admin', 'Admin', 'Admin invited you to a private call'],
['test', 'Test user', 'Test user invited you to a private call'],
['admin', 'Admin', 'Admin invited you to a private conversation'],
['test', 'Test user', 'Test user invited you to a private conversation'],
];
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public function testPrepareOne2One($uid, $displayName, $parsedSubject) {
->willReturnSelf();
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a private call',[
->with('{user} invited you to a private conversation',[
'user' => [
'type' => 'user',
'id' => $uid,
Expand All @@ -149,8 +149,8 @@ public function testPrepareOne2One($uid, $displayName, $parsedSubject) {

public function dataPrepareGroup() {
return [
[Room::GROUP_CALL, 'admin', 'Admin', '', 'Admin invited you to a group call'],
[Room::PUBLIC_CALL, 'test', 'Test user', 'Name', 'Test user invited you to a group call: Name'],
[Room::GROUP_CALL, 'admin', 'Admin', '', 'Admin invited you to a group conversation'],
[Room::PUBLIC_CALL, 'test', 'Test user', 'Name', 'Test user invited you to a group conversation: Name'],
];
}

Expand Down Expand Up @@ -213,7 +213,7 @@ public function testPrepareGroup($type, $uid, $displayName, $name, $parsedSubjec
->method('getId');
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a group call',[
->with('{user} invited you to a group conversation',[
'user' => [
'type' => 'user',
'id' => $uid,
Expand All @@ -227,7 +227,7 @@ public function testPrepareGroup($type, $uid, $displayName, $name, $parsedSubjec
->willReturn($roomId);
$n->expects($this->once())
->method('setRichSubject')
->with('{user} invited you to a group call: {call}', [
->with('{user} invited you to a group conversation: {call}', [
'user' => [
'type' => 'user',
'id' => $uid,
Expand Down Expand Up @@ -263,34 +263,34 @@ public function dataPrepareMention() {
return [
[
Room::ONE_TO_ONE_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisStart', 'ellipsisEnd'], 'Test user', '',
'Test user mentioned you in a private chat',
['{user} mentioned you in a private chat',
'Test user mentioned you in a private conversation',
['{user} mentioned you in a private conversation',
['user' => ['type' => 'user', 'id' => 'testUser', 'name' => 'Test user']]
],
'… message …'
],
// If the user is deleted in a one to one chat the chat is also
// If the user is deleted in a one to one conversation the conversation is also
// deleted, and that in turn would delete the pending notification.
[
Room::GROUP_CALL, ['userType' => 'users', 'userId' => 'testUser'], [], 'Test user', '',
'Test user mentioned you in a group chat',
['{user} mentioned you in a group chat',
'Test user mentioned you in a group conversation',
['{user} mentioned you in a group conversation',
['user' => ['type' => 'user', 'id' => 'testUser', 'name' => 'Test user']]
],
'message'
],
[
Room::GROUP_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisStart'], null, '',
'You were mentioned in a group chat by a user that has since been deleted',
['You were mentioned in a group chat by a user that has since been deleted',
'You were mentioned in a group conversation by a user that has since been deleted',
['You were mentioned in a group conversation by a user that has since been deleted',
[]
],
'… message',
true],
[
Room::GROUP_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisEnd'], 'Test user', 'Room name',
'Test user mentioned you in a group chat: Room name',
['{user} mentioned you in a group chat: {call}',
'Test user mentioned you in a group conversation: Room name',
['{user} mentioned you in a group conversation: {call}',
[
'user' => ['type' => 'user', 'id' => 'testUser', 'name' => 'Test user'],
'call' => ['type' => 'call', 'id' => 'testRoomId', 'name' => 'Room name', 'call-type' => 'group']
Expand All @@ -300,8 +300,8 @@ public function dataPrepareMention() {
],
[
Room::GROUP_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisStart', 'ellipsisEnd'], null, 'Room name',
'You were mentioned in a group chat by a user that has since been deleted: Room name',
['You were mentioned in a group chat by a user that has since been deleted: {call}',
'You were mentioned in a group conversation by a user that has since been deleted: Room name',
['You were mentioned in a group conversation by a user that has since been deleted: {call}',
[
'call' => ['type' => 'call', 'id' => 'testRoomId', 'name' => 'Room name', 'call-type' => 'group']
]
Expand All @@ -310,32 +310,32 @@ public function dataPrepareMention() {
true],
[
Room::PUBLIC_CALL, ['userType' => 'users', 'userId' => 'testUser'], [], 'Test user', '',
'Test user mentioned you in a group chat',
['{user} mentioned you in a group chat',
'Test user mentioned you in a group conversation',
['{user} mentioned you in a group conversation',
['user' => ['type' => 'user', 'id' => 'testUser', 'name' => 'Test user']]
],
'message'
],
[
Room::PUBLIC_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisStart'], null, '',
'You were mentioned in a group chat by a user that has since been deleted',
['You were mentioned in a group chat by a user that has since been deleted',
'You were mentioned in a group conversation by a user that has since been deleted',
['You were mentioned in a group conversation by a user that has since been deleted',
[]
],
'… message',
true],
[
Room::PUBLIC_CALL, ['userType' => 'guests', 'userId' => 'testSpreedSession'], ['ellipsisEnd'], null, '',
'A guest mentioned you in a group chat',
['A guest mentioned you in a group chat',
'A guest mentioned you in a group conversation',
['A guest mentioned you in a group conversation',
[]
],
'message …'
],
[
Room::PUBLIC_CALL, ['userType' => 'users', 'userId' => 'testUser'], ['ellipsisStart', 'ellipsisEnd'], 'Test user', 'Room name',
'Test user mentioned you in a group chat: Room name',
['{user} mentioned you in a group chat: {call}',
'Test user mentioned you in a group conversation: Room name',
['{user} mentioned you in a group conversation: {call}',
[
'user' => ['type' => 'user', 'id' => 'testUser', 'name' => 'Test user'],
'call' => ['type' => 'call', 'id' => 'testRoomId', 'name' => 'Room name', 'call-type' => 'public']
Expand All @@ -345,8 +345,8 @@ public function dataPrepareMention() {
],
[
Room::PUBLIC_CALL, ['userType' => 'users', 'userId' => 'testUser'], [], null, 'Room name',
'You were mentioned in a group chat by a user that has since been deleted: Room name',
['You were mentioned in a group chat by a user that has since been deleted: {call}',
'You were mentioned in a group conversation by a user that has since been deleted: Room name',
['You were mentioned in a group conversation by a user that has since been deleted: {call}',
[
'call' => ['type' => 'call', 'id' => 'testRoomId', 'name' => 'Room name', 'call-type' => 'public']
]
Expand All @@ -355,8 +355,8 @@ public function dataPrepareMention() {
true],
[
Room::PUBLIC_CALL, ['userType' => 'guests', 'userId' => 'testSpreedSession'], ['ellipsisStart', 'ellipsisEnd'], null, 'Room name',
'A guest mentioned you in a group chat: Room name',
['A guest mentioned you in a group chat: {call}',
'A guest mentioned you in a group conversation: Room name',
['A guest mentioned you in a group conversation: {call}',
['call' => ['type' => 'call', 'id' => 'testRoomId', 'name' => 'Room name', 'call-type' => 'public']]
],
'… message …'
Expand Down