org_settings: Add backend for realm_jitsi_server_url setting.

This commit adds a `jitsi_server_url` field to the Realm model, which
will be used to save the URL of the custom Jitsi Meet server. In
the database, `None` will encode the server-level default. We can't
readily use `None` in the API, as it could be confused with "field not
sent". Therefore, we will use the string "default" for this purpose.

We have also introduced `server_jitsi_server_url` in the `/register`
API. This will be used to display the server's default Jitsi server
URL in the settings UI.

The existing `jitsi_server_url` will now be calculated as
`realm_jitsi_server_url || server_jitsi_server_url`.

Fixes a part of #17914.

Co-authored-by: Gaurav Pandey <gauravguitarrocks@gmail.com>
This commit is contained in:
Hemant Umre
2023-09-19 22:33:08 +05:30
committed by Tim Abbott
parent cb0aaa5197
commit be653dd5b4
11 changed files with 181 additions and 8 deletions

View File

@@ -671,6 +671,9 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
default=VIDEO_CHAT_PROVIDERS["jitsi_meet"]["id"]
)
JITSI_SERVER_SPECIAL_VALUES_MAP = {"default": None}
jitsi_server_url = models.URLField(null=True, default=None)
# Please access this via get_giphy_rating_options.
GIPHY_RATING_OPTIONS = {
"disabled": {
@@ -740,6 +743,7 @@ class Realm(models.Model): # type: ignore[django-manager-missing] # django-stub
invite_required=bool,
invite_to_realm_policy=int,
invite_to_stream_policy=int,
jitsi_server_url=(str, type(None)),
mandatory_topics=bool,
message_content_allowed_in_email_notifications=bool,
message_content_edit_limit_seconds=(int, type(None)),