diff options
Diffstat (limited to 'lib/pleroma/formatter.ex')
-rw-r--r-- | lib/pleroma/formatter.ex | 6 |
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) |