channel: Add option to notify users newly added to a channel.

When a user is added to a channel, we send
the user that was added a Notification Bot
DMs to let them know about it.

In this commit, we add an option for whether or not
this message is sent.

If more than 100 users are added at once, we
do not send notification bot DMs since it would
be a performance-costly operation.

We also send this threshold value of 100 in the
initial state data to the clients.

Fixes part of #31189
This commit is contained in:
Kislay Verma
2025-06-25 20:30:18 +05:30
committed by Tim Abbott
parent 9e854edd70
commit f448890158
9 changed files with 94 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ import {$t} from "./i18n.ts";
import * as information_density from "./information_density.ts";
import * as people from "./people.ts";
import * as settings_config from "./settings_config.ts";
import {realm} from "./state_data.ts";
import * as stream_data from "./stream_data.ts";
import * as ui_util from "./ui_util.ts";
import {user_settings} from "./user_settings.ts";
@@ -834,4 +835,26 @@ export function initialize(): void {
instance.destroy();
},
});
tippy.delegate("body", {
target: ".send_notification_to_new_subscribers_container.control-label-disabled",
trigger: "mouseenter",
placement: "top",
appendTo: () => document.body,
onShow(instance) {
const content = $t(
{
defaultMessage:
"Notification message cannot be sent when subscribing more than {max_users} users.",
},
{
max_users: realm.max_bulk_new_subscription_messages,
},
);
instance.setContent(content);
},
onHidden(instance) {
instance.destroy();
},
});
}