Remove oembed for now, will submit it in another MR. Fix warnings

This commit is contained in:
raeno 2018-12-13 22:16:54 +01:00
commit b5de7c4c4d
11 changed files with 22 additions and 164 deletions

View file

@ -165,14 +165,16 @@ defmodule Pleroma.Formatter do
end
def truncate(text, opts \\ []) do
max_length = opts[:max_length] || 200
omission = opts[:omission] || "..."
max_length = opts[:max_length] || 200
omission = opts[:omission] || "..."
cond do
not String.valid?(text) ->
text
String.length(text) < max_length ->
text
true ->
length_with_omission = max_length - String.length(omission)