-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: recipient label should not contain email address
Signed-off-by: Daniel Kesselberg <[email protected]>
- Loading branch information
1 parent
c02c83f
commit 66d11a2
Showing
7 changed files
with
47 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,7 +71,7 @@ | |
<div class="multiselect__tag multiselect__tag-custom"> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:icon-class="!option.id ? 'icon-user' : null" | ||
:url="option.photo" /> | ||
</div> | ||
|
@@ -127,7 +127,7 @@ | |
<div class="multiselect__tag multiselect__tag-custom"> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:url="option.photo" | ||
:icon-class="!option.id ? 'icon-user' : null" /> | ||
</div> | ||
|
@@ -177,7 +177,7 @@ | |
<div class="multiselect__tag multiselect__tag-custom"> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:url="option.photo" | ||
:icon-class="!option.id ? 'icon-user' : null" /> | ||
</div> | ||
|
@@ -1376,15 +1376,24 @@ export default { | |
}, | ||
/** | ||
* Use the email address as subname if we have label | ||
* Return the subname for recipient suggestion. | ||
* | ||
* Empty if label and email are the same or | ||
* if the suggestion is a group. | ||
* | ||
* @param {{email: string, label: string}} option | ||
Check warning on line 1384 in src/components/Composer.vue
|
||
* @return string | ||
Check warning on line 1385 in src/components/Composer.vue
|
||
*/ | ||
showEmailAsSubname(option) { | ||
return (option.label === option.email) | ||
? '' | ||
: option.email | ||
getSubnameForRecipient(option) { | ||
if (option.source && option.source === 'groups') { | ||
return '' | ||
} | ||
if (option.label === option.email) { | ||
return '' | ||
} | ||
return option.email | ||
}, | ||
}, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,8 @@ public function testFindMatches() { | |
$term = 'jo'; | ||
|
||
$contactsResult = [ | ||
['id' => 12, 'label' => '"john doe" <[email protected]>', 'email' => '[email protected]'], | ||
['id' => 13, 'label' => '"joe doe" <[email protected]>', 'email' => '[email protected]'], | ||
['id' => 12, 'label' => '"john doe" <[email protected]>', 'email' => '[email protected]', 'source' => 'contacts'], | ||
['id' => 13, 'label' => '"joe doe" <[email protected]>', 'email' => '[email protected]', 'source' => 'contacts'], | ||
]; | ||
$john = new CollectedAddress(); | ||
$john->setId(1234); | ||
|
@@ -64,7 +64,7 @@ public function testFindMatches() { | |
]; | ||
|
||
$groupsResult = [ | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists'] | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists', 'source' => 'groups'] | ||
]; | ||
|
||
$this->contactsIntegration->expects($this->once()) | ||
|
@@ -86,10 +86,10 @@ public function testFindMatches() { | |
$response = $this->service->findMatches('testuser', $term); | ||
|
||
$expected = [ | ||
['id' => 12, 'label' => '"john doe" <[email protected]>', 'email' => '[email protected]'], | ||
['id' => 13, 'label' => '"joe doe" <[email protected]>', 'email' => '[email protected]'], | ||
['id' => 1234, 'label' => 'John Doe', 'email' => '[email protected]'], | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists'], | ||
['id' => 12, 'label' => '"john doe" <[email protected]>', 'email' => '[email protected]', 'source' => 'contacts'], | ||
['id' => 13, 'label' => '"joe doe" <[email protected]>', 'email' => '[email protected]', 'source' => 'contacts'], | ||
['id' => 1234, 'label' => 'John Doe', 'email' => '[email protected]', 'source' => 'collector'], | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists', 'source' => 'groups'], | ||
]; | ||
$this->assertEquals($expected, $response); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,21 +103,24 @@ public function testGetMatchingRecipient() { | |
$expected = [ | ||
[ | ||
'id' => 'jf', | ||
'label' => 'Jonathan Frakes ([email protected])', | ||
'label' => 'Jonathan Frakes', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts' | ||
], | ||
[ | ||
'id' => 'jd', | ||
'label' => 'John Doe ([email protected])', | ||
'label' => 'John Doe', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts' | ||
], | ||
[ | ||
'id' => 'jd', | ||
'label' => 'John Doe ([email protected])', | ||
'label' => 'John Doe', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts' | ||
], | ||
]; | ||
|
||
|
@@ -170,21 +173,24 @@ public function testGetMatchingRecipientRestrictedToGroup() { | |
$expected = [ | ||
[ | ||
'id' => 'jd', | ||
'label' => 'John Doe ([email protected])', | ||
'label' => 'John Doe', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts' | ||
], | ||
[ | ||
'id' => 'jd', | ||
'label' => 'John Doe ([email protected])', | ||
'label' => 'John Doe', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts', | ||
], | ||
[ | ||
'id' => 'js', | ||
'label' => 'Johann Strauss II ([email protected])', | ||
'label' => 'Johann Strauss II', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts', | ||
], | ||
]; | ||
|
||
|
@@ -222,9 +228,10 @@ public function testGetMatchingRecipientRestrictedToGroupFullMatchUserId() { | |
$expected = [ | ||
[ | ||
'id' => 'jf', | ||
'label' => 'Jonathan Frakes ([email protected])', | ||
'label' => 'Jonathan Frakes', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts', | ||
], | ||
]; | ||
|
||
|
@@ -262,9 +269,10 @@ public function testGetMatchingRecipientRestrictedToGroupFullMatchFullName() { | |
$expected = [ | ||
[ | ||
'id' => 'jf', | ||
'label' => 'Jonathan Frakes ([email protected])', | ||
'label' => 'Jonathan Frakes', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts', | ||
], | ||
]; | ||
|
||
|
@@ -302,9 +310,10 @@ public function testGetMatchingRecipientRestrictedToGroupFullMatchEmail() { | |
$expected = [ | ||
[ | ||
'id' => 'jf', | ||
'label' => 'Jonathan Frakes ([email protected])', | ||
'label' => 'Jonathan Frakes', | ||
'email' => '[email protected]', | ||
'photo' => null, | ||
'source' => 'contacts', | ||
], | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters