assert represented["profile_image_url"] == image
end
+ test "A user with emoji in username", %{user: user} do
+ expected =
+ "<img height=\"32px\" width=\"32px\" alt=\"karjalanpiirakka\" title=\"karjalanpiirakka\" src=\"/file.png\" /> man"
+
+ user = %{
+ user
+ | info: %{
+ "source_data" => %{
+ "tag" => [
+ %{
+ "type" => "Emoji",
+ "icon" => %{"url" => "/file.png"},
+ "name" => ":karjalanpiirakka:"
+ }
+ ]
+ }
+ }
+ }
+
+ user = %{user | name: ":karjalanpiirakka: man"}
+ represented = UserView.render("show.json", %{user: user})
+ assert represented["name_html"] == expected
+ end
+
test "A user" do
note_activity = insert(:note_activity)
user = User.get_cached_by_ap_id(note_activity.data["actor"])
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 1,
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: user})
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: user, for: follower})
"id" => follower.id,
"name" => follower.name,
"screen_name" => follower.nickname,
- "description" => HtmlSanitizeEx.strip_tags(follower.bio),
+ "name_html" => follower.name,
+ "description" => HtmlSanitizeEx.strip_tags(follower.bio |> String.replace("<br>", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(follower.bio),
"created_at" => follower.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,
"statusnet_profile_url" => follower.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
assert represented == UserView.render("show.json", %{user: follower, for: user})
"id" => user.id,
"name" => user.name,
"screen_name" => user.nickname,
- "description" => HtmlSanitizeEx.strip_tags(user.bio),
+ "name_html" => user.name,
+ "description" => HtmlSanitizeEx.strip_tags(user.bio |> String.replace("<br>", "\n")),
+ "description_html" => HtmlSanitizeEx.basic_html(user.bio),
"created_at" => user.inserted_at |> Utils.format_naive_asctime(),
"favourites_count" => 0,
"statuses_count" => 0,
"statusnet_profile_url" => user.ap_id,
"cover_photo" => banner,
"background_image" => nil,
- "is_local" => true
+ "is_local" => true,
+ "locked" => false,
+ "default_scope" => "public"
}
blocker = Repo.get(User, blocker.id)