Resolve merge conflict
authorrinpatch <rinpatch@sdf.org>
Sun, 13 Jan 2019 10:38:28 +0000 (13:38 +0300)
committerrinpatch <rinpatch@sdf.org>
Sun, 13 Jan 2019 10:38:28 +0000 (13:38 +0300)
1  2 
config/config.exs
lib/pleroma/formatter.ex
lib/pleroma/user.ex
lib/pleroma/web/ostatus/ostatus_controller.ex
lib/pleroma/web/router.ex
mix.exs
test/web/ostatus/ostatus_controller_test.exs

Simple merge
Simple merge
index c86ad4afee38238172ef9bd32935eaa051d8cfe1,68128053903e5f070b3a88413f3010e8a2f9ab7f..3120b13b63bd5018523f42c4fbe0712cdb345cbb
@@@ -334,12 -444,12 +453,16 @@@ defmodule Pleroma.User d
      Cachex.fetch!(:user_cache, key, fn _ -> get_or_fetch_by_nickname(nickname) end)
    end
  
 +  def get_cached_by_nickname_or_id(nickname_or_id) do
 +    get_cached_by_nickname(nickname_or_id) || get_cached_by_id(nickname_or_id)
 +  end
 +
    def get_by_nickname(nickname) do
-     Repo.get_by(User, nickname: nickname)
+     Repo.get_by(User, nickname: nickname) ||
+       if Regex.match?(~r(@#{Pleroma.Web.Endpoint.host()})i, nickname) do
+         [local_nickname, _] = String.split(nickname, "@")
+         Repo.get_by(User, nickname: local_nickname)
+       end
    end
  
    def get_by_nickname_or_email(nickname_or_email) do
Simple merge
diff --cc mix.exs
Simple merge
index e9e9bdb169b12064fe4727be67775ba9271d3305,995cc00d6359973393a0c1f6f5dd9a684d6d0498..8e9d2b69ae7055f6a650efdd6d4a8d51f64b21f3
@@@ -111,16 -114,31 +115,32 @@@ defmodule Pleroma.Web.OStatus.OStatusCo
      |> response(404)
    end
  
 -  test "gets an activity", %{conn: conn} do
 -    note_activity = insert(:note_activity)
 -    [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"]))
 -
 -    conn
 -    |> get("/activities/#{uuid}")
 -    |> response(200)
 -  end
 -
 +  test "gets an activity in xml format", %{conn: conn} do
 +    note_activity = insert(:note_activity)
 +    [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"]))
 +
 +    conn
 +    |> put_req_header("accept", "application/xml")
 +    |> get("/activities/#{uuid}")
 +    |> response(200)
 +  end
 +
+   test "404s on deleted objects", %{conn: conn} do
+     note_activity = insert(:note_activity)
+     [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["object"]["id"]))
+     object = Object.get_by_ap_id(note_activity.data["object"]["id"])
+     conn
+     |> get("/objects/#{uuid}")
+     |> response(200)
+     Object.delete(object)
+     conn
+     |> get("/objects/#{uuid}")
+     |> response(404)
+   end
    test "404s on private activities", %{conn: conn} do
      note_activity = insert(:direct_note_activity)
      [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"]))