ap_id
end
- short_match = String.split(match, "@") |> tl() |> hd()
+ full_match = String.trim_leading(match, "@")
{uuid,
- "<span class='h-card'><a data-user='#{id}' class='u-url mention' href='#{ap_id}'>@<span>#{
- short_match
- }</span></a></span>"}
+ "<span class='h-card'><a data-user='#{id}' class='u-url mention' href='#{ap_id}'>" <>
+ "@<span>#{full_match}</span></a></span>"}
end)
{subs, uuid_text}
archaeme.id
}' class='u-url mention' href='#{"https://archeme/@archa_eme_"}'>@<span>archa_eme_</span></a></span>, that is @daggsy. Also hello <span class='h-card'><a data-user='#{
archaeme_remote.id
- }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme</span></a></span>"
+ }' class='u-url mention' href='#{archaeme_remote.ap_id}'>@<span>archaeme@archae.me</span></a></span>"
assert expected_text == Formatter.finalize({subs, text})
end
Enum.each(subs, fn {uuid, _} -> assert String.contains?(text, uuid) end)
expected_text =
- "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike</span></a></span> test"
+ "<span class='h-card'><a data-user='#{mike.id}' class='u-url mention' href='#{mike.ap_id}'>@<span>mike@osada.macgirvin.com</span></a></span> test"
assert expected_text == Formatter.finalize({subs, text})
end