Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #593 from matrix-org/giomfo/lowercase_email
Browse files Browse the repository at this point in the history
MXKEmail: force in lowercase the email address
  • Loading branch information
giomfo authored Aug 26, 2019
2 parents 65d2287 + 4577ff5 commit bc1ca65
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Improvements:
* Upgrade MatrixSDK version ([v0.13.1](https://github.com/matrix-org/matrix-ios-sdk/releases/tag/v0.13.1)).
* Support soft logout (vector-im/riot-ios/issues/2540).
* MXKRoomBubbleCellData: Add method to get bubble component index from event id.
* MXKEmail: force in lowercase the email address.

Bug fix:
* APNS Push: fix logic when enabling APNS push. Avoid calling nil callback method.
Expand Down
3 changes: 2 additions & 1 deletion MatrixKit/Models/Contact/MXKContact.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2017 Vector Creations Ltd
Copyright 2019 The Matrix.org Foundation C.I.C
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -352,7 +353,7 @@ - (BOOL)hasPrefix:(NSString*)prefix
// Check email
for (MXKEmail* email in _emailAddresses)
{
if ([[email.emailAddress lowercaseString] hasPrefix:prefix])
if ([email.emailAddress hasPrefix:prefix])
{
return YES;
}
Expand Down
2 changes: 1 addition & 1 deletion MatrixKit/Models/Contact/MXKEmail.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

@interface MXKEmail : MXKContactField

// email info
// email info (the address is stored in lowercase)
@property (nonatomic, readonly) NSString *type;
@property (nonatomic, readonly) NSString *emailAddress;

Expand Down
5 changes: 3 additions & 2 deletions MatrixKit/Models/Contact/MXKEmail.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright 2015 OpenMarket Ltd
Copyright 2019 The Matrix.org Foundation C.I.C
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,7 +38,7 @@ - (id)initWithEmailAddress:(NSString*)anEmailAddress type:(NSString*)aType conta

if (self)
{
_emailAddress = anEmailAddress;
_emailAddress = [anEmailAddress lowercaseString];
_type = aType;
}

Expand Down Expand Up @@ -73,7 +74,7 @@ - (id)initWithCoder:(NSCoder *)coder
if (self)
{
_type = [coder decodeObjectForKey:@"type"];
_emailAddress = [coder decodeObjectForKey:@"emailAddress"];
_emailAddress = [[coder decodeObjectForKey:@"emailAddress"] lowercaseString];
}

return self;
Expand Down

0 comments on commit bc1ca65

Please sign in to comment.