Commit 4adc3f02 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

smartlist: do not display bestID if equal to name

In the case where the name of a contact is exactly the same as its
registered name or RingID, we were still displaying both. It happens
when a contact has just been added.

Now, we hide the bestID if it is equal to the name and show it back
on name changes for its security purpose.

Change-Id: I743df652661358a7a2940844c6c3770ebcaf29e6
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent f86c9bb4
......@@ -266,14 +266,17 @@ NSInteger const PRESENCE_TAG = 800;
NSTextField* displayName = [result viewWithTag:DISPLAYNAME_TAG];
NSString* displayNameString = qIdx.data((int)Ring::Role::Name).toString().toNSString();
NSString* displayIDString = qIdx.data((int)Person::Role::IdOfLastCMUsed).toString().toNSString();
NSString* displayIDString = qIdx.data((int)Ring::Role::Number).toString().toNSString();
if(displayNameString.length == 0 || [displayNameString isEqualToString:displayIDString]) {
NSTextField* displayRingID = [result viewWithTag:RING_ID_LABEL];
[displayName setStringValue:displayIDString];
[displayRingID setHidden:YES];
}
else {
NSTextField* displayRingID = [result viewWithTag:RING_ID_LABEL];
[displayName setStringValue:displayNameString];
[displayRingID setStringValue:displayIDString];
[displayRingID setHidden:NO];
}
NSImageView* photoView = [result viewWithTag:IMAGE_TAG];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment