message_send: Fix old guests being treated as full members.

For streams in which only full members are allowed to post,
we block guest users from posting there.

Guests users were blocked from posting to admin only streams
already. So now, guest users can only post to
STREAM_POST_POLICY_EVERYONE streams.

This is not a new feature but a bugfix which should have
happened when implementing full member stream policy / guest users.
This commit is contained in:
Aman Agrawal
2020-10-09 00:00:11 +05:30
committed by GitHub
parent 6fe82620df
commit 8b419c93e4
4 changed files with 53 additions and 2 deletions

View File

@@ -544,6 +544,11 @@ function validate_stream_message_post_policy(sub) {
return false;
}
if (page_params.is_guest && stream_post_policy !== stream_post_permission_type.everyone.code) {
compose_error(i18n.t("Guests are not allowed to post to this stream."));
return false;
}
const person = people.get_by_user_id(page_params.user_id);
const current_datetime = new Date(Date.now());
const person_date_joined = new Date(person.date_joined);