mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	stream settings: Update subscription count on subscription event.
On subscription add or removal event, render subscription count template in case of user can't access subscribers.
This commit is contained in:
		@@ -152,7 +152,13 @@ exports.set_color = function (stream_id, color) {
 | 
			
		||||
exports.rerender_subscribers_count = function (sub) {
 | 
			
		||||
    var id = parseInt(sub.stream_id, 10);
 | 
			
		||||
    stream_data.update_subscribers_count(sub);
 | 
			
		||||
    $(".stream-row[data-stream-id='" + id + "'] .subscriber-count-text").text(sub.subscriber_count);
 | 
			
		||||
    if (sub.can_add_subscribers) {
 | 
			
		||||
        $(".stream-row[data-stream-id='" + id + "'] .subscriber-count-text").text(sub.subscriber_count);
 | 
			
		||||
    } else {
 | 
			
		||||
        var sub_count = templates.render("subscription_count", sub);
 | 
			
		||||
        var stream_row = row_for_stream_id(sub.stream_id);
 | 
			
		||||
        stream_row.find('.subscriber-count').expectOne().html(sub_count);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function add_email_hint(row, email_address_hint_content) {
 | 
			
		||||
 
 | 
			
		||||
@@ -11,12 +11,7 @@
 | 
			
		||||
        <div class="top-bar">
 | 
			
		||||
            <div class="stream-name">{{name}}</div>
 | 
			
		||||
            <div class="subscriber-count">
 | 
			
		||||
                {{#if can_add_subscribers}}
 | 
			
		||||
                <i class="icon-vector-user"></i>
 | 
			
		||||
                <span class="subscriber-count-text">{{subscriber_count}}</span>
 | 
			
		||||
                {{else}}
 | 
			
		||||
                <i class="subscriber-count-lock icon-vector-lock"></i>
 | 
			
		||||
                {{/if}}
 | 
			
		||||
                {{partial "subscription_count"}}
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="description" data-no-description="{{t 'No description.'}}">{{{rendered_description}}}</div>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								static/templates/subscription_count.handlebars
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								static/templates/subscription_count.handlebars
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
{{#if can_add_subscribers}}
 | 
			
		||||
<i class="icon-vector-user"></i>
 | 
			
		||||
<span class="subscriber-count-text">{{subscriber_count}}</span>
 | 
			
		||||
{{else}}
 | 
			
		||||
<i class="subscriber-count-lock icon-vector-lock"></i>
 | 
			
		||||
{{/if}}
 | 
			
		||||
		Reference in New Issue
	
	Block a user