diff options
author | lain <lain@soykaf.club> | 2019-12-04 12:48:34 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-12-04 12:48:34 +0100 |
commit | aa97fe8f175c3618a04bb45e6aa7c37e26259577 (patch) | |
tree | 894b3cb5d9f332fb735858b0d85d19836a21e086 /lib/pleroma | |
parent | 7722e5a67a46304f3ae0e37f674a44ca9268be5e (diff) | |
download | pleroma-aa97fe8f175c3618a04bb45e6aa7c37e26259577.tar.gz |
ChatChannel: Ignore messages that are too long.
Diffstat (limited to 'lib/pleroma')
-rw-r--r-- | lib/pleroma/application.ex | 2 | ||||
-rw-r--r-- | lib/pleroma/web/chat_channel.ex | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/lib/pleroma/application.ex b/lib/pleroma/application.ex index 9dbd1e26b..57462740c 100644 --- a/lib/pleroma/application.ex +++ b/lib/pleroma/application.ex @@ -147,8 +147,6 @@ defmodule Pleroma.Application do defp oauth_cleanup_child(_), do: [] - defp chat_child(:test, _), do: [] - defp chat_child(_env, true) do [Pleroma.Web.ChatChannel.ChatChannelState] end diff --git a/lib/pleroma/web/chat_channel.ex b/lib/pleroma/web/chat_channel.ex index 08841a3e8..840414933 100644 --- a/lib/pleroma/web/chat_channel.ex +++ b/lib/pleroma/web/chat_channel.ex @@ -20,7 +20,7 @@ defmodule Pleroma.Web.ChatChannel do def handle_in("new_msg", %{"text" => text}, %{assigns: %{user_name: user_name}} = socket) do text = String.trim(text) - if String.length(text) > 0 do + if String.length(text) in 1..Pleroma.Config.get([:instance, :chat_limit]) do author = User.get_cached_by_nickname(user_name) author = Pleroma.Web.MastodonAPI.AccountView.render("show.json", user: author) message = ChatChannelState.add_message(%{text: text, author: author}) |