Use the user.id instead of nickname in report URLs

Ensures links to profiles of remote users work.
This commit is contained in:
feld 2019-10-06 14:13:04 +00:00 committed by Ariadne Conill
parent 294e08cb65
commit 2a2d834ff7
3 changed files with 4 additions and 3 deletions

View file

@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- ActivityPub: Correct addressing of Undo. - ActivityPub: Correct addressing of Undo.
- ActivityPub: Correct addressing of profile update activities. - ActivityPub: Correct addressing of profile update activities.
- Mastodon API: Ensure the `account` field is not empty when rendering Notification entities. - Mastodon API: Ensure the `account` field is not empty when rendering Notification entities.
- Report emails now include functional links to profiles of remote user accounts
### Removed ### Removed
- ActivityPub: The `/objects/:uuid/likes` endpoint. - ActivityPub: The `/objects/:uuid/likes` endpoint.

View file

@ -17,7 +17,7 @@ defp instance_notify_email do
end end
defp user_url(user) do defp user_url(user) do
Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, user.nickname) Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, user.id)
end end
def report(to, reporter, account, statuses, comment) do def report(to, reporter, account, statuses, comment) do

View file

@ -19,8 +19,8 @@ test "build report email" do
AdminEmail.report(to_user, reporter, account, [%{name: "Test", id: "12"}], "Test comment") AdminEmail.report(to_user, reporter, account, [%{name: "Test", id: "12"}], "Test comment")
status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, "12") status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, "12")
reporter_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, reporter.nickname) reporter_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, reporter.id)
account_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, account.nickname) account_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :feed_redirect, account.id)
assert res.to == [{to_user.name, to_user.email}] assert res.to == [{to_user.name, to_user.email}]
assert res.from == {config[:name], config[:notify_email]} assert res.from == {config[:name], config[:notify_email]}