bots: Add a setting to customize the Welcome Bot message.

This commit includes the following changes:
- Add an administrator setting to customize the Welcome Bot
message when sending an invitation.
- Add an API endpoint to test the customized Welcome Bot message
by sending a copy of the message to the administrator.

Fixes #27663.

Co-authored-by: Akarsh Jain <akarsh.jain.790@gmail.com>
This commit is contained in:
Saubhagya Patel
2025-07-30 19:57:50 +05:30
committed by Tim Abbott
parent 4cafe5f77c
commit bb5c87e306
35 changed files with 988 additions and 32 deletions

View File

@@ -165,6 +165,7 @@ class Realm(models.Model):
MAX_REALM_DESCRIPTION_LENGTH = 1000
MAX_REALM_SUBDOMAIN_LENGTH = 40
MAX_REALM_REDIRECT_URL_LENGTH = 128
MAX_REALM_WELCOME_MESSAGE_CUSTOM_TEXT_LENGTH = 8000
INVITES_STANDARD_REALM_DAILY_MAX = 3000
MESSAGE_VISIBILITY_LIMITED = 10000
@@ -239,6 +240,8 @@ class Realm(models.Model):
email_changes_disabled = models.BooleanField(default=False)
avatar_changes_disabled = models.BooleanField(default=False)
welcome_message_custom_text = models.TextField(default="")
POLICY_MEMBERS_ONLY = 1
POLICY_ADMINS_ONLY = 2
POLICY_FULL_MEMBERS_ONLY = 3
@@ -734,6 +737,7 @@ class Realm(models.Model):
video_chat_provider=int,
waiting_period_threshold=int,
want_advertise_in_communities_directory=bool,
welcome_message_custom_text=str,
)
REALM_PERMISSION_GROUP_SETTINGS: dict[str, GroupPermissionSetting] = dict(