-
Notifications
You must be signed in to change notification settings - Fork 263
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
Showing
6 changed files
with
29 additions
and
16 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 |
---|---|---|
|
@@ -84,7 +84,7 @@ | |
<div> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:icon-class="!option.id ? 'icon-user' : null" | ||
:url="option.photo" /> | ||
</div> | ||
|
@@ -137,7 +137,7 @@ | |
<div> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:url="option.photo" | ||
:icon-class="!option.id ? 'icon-user' : null" /> | ||
</div> | ||
|
@@ -190,7 +190,7 @@ | |
<div> | ||
<ListItemIcon :no-margin="true" | ||
:name="option.label" | ||
:subname="showEmailAsSubname(option)" | ||
:subname="getSubnameForRecipient(option)" | ||
:url="option.photo" | ||
:icon-class="!option.id ? 'icon-user' : null" /> | ||
</div> | ||
|
@@ -1422,15 +1422,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 1430 in src/components/Composer.vue
|
||
* @return string | ||
Check warning on line 1431 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 |
---|---|---|
|
@@ -37,8 +37,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); | ||
|
@@ -50,7 +50,7 @@ public function testFindMatches() { | |
]; | ||
|
||
$groupsResult = [ | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists'] | ||
['id' => 20, 'label' => 'Journalists', 'email' => 'Journalists', 'source' => 'groups'] | ||
]; | ||
|
||
$this->contactsIntegration->expects($this->once()) | ||
|
@@ -72,10 +72,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