Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Update m.id.phone to use 'phone' instead of 'number' #7687

Merged
merged 6 commits into from
Jun 15, 2020

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Jun 12, 2020

The spec states that m.id.phone requires the field country and phone.

In Synapse, we've been enforcing country and number.

I am not currently sure whether this affects any client implementations.

This issue was introduced in #1994.

@anoadragon453
Copy link
Member Author

According to @turt2live Riot-web sends number instead of phone, so we'll likely want to account for both.

Riot-web is going to send both on their side.

@turt2live
Copy link
Member

turt2live commented Jun 12, 2020

ref element-hq/element-web#14002 though I'm not going to be taking this on any time soon.

edit: but someone else might

@anoadragon453
Copy link
Member Author

anoadragon453 commented Jun 12, 2020

Riot-Android apparently also uses the wrong identifier.

Edit: this functionality is not currently implemented in RiotX.

@anoadragon453 anoadragon453 requested a review from a team June 12, 2020 13:21
@clokep
Copy link
Member

clokep commented Jun 12, 2020

@anoadragon453 Would it be reasonable to add unit tests for this?

The changes look good though!

changelog.d/7687.bugfix Outdated Show resolved Hide resolved
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
@anoadragon453
Copy link
Member Author

anoadragon453 commented Jun 15, 2020

@clokep There are unit tests for this included in #7438: https://github.com/matrix-org/synapse/pull/7438/files#diff-3f3fca8f7ff4993ebce1ac5cf7695c64R662

Though tbh this is probably something that could benefit from a sytest as well.

@@ -60,10 +60,18 @@ def login_id_thirdparty_from_phone(identifier):

Returns: Login identifier dict of type 'm.id.threepid'
"""
if "country" not in identifier or "number" not in identifier:
if "country" not in identifier or (
# XXX: We used to require `number` instead of `phone`. The spec
Copy link
Member

Choose a reason for hiding this comment

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

Why XXX? I usually reserve that for something that's an action, maybe something like:

The specification requires a phone field, but Synapse used to require a number field. Accept both for backwards compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess it was more intended as a TODO, we should remove this later.

...but, we're probably never going to remove it, so I think your suggestion does work better.

changelog.d/7687.bugfix Outdated Show resolved Hide resolved
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
@clokep
Copy link
Member

clokep commented Jun 15, 2020

@anoadragon453 Also -- do you have a plan / strategy for how to let client teams know about this change?

@anoadragon453
Copy link
Member Author

@clokep I've contacted Riot-web/mobile gangs already. Other than that, since we're adding backwards compatibility, I would just leave it up to the changelog.

But I could drop a note in #matrix-client-developers:matrix.org...

@anoadragon453 anoadragon453 merged commit b8ee03c into develop Jun 15, 2020
@anoadragon453 anoadragon453 deleted the anoa/fix_m_id_phone branch June 15, 2020 16:46
babolivier pushed a commit that referenced this pull request Sep 1, 2021
* commit '03619324f':
  Create a ListenerConfig object (#7681)
  Fix changelog wording
  1.15.1
  Wrap register_device coroutine in an ensureDeferred (#7684)
  Ensure the body is a string before comparing push rules. (#7701)
  Ensure etag is a string for GET room_keys/version response (#7691)
  Update m.id.phone to use 'phone' instead of 'number' (#7687)
  Fix "There was no active span when trying to log." error (#7698)
  Enable 3PID add/bind/unbind endpoints on r0 routes
  Discard RDATA from already seen positions. (#7648)
  Replace iteritems/itervalues/iterkeys with native versions. (#7692)
  Fix warnings about losing log context during UI auth. (#7688)
  Fix a typo when comparing the URI & method during UI Auth. (#7689)
  Remove "user_id" from GET /presence. (#7606)
  Increase the default SAML session expirary time to 15 minutes. (#7664)
  fix typo in sample_config.yaml (#7652)
  Take out a lock before modifying _CACHES (#7663)
  Add option to enable encryption by default for new rooms (#7639)
  Clean-up the fallback login code. (#7657)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants