mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Display the email address for a stream in its stream page detail.
For now, only show it on staging. (imported from commit fd07fad1c34578d8ddc2cddd1bb6bdcb72f354de)
This commit is contained in:
		@@ -7,6 +7,7 @@ exports.summarize_read_while_narrowed = page_params.staging;
 | 
			
		||||
exports.twenty_four_hour_time = _.contains([],
 | 
			
		||||
                                  page_params.email);
 | 
			
		||||
exports.dropbox_integration = page_params.staging || _.contains(['dropbox.com'], page_params.domain);
 | 
			
		||||
exports.email_forwarding = page_params.staging;
 | 
			
		||||
return exports;
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -210,8 +210,9 @@ exports.show_settings_for = function (stream_name) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function add_sub_to_table(sub) {
 | 
			
		||||
    $('#create_stream_row').after(
 | 
			
		||||
        templates.render('subscription', sub));
 | 
			
		||||
    $('#create_stream_row').after(templates.render(
 | 
			
		||||
        'subscription',
 | 
			
		||||
        _.extend(sub, {'show_email_token': feature_flags.email_forwarding})));
 | 
			
		||||
    settings_for_sub(sub).collapse('show');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -363,7 +364,8 @@ function populate_subscriptions(subs, subscribed) {
 | 
			
		||||
        var stream_name = elem.name;
 | 
			
		||||
        var sub = create_sub(stream_name, {color: elem.color, in_home_view: elem.in_home_view,
 | 
			
		||||
                                           invite_only: elem.invite_only,
 | 
			
		||||
                                           notifications: elem.notifications, subscribed: subscribed});
 | 
			
		||||
                                           notifications: elem.notifications, subscribed: subscribed,
 | 
			
		||||
                                           email_address: elem.email_address});
 | 
			
		||||
        sub_rows.push(sub);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -432,6 +434,9 @@ exports.setup_page = function () {
 | 
			
		||||
            if (!sub) {
 | 
			
		||||
                sub = create_sub(stream, {subscribed: false});
 | 
			
		||||
            }
 | 
			
		||||
            if (feature_flags.email_forwarding) {
 | 
			
		||||
                sub = _.extend(sub, {'show_email_token': feature_flags.email_forwarding});
 | 
			
		||||
            }
 | 
			
		||||
            sub_rows.push(sub);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,11 @@
 | 
			
		||||
          </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
      </div>
 | 
			
		||||
      {{#if_and show_email_token subscribed}}
 | 
			
		||||
      <div>
 | 
			
		||||
          <p><b>Email address</b>: <tt>{{email_address}}</tt></p>
 | 
			
		||||
      </div>
 | 
			
		||||
      {{/if_and}}
 | 
			
		||||
      {{#render_subscribers}}
 | 
			
		||||
      <div class="subscriber_list_settings">
 | 
			
		||||
        <span class="sub_settings_title">Members</span>
 | 
			
		||||
 
 | 
			
		||||
@@ -550,7 +550,8 @@ def notify_subscriptions_added(user_profile, sub_pairs, no_log=False):
 | 
			
		||||
    payload = [dict(name=stream.name,
 | 
			
		||||
                    in_home_view=subscription.in_home_view,
 | 
			
		||||
                    invite_only=stream.invite_only,
 | 
			
		||||
                    color=subscription.color)
 | 
			
		||||
                    color=subscription.color,
 | 
			
		||||
                    email_address=encode_email_address(stream))
 | 
			
		||||
            for (subscription, stream) in sub_pairs]
 | 
			
		||||
    notice = dict(event=dict(type="subscriptions", op="add",
 | 
			
		||||
                             subscriptions=payload),
 | 
			
		||||
@@ -1070,18 +1071,19 @@ def gather_subscriptions(user_profile):
 | 
			
		||||
 | 
			
		||||
    stream_hash = {}
 | 
			
		||||
    for stream in Stream.objects.filter(id__in=stream_ids):
 | 
			
		||||
        stream_hash[stream.id] = (stream.name, stream.invite_only)
 | 
			
		||||
        stream_hash[stream.id] = stream
 | 
			
		||||
 | 
			
		||||
    subscribed = []
 | 
			
		||||
    unsubscribed = []
 | 
			
		||||
 | 
			
		||||
    for sub in subs:
 | 
			
		||||
        (stream_name, invite_only) = stream_hash[sub.recipient.type_id]
 | 
			
		||||
        stream = {'name': stream_name,
 | 
			
		||||
        stream = stream_hash[sub.recipient.type_id]
 | 
			
		||||
        stream = {'name': stream.name,
 | 
			
		||||
                  'in_home_view': sub.in_home_view,
 | 
			
		||||
                  'invite_only': invite_only,
 | 
			
		||||
                  'invite_only': stream.invite_only,
 | 
			
		||||
                  'color': sub.color,
 | 
			
		||||
                  'notifications': sub.notifications}
 | 
			
		||||
                  'notifications': sub.notifications,
 | 
			
		||||
                  'email_address': encode_email_address(stream)}
 | 
			
		||||
        if sub.active:
 | 
			
		||||
            subscribed.append(stream)
 | 
			
		||||
        else:
 | 
			
		||||
 
 | 
			
		||||
@@ -872,6 +872,7 @@ class SubscriptionPropertiesTest(AuthedTestCase):
 | 
			
		||||
        stream_name = sub['name']
 | 
			
		||||
        old_color = sub['color']
 | 
			
		||||
        invite_only = sub['invite_only']
 | 
			
		||||
        email_address = sub['email_address']
 | 
			
		||||
        new_color = "#ffffff" # TODO: ensure that this is different from old_color
 | 
			
		||||
        result = self.client.post("/json/subscriptions/property",
 | 
			
		||||
                                  {"property": "color",
 | 
			
		||||
@@ -882,7 +883,8 @@ class SubscriptionPropertiesTest(AuthedTestCase):
 | 
			
		||||
 | 
			
		||||
        new_subs = gather_subscriptions(get_user_profile_by_email(test_email))[0]
 | 
			
		||||
        sub = {'name': stream_name, 'in_home_view': True, 'color': new_color,
 | 
			
		||||
               'invite_only': invite_only, 'notifications': False}
 | 
			
		||||
               'invite_only': invite_only, 'notifications': False,
 | 
			
		||||
               'email_address': email_address}
 | 
			
		||||
        self.assertIn(sub, new_subs)
 | 
			
		||||
 | 
			
		||||
        new_subs.remove(sub)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user