diff options
| author | Ilja <domainepublic@spectraltheorem.be> | 2020-08-02 15:54:59 +0200 |
|---|---|---|
| committer | Ilja <domainepublic@spectraltheorem.be> | 2020-08-02 15:54:59 +0200 |
| commit | f671d7e68c77e5d41dd0716f48f387561efc3999 (patch) | |
| tree | bc0dd5b322743634ff66acd19f6d3a1350a32ee3 /test/user | |
| parent | 8ca993c789fb3d41450419fc49bfa22542368ba8 (diff) | |
| download | pleroma-f671d7e68c77e5d41dd0716f48f387561efc3999.tar.gz pleroma-f671d7e68c77e5d41dd0716f48f387561efc3999.zip | |
Add welcome chatmessages
* I added the option in config/config.exs
* created a new module lib/pleroma/user/welcome_chat_message.ex
* Added it to the registration flow
* added to the cheatsheet
* added to the config/description.ex
* added to the Changelog.md
Diffstat (limited to 'test/user')
| -rw-r--r-- | test/user/welcome_chat_massage_test.exs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/user/welcome_chat_massage_test.exs b/test/user/welcome_chat_massage_test.exs new file mode 100644 index 000000000..3fef6fa6d --- /dev/null +++ b/test/user/welcome_chat_massage_test.exs @@ -0,0 +1,35 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.User.WelcomeChatMessageTest do + use Pleroma.DataCase + + alias Pleroma.Config + alias Pleroma.User.WelcomeChatMessage + + import Pleroma.Factory + + setup do: clear_config([:welcome]) + + describe "post_message/1" do + test "send a chat welcome message" do + welcome_user = insert(:user) + user = insert(:user, name: "mewmew") + + Config.put([:welcome, :chat_message, :enabled], true) + Config.put([:welcome, :chat_message, :sender_nickname], welcome_user.nickname) + + Config.put( + [:welcome, :chat_message, :message], + "Hello. Welcome to blob.cat" + ) + + {:ok, %Pleroma.Activity{} = activity} = WelcomeChatMessage.post_message(user) + + assert user.ap_id in activity.recipients + assert Pleroma.Object.normalize(activity).data["type"] == "ChatMessage" + assert Pleroma.Object.normalize(activity).data["content"] =~ "Hello. Welcome to " + end + end +end |
