subscriptions: make invite-only checkbox have an effect.

(imported from commit 7ee5c5c88efa4ab21395c03012c2921fd3c5192e)
This commit is contained in:
Jessica McKellar 2013-01-30 17:12:23 -05:00
parent 1e8b378cd9
commit 6d880c2147
2 changed files with 6 additions and 4 deletions

View File

@ -388,14 +388,15 @@ function ajaxUnsubscribe(stream) {
});
}
function ajaxSubscribeForCreation(stream, principals) {
function ajaxSubscribeForCreation(stream, principals, invite_only) {
// Subscribe yourself and possible other people to a new stream.
$.ajax({
type: "POST",
url: "/json/subscriptions/add",
dataType: 'json', // This seems to be ignored. We still get back an xhr.
data: {"subscriptions": JSON.stringify([stream]),
"principals": JSON.stringify(principals)
"principals": JSON.stringify(principals),
"invite_only": JSON.stringify(invite_only)
},
success: function (data) {
$("#create_stream_name").val("");
@ -463,7 +464,7 @@ $(function () {
});
// You are always subscribed to streams you create.
principals.push(email);
ajaxSubscribeForCreation(stream, principals);
ajaxSubscribeForCreation(stream, principals, $('#invite-only').is(':checked'));
});
$("#subscriptions_table").on("click", ".sub_unsub_button", function (e) {

View File

@ -868,7 +868,8 @@ def get_public_streams_backend(request, user_profile):
type=Recipient.STREAM, id__in=subs_filter).values('type_id')
streams = sorted(stream.name for stream in
Stream.objects.filter(id__in = stream_ids,
realm=user_profile.realm))
realm=user_profile.realm,
invite_only=False))
return json_success({"streams": streams})
def get_stream_color(sub):