diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-06-25 11:57:34 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-06-25 11:57:34 +0200 |
commit | 429992fcc921a15f853d08b975682499d83dea99 (patch) | |
tree | a01b5ac1c3cc2a19a1ad8a9702f018361f6352bf /lib | |
parent | 7dca02f93aa5dbc257f7d8f5b400642bae332545 (diff) | |
download | pleroma-429992fcc921a15f853d08b975682499d83dea99.tar.gz |
Save external link for notes.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/ostatus/handlers/note_handler.ex | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/pleroma/web/ostatus/handlers/note_handler.ex b/lib/pleroma/web/ostatus/handlers/note_handler.ex index 0abc0ac5c..82e60676f 100644 --- a/lib/pleroma/web/ostatus/handlers/note_handler.ex +++ b/lib/pleroma/web/ostatus/handlers/note_handler.ex @@ -49,6 +49,11 @@ defmodule Pleroma.Web.OStatus.NoteHandler do ] ++ mentions end + def add_external_url(note, entry) do + url = XML.string_from_xpath("//link[@rel='alternate' and @type='text/html']/@href", entry) + Map.put(note, "external_url", url) + end + def handle_note(entry, doc \\ nil) do with id <- XML.string_from_xpath("//id", entry), activity when is_nil(activity) <- Activity.get_create_activity_by_object_ap_id(id), @@ -67,6 +72,7 @@ defmodule Pleroma.Web.OStatus.NoteHandler do note <- TwitterAPI.Utils.make_note_data(actor.ap_id, to, context, content_html, attachments, inReplyToActivity, []), note <- note |> Map.put("id", id) |> Map.put("tag", tags), note <- note |> Map.put("published", date), + note <- add_external_url(note, entry), # TODO: Handle this case in make_note_data note <- (if inReplyTo && !inReplyToActivity, do: note |> Map.put("inReplyTo", inReplyTo), else: note) do |