mastodon/app/controllers
aschmitz 44a753a6f3 Fix JavaScript interface with long IDs
Somewhat predictably, the JS interface handled IDs as numbers, which in
JS are IEEE double-precision floats. This loses some precision when
working with numbers as large as those generated by the new ID scheme,
so we instead handle them here as strings. This is relatively simple,
and doesn't appear to have caused any problems, but should definitely
be tested more thoroughly than the built-in tests. Several days of use
appear to support this working properly.

BREAKING CHANGE:

The major(!) change here is that IDs are now returned as strings by the
REST endpoints, rather than as integers. In practice, relatively few
changes were required to make the existing JS UI work with this change,
but it will likely hit API clients pretty hard: it's an entirely
different type to consume. (The one API client I tested, Tusky, handles
this with no problems, however.)

Twitter ran into this issue when introducing Snowflake IDs, and decided
to instead introduce an `id_str` field in JSON responses. I have opted
to *not* do that, and instead force all IDs to 64-bit integers
represented by strings in one go. (I believe Twitter exacerbated their
problem by rolling out the changes three times: once for statuses, once
for DMs, and once for user IDs, as well as by leaving an integer ID
value in JSON. As they said, "If you’re using the `id` field with JSON
in a Javascript-related language, there is a very high likelihood that
the integers will be silently munged by Javascript interpreters. In most
cases, this will result in behavior such as being unable to load or
delete a specific direct message, because the ID you're sending to the
API is different than the actual identifier associated with the
message." [1]) However, given that this is a significant change for API
users, alternatives or a transition time may be appropriate.

1: https://blog.twitter.com/developer/en_us/a/2011/direct-messages-going-snowflake-on-sep-30-2011.html
2017-09-19 21:27:38 -05:00
..
activitypub Instantly upgrade account to ActivityPub if we receive ActivityPub payload (#4766) 2017-09-03 01:11:23 +02:00
admin Fix custom emojis index (#5006) 2017-09-19 05:06:13 +02:00
api Fix JavaScript interface with long IDs 2017-09-19 21:27:38 -05:00
auth Default follows for new users (#4871) 2017-09-10 09:58:38 +02:00
concerns Support more variations of ActivityPub keyId in signature (#4630) 2017-08-21 22:57:34 +02:00
oauth Fix #1165 - before_action was called before protect_from_forgery 2017-04-08 02:30:50 +02:00
settings authorize-follow-requests-after-unlocking (#4658) 2017-08-26 12:40:03 +02:00
well_known Ensure well_known controllers use WEB_DOMAIN by including RoutingHelper (#2388) 2017-06-02 22:21:36 +02:00
about_controller.rb Redesign the landing page, mount public timeline on it (#4122) 2017-07-11 15:27:59 +02:00
account_follow_controller.rb Restful refactor of accounts/ routes (#2133) 2017-04-19 13:52:37 +02:00
account_unfollow_controller.rb Restful refactor of accounts/ routes (#2133) 2017-04-19 13:52:37 +02:00
accounts_controller.rb Switch to static URIs, new URI format in both protocols for new statuses (#4815) 2017-09-06 19:01:28 +02:00
application_controller.rb Add "signed in as" header to some pages (#4523) 2017-08-05 04:24:58 +02:00
authorize_follows_controller.rb Add "signed in as" header to some pages (#4523) 2017-08-05 04:24:58 +02:00
follower_accounts_controller.rb Set correct content-type for ActivityPub JSON (#4592) 2017-08-14 04:16:43 +02:00
following_accounts_controller.rb Set correct content-type for ActivityPub JSON (#4592) 2017-08-14 04:16:43 +02:00
home_controller.rb When web UI URL used while logged out, redirect to static page (#4954) 2017-09-15 00:57:08 +02:00
intents_controller.rb Add protocol handler. Handle follow intents (#4511) 2017-08-14 04:53:31 +02:00
manifests_controller.rb Fix #3063 - Add dynamic app manifest (#3563) 2017-06-06 19:29:42 +02:00
media_controller.rb Extract authorization policy for viewing statuses (#3150) 2017-05-29 18:22:22 +02:00
media_proxy_controller.rb When accessing uncached media attachment, redownload it (#4955) 2017-09-16 03:01:45 +02:00
remote_follow_controller.rb Add "signed in as" header to some pages (#4523) 2017-08-05 04:24:58 +02:00
shares_controller.rb Make share intent modal to make "signed in as" shown. (#4611) 2017-08-16 16:48:44 +02:00
statuses_controller.rb Update status embeds (#4742) 2017-08-30 10:23:43 +02:00
stream_entries_controller.rb Update status embeds (#4742) 2017-08-30 10:23:43 +02:00
tags_controller.rb Set correct content-type for ActivityPub JSON (#4592) 2017-08-14 04:16:43 +02:00