zulip/static/templates/message_edit_form.hbs
Ganesh Pawar ddf2127035 widgets: Prevent edits to widgets.
As of now, editing a widget doesn't update the rendered content.
It's important to ensure that existing votes or options added later on
don't get deleted when rendered.
This seems more complex than it's worth.

For now, we just prevent edits to widgets.
This commit makes the UI clearer that editing widgets isn't allowed.

See also:
https://github.com/zulip/zulip/issues/14229
https://github.com/zulip/zulip/issues/14799

Fixes #17156
2021-04-30 09:55:25 -07:00

79 lines
4.7 KiB
Handlebars

{{! Client-side Mustache template for rendering the message edit form. }}
<form id="edit_form_{{message_id}}" class="form-horizontal new-style">
<div class="alert" id="message-edit-send-status-{{message_id}}">
<span class="send-status-close">&times;</span>
<span class="error-msg"></span>
</div>
{{#if is_stream}}
<div class="control-group no-margin">
<div class="controls edit-controls">
<div class="message_edit_header">
<div class="stream_header_colorblock" {{#unless show_edit_stream}}style="display:none"{{/unless}}></div>
<select class="select_edit_stream" id="select_stream_id_{{ message_id }}" {{#unless show_edit_stream}}style="display:none"{{/unless}}>
<option value="{{ stream_id }}" selected='selected'>#{{ stream_name }}</option>
{{#each available_streams}}
<option value="{{ this.stream_id }}">#{{this.name}}</option>
{{/each}}
</select>
<i class="fa fa-angle-right" aria-hidden="true" {{#unless show_edit_stream}}style="display:none"{{/unless}}></i>
<input type="text" placeholder="{{topic}}" value="{{topic}}" class="message_edit_topic" id="message_edit_topic" />
<div class="message_edit_breadcrumb_messages" style='display:none;'>
<label class="checkbox">
<input class="send_notification_to_new_thread" name="send_notification_to_new_thread" type="checkbox" {{#if notify_new_thread}}checked="checked"{{/if}} />
<span></span>
</label>
<label for="send_notification_to_new_thread">{{t "Send notification to new topic" }}</label>
<div class="break-row"></div> <!-- break -->
<label class="checkbox">
<input class="send_notification_to_old_thread" name="send_notification_to_old_thread" type="checkbox" {{#if notify_old_thread}}checked="checked"{{/if}} />
<span></span>
</label>
<label for="send_notification_to_old_thread">{{t "Send notification to old topic" }}</label>
</div>
<select class='message_edit_topic_propagate' style='display:none;'>
<option selected="selected" value="change_later"> {{t "Change later messages to this topic" }}</option>
<option value="change_one"> {{t "Change only this message topic" }}</option>
<option value="change_all"> {{t "Change previous and following messages to this topic" }}</option>
</select>
</div>
</div>
</div>
{{/if}}
<div class="control-group no-margin">
<div class="controls edit-controls">
{{> copy_message_button message_id=this.message_id}}
<textarea class="message_edit_content" maxlength="10000">{{content}}</textarea>
<div class="scrolling_list preview_message_area" id="preview_message_area_{{message_id}}" style="display:none;">
<div class="markdown_preview_spinner"></div>
<div class="preview_content rendered_markdown"></div>
</div>
</div>
</div>
<div class="control-group action-buttons">
<div class="message_edit_spinner"></div>
<div class="controls edit-controls">
{{#if is_editable}}
<button type="button" class="button small rounded sea-green message_edit_save">{{t "Save" }}</button>
<button type="button" class="button small rounded message_edit_cancel">{{t "Cancel" }}</button>
{{#if is_content_editable}}
<div class="message-edit-feature-group">
{{> compose_control_buttons }}
</div>
{{/if}}
{{else}}
<button type="button" class="button small rounded message_edit_close">{{t "Close" }}</button>
{{/if}}
{{#if has_been_editable}}
<div class="message-edit-timer-control-group">
<span class="message_edit_countdown_timer"></span>
<span><i id="message_edit_tooltip" class="tippy-zulip-tooltip message_edit_tooltip fa fa-question-circle" aria-hidden="true"
{{#if is_widget_message}} data-tippy-content="{{#tr}}Widgets cannot be edited.{{/tr}}" {{else}} data-tippy-content="{{#tr}}This organization is configured to restrict editing of message content to {minutes_to_edit} minutes after it is sent.{{/tr}}" {{/if}}></i>
</span>
</div>
{{/if}}
</div>
</div>
<div class="alert alert-error edit_error hide"></div>
</form>