stream: Fix message on clicking add button with empty subscribers form.

This commit corrects the message shown when we click the add button
for subscribing users to stream with empty input.
We show 'No user to subscribe.' as the message when trying to add
subscribers with empty input.

Fixes #15450.
This commit is contained in:
sahil839 2020-06-19 22:16:40 +05:30 committed by Tim Abbott
parent 3e1a0c0e32
commit 318bc0ca1e
1 changed files with 6 additions and 0 deletions

View File

@ -636,6 +636,12 @@ exports.initialize = function () {
const user_ids = user_pill.get_user_ids(exports.pill_widget);
const stream_subscription_info_elem = $('.stream_subscription_info').expectOne();
if (user_ids.length === 0) {
stream_subscription_info_elem.text(i18n.t("No user to subscribe."))
.addClass("text-error").removeClass("text-success");
return;
}
function invite_success(data) {
exports.pill_widget.clear();
if (!Object.entries(data.already_subscribed).length) {