]> cat aescling's git repositories - mastodon.git/commit
Improve searching for private toots from URL (#14856)
authorThibG <thib@sitedethib.com>
Thu, 17 Dec 2020 05:51:49 +0000 (06:51 +0100)
committerGitHub <noreply@github.com>
Thu, 17 Dec 2020 05:51:49 +0000 (06:51 +0100)
commitb1feb47055c121c1b6949bd7ef6734bf56c847bd
tree7d73046847b67fc40a8d05cade4de98f6c180fb5
parent2032748050b5ed1491473886107f622eea8e0c3f
Improve searching for private toots from URL (#14856)

* Improve searching for private toots from URL

Most of the time, when sharing toots, people use the toot URL rather than
the toot URI, which makes sense since it is the user-facing URL.

In Mastodon's case, the URL and URI are different, and Mastodon does not
have an index on URL, which means searching a private toot by URL is done
with a slow query that will only succeed for very recent toots.

This change gets rid of the slow query, and attempts to guess the URI from
URL instead, as Mastodon's are predictable.

* Add tests

* Only return status with guessed uri if url matches

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
app/services/resolve_url_service.rb
spec/services/resolve_url_service_spec.rb