aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/formatter.ex
diff options
context:
space:
mode:
authorraeno <just.raeno@gmail.com>2018-12-13 22:16:54 +0100
committerraeno <just.raeno@gmail.com>2018-12-13 22:34:15 +0100
commitb5de7c4c4d90d1049b59381953cbd76e79b77e66 (patch)
tree9914b2b4fdc7dfd42bf481c8e3d1ce5bfeecf4bc /lib/pleroma/formatter.ex
parent018516d3f3fcc6e902a5382517792832841695d3 (diff)
downloadpleroma-b5de7c4c4d90d1049b59381953cbd76e79b77e66.tar.gz
Remove oembed for now, will submit it in another MR. Fix warnings
Diffstat (limited to 'lib/pleroma/formatter.ex')
-rw-r--r--lib/pleroma/formatter.ex6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
index b63f592fb..1d5dc0c99 100644
--- a/lib/pleroma/formatter.ex
+++ b/lib/pleroma/formatter.ex
@@ -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)