mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
popovers: Avoid passing message to actions popover template.
We instead get the specific fields from message that we use. This is particularly helpful for subject -> topic migration; we no longer have to account for "subject" fields in client-side templates.
This commit is contained in:
@@ -53,13 +53,6 @@ run_test('handlebars_bug', () => {
|
||||
|
||||
run_test('actions_popover_content', () => {
|
||||
var args = {
|
||||
message: {
|
||||
is_stream: true,
|
||||
id: "99",
|
||||
stream: "devel",
|
||||
subject: "testing",
|
||||
sender_full_name: "King Lear",
|
||||
},
|
||||
should_display_quote_and_reply: true,
|
||||
can_edit_message: true,
|
||||
can_mute_topic: true,
|
||||
@@ -73,13 +66,6 @@ run_test('actions_popover_content', () => {
|
||||
assert.equal(link.text().trim(), 'translated: Quote and reply');
|
||||
|
||||
var deletedArgs = {
|
||||
message: {
|
||||
is_stream: true,
|
||||
id: "100",
|
||||
stream: "devel",
|
||||
subject: "testing",
|
||||
sender_full_name: "King Lear",
|
||||
},
|
||||
should_display_edit_and_view_source: false,
|
||||
should_display_quote_and_reply: false,
|
||||
narrowed: true,
|
||||
|
||||
@@ -404,7 +404,10 @@ exports.toggle_actions_popover = function (element, id) {
|
||||
|
||||
var should_display_delete_option = message_edit.get_deletability(message);
|
||||
var args = {
|
||||
message: message,
|
||||
message_id: message.id,
|
||||
historical: message.historical,
|
||||
stream_id: message.stream_id,
|
||||
topic: util.get_message_topic(message),
|
||||
use_edit_icon: use_edit_icon,
|
||||
editability_menu_item: editability_menu_item,
|
||||
can_mute_topic: can_mute_topic,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<ul class="nav nav-list actions_popover">
|
||||
{{#if should_display_edit_and_view_source}}
|
||||
<li>
|
||||
<a href="#" class="popover_edit_message" data-message-id="{{message.id}}">
|
||||
<a href="#" class="popover_edit_message" data-message-id="{{message_id}}">
|
||||
{{! Can consider http://fontawesome.io/icon/file-code-o/ when we upgrade to font awesome 4.}}
|
||||
<i class="{{#if use_edit_icon}}fa fa-pencil{{else}}fa fa-file-text-o{{/if}}" aria-hidden="true"></i> {{editability_menu_item}}
|
||||
</a>
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
{{#if should_display_quote_and_reply}}
|
||||
<li>
|
||||
<a href="#" class="respond_button" data-message-id="{{message.id}}">
|
||||
<a href="#" class="respond_button" data-message-id="{{message_id}}">
|
||||
<i class="fa fa-reply" aria-hidden="true"></i> {{t "Quote and reply" }}
|
||||
</a>
|
||||
</li>
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
{{#if should_display_reminder_option}}
|
||||
<li>
|
||||
<a href="#" class='reminder_button' data-message-id="{{message.id}}">
|
||||
<a href="#" class='reminder_button' data-message-id="{{message_id}}">
|
||||
<i class="fa fa-bell" aria-hidden="true"></i> {{t "Remind me about this" }}
|
||||
</a>
|
||||
</li>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
{{#if should_display_collapse}}
|
||||
<li>
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message.id}}">
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message_id}}">
|
||||
<i class="fa fa-minus" aria-hidden="true"></i>
|
||||
{{t "Collapse" }} <span class="hotkey-hint">(–)</span>
|
||||
</a>
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
{{#if should_display_uncollapse}}
|
||||
<li>
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message.id}}">
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message_id}}">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
{{t "Un-collapse" }} <span class="hotkey-hint">(–)</span>
|
||||
</a>
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
{{#if should_display_edit_history_option}}
|
||||
<li>
|
||||
<a href="#" class="view_edit_history" data-msgid="{{message.id}}">
|
||||
<a href="#" class="view_edit_history" data-msgid="{{message_id}}">
|
||||
<i class="fa fa-clock-o" aria-hidden="true"></i>
|
||||
{{t "View edit history" }}
|
||||
</a>
|
||||
@@ -53,7 +53,7 @@
|
||||
{{/if}}
|
||||
{{#if should_display_delete_option}}
|
||||
<li>
|
||||
<a href="#" class="delete_message" data-message-id="{{message.id}}">
|
||||
<a href="#" class="delete_message" data-message-id="{{message_id}}">
|
||||
<i class="fa fa-times" aria-hidden="true"></i>
|
||||
{{t "Delete message" }}
|
||||
</a>
|
||||
@@ -61,38 +61,38 @@
|
||||
{{/if}}
|
||||
{{#if can_mute_topic}}
|
||||
<li>
|
||||
<a href="#" class="popover_mute_topic" data-msg-stream-id="{{message.stream_id}}" data-msg-topic="{{message.subject}}">
|
||||
<a href="#" class="popover_mute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}">
|
||||
<i class="fa fa-eye-slash" aria-hidden="true"></i>
|
||||
{{#tr message}}Mute the topic <b>__subject__</b>{{/tr}} <span class="hotkey-hint">(M)</span>
|
||||
{{#tr this}}Mute the topic <b>__topic__</b>{{/tr}} <span class="hotkey-hint">(M)</span>
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if can_unmute_topic}}
|
||||
<li>
|
||||
<a href="#" class="popover_unmute_topic" data-msg-stream-id="{{message.stream_id}}" data-msg-topic="{{message.subject}}">
|
||||
<a href="#" class="popover_unmute_topic" data-msg-stream-id="{{stream_id}}" data-msg-topic="{{topic}}">
|
||||
<i class="fa fa-eye" aria-hidden="true"></i>
|
||||
{{#tr message}}Unmute the topic <b>__subject__</b>{{/tr}}
|
||||
{{#tr this}}Unmute the topic <b>__topic__</b>{{/tr}}
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if should_display_add_reaction_option}}
|
||||
<li>
|
||||
<a href="#" class="reaction_button" data-message-id="{{message.id}}">
|
||||
<a href="#" class="reaction_button" data-message-id="{{message_id}}">
|
||||
<i class="fa fa-smile-o" aria-hidden="true"></i>
|
||||
{{#tr message}}Add emoji reaction{{/tr}}
|
||||
{{#tr this}}Add emoji reaction{{/tr}}
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li>
|
||||
<a href="#" class="copy_link" data-message-id="{{message.id}}" data-clipboard-text="{{ conversation_time_uri }}">
|
||||
<a href="#" class="copy_link" data-message-id="{{message_id}}" data-clipboard-text="{{ conversation_time_uri }}">
|
||||
<i class="fa fa-link" aria-hidden="true"></i> {{t "Copy link to conversation" }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{{#if message.historical}}
|
||||
{{#if historical}}
|
||||
<li class="small">({{t "Message sent when you were not subscribed" }})</li>
|
||||
{{/if}}
|
||||
</ul>
|
||||
|
||||
@@ -723,6 +723,12 @@ def build_custom_checkers(by_lang):
|
||||
'description': "Use Botserver instead of botserver or bot server."},
|
||||
]) + comma_whitespace_rule
|
||||
html_rules = whitespace_rules + prose_style_rules + [
|
||||
{'pattern': 'subject|SUBJECT',
|
||||
'exclude': set(['templates/zerver/email.html']),
|
||||
'exclude_pattern': 'email subject',
|
||||
'description': 'avoid subject in templates',
|
||||
'good_lines': ['topic_name'],
|
||||
'bad_lines': ['subject="foo"', ' MAX_SUBJECT_LEN']},
|
||||
{'pattern': r'placeholder="[^{#](?:(?!\.com).)+$',
|
||||
'description': "`placeholder` value should be translatable.",
|
||||
'exclude_line': [('templates/zerver/register.html', 'placeholder="acme"'),
|
||||
|
||||
Reference in New Issue
Block a user