1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.User.WelcomeMessage do
7 alias Pleroma.Web.CommonAPI
9 def post_welcome_message_to_user(user) do
10 with %User{} = sender_user <- welcome_user(),
11 message when is_binary(message) <- welcome_message() do
12 CommonAPI.post(sender_user, %{
14 status: "@#{user.nickname}\n#{message}"
22 with nickname when is_binary(nickname) <-
23 Pleroma.Config.get([:instance, :welcome_user_nickname]),
24 %User{local: true} = user <- User.get_cached_by_nickname(nickname) do
31 defp welcome_message do
32 Pleroma.Config.get([:instance, :welcome_message])