Browse Source

Add ostatus conversation as context.

tags/v0.9.9
Roger Braun 7 years ago
parent
commit
b438ea24ee
3 changed files with 8 additions and 2 deletions
  1. +6
    -1
      lib/pleroma/web/ostatus/ostatus.ex
  2. +1
    -1
      lib/pleroma/web/twitter_api/twitter_api.ex
  3. +1
    -0
      test/web/ostatus/ostatus_test.exs

+ 6
- 1
lib/pleroma/web/ostatus/ostatus.ex View File

@@ -41,7 +41,12 @@ defmodule Pleroma.Web.OStatus do
[author] = :xmerl_xpath.string('/entry/author[1]', doc)
{:ok, actor} = find_or_make_user(author)

context = ActivityPub.generate_context_id
context = string_from_xpath("/entry/ostatus:conversation[1]", doc) |> String.trim
context = if String.length(context) > 0 do
context
else
ActivityPub.generate_context_id
end

to = [
"https://www.w3.org/ns/activitystreams#Public"


+ 1
- 1
lib/pleroma/web/twitter_api/twitter_api.ex View File

@@ -253,7 +253,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
{:error, changeset} ->
errors = Ecto.Changeset.traverse_errors(changeset, fn {msg, _opts} -> msg end)
|> Poison.encode!
{:error, %{error: errors}}
{:error, %{error: errors}}
end
end



+ 1
- 0
test/web/ostatus/ostatus_test.exs View File

@@ -9,6 +9,7 @@ defmodule Pleroma.Web.OStatusTest do
assert activity.data["type"] == "Create"
assert activity.data["object"]["type"] == "Note"
assert activity.data["published"] == "2017-04-23T14:51:03+00:00"
assert activity.data["context"] == "tag:gs.example.org:4040,2017-04-23:objectType=thread:nonce=f09e22f58abd5c7b"
end

describe "new remote user creation" do


Loading…
Cancel
Save