mirror of https://github.com/zulip/zulip.git
stream settings: Display edit icon only if user is allowed to edit.
Only show edit option for stream name and description if user is admin and either stream is public or stream is private and admin is subscribed to private stream. As per backend restrictions for editing stream name/description.
This commit is contained in:
parent
335bed15ee
commit
690e82e624
|
@ -166,6 +166,10 @@ exports.render_stream_description = function (sub) {
|
|||
|
||||
exports.update_calculated_fields = function (sub) {
|
||||
sub.is_admin = page_params.is_admin;
|
||||
// Admin can change stream name/description either stream is public or
|
||||
// stream is private and admin is subscribed to private stream.
|
||||
sub.can_change_name_description = page_params.is_admin &&
|
||||
(!sub.invite_only || (sub.invite_only && sub.subscribed));
|
||||
sub.can_make_public = page_params.is_admin && sub.invite_only && sub.subscribed;
|
||||
sub.can_make_private = page_params.is_admin && !sub.invite_only;
|
||||
sub.preview_url = narrow.by_stream_uri(sub.name);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{{/if}}
|
||||
<div class="stream-name">
|
||||
<span class="stream-name-editable editable-section">{{name}}</span>
|
||||
{{#if is_admin}}
|
||||
{{#if can_change_name_description}}
|
||||
<span class="editable" data-make-editable=".stream-name-editable"></span>
|
||||
<span class="checkmark" data-finish-editing=".stream-name-editable">✓</span>
|
||||
{{/if}}
|
||||
|
@ -25,7 +25,7 @@
|
|||
</div>
|
||||
<div class="stream-description" data-no-description="{{t 'No description.' }}">
|
||||
<span class="stream-description-editable editable-section">{{{rendered_description}}}</span>
|
||||
{{#if is_admin}}
|
||||
{{#if can_change_name_description}}
|
||||
<span class="editable" data-make-editable=".stream-description-editable"></span>
|
||||
<span class="checkmark" data-finish-editing=".stream-description-editable">✓</span>
|
||||
{{/if}}
|
||||
|
|
Loading…
Reference in New Issue