diff --git a/static/js/popovers.js b/static/js/popovers.js index 176b49b52c..40d40b31c9 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -156,7 +156,7 @@ exports.toggle_actions_popover = function (element, id) { can_unmute_topic: can_unmute_topic, should_display_add_reaction_option: message.sent_by_me, should_display_edit_history_option: should_display_edit_history_option, - conversation_time_uri: narrow.by_conversation_and_time_uri(message), + conversation_time_uri: narrow.by_conversation_and_time_uri(message, true), narrowed: narrow_state.active(), }; @@ -435,13 +435,6 @@ exports.register_click_handlers = function () { e.stopPropagation(); e.preventDefault(); }); - $('body').on('click', '.popover_narrow_by_conversation_and_time', function (e) { - var msgid = $(e.currentTarget).data('message-id'); - popovers.hide_actions_popover(); - narrow.by_conversation_and_time(msgid, {trigger: 'popover'}); - e.stopPropagation(); - e.preventDefault(); - }); $('body').on('click', '.popover_toggle_collapse', function (e) { var msgid = $(e.currentTarget).data('message-id'); var row = current_msg_list.get_row(msgid); @@ -500,6 +493,22 @@ exports.register_click_handlers = function () { e.preventDefault(); }); + function initClipboard(selector) { + return new Clipboard(selector); + } + initClipboard('.copy_link'); + + $('body').on('click', '.copy_link', function (e) { + popovers.hide_actions_popover(); + var id = $(this).attr("data-message-id"); + var row = $("[zid='" + id + "']"); + row.find(".alert-copied").css("display", "block"); + row.find(".alert-copied").delay(1000).fadeOut(300); + + e.stopPropagation(); + e.preventDefault(); + }); + (function () { var last_scroll = 0; diff --git a/static/templates/actions_popover_content.handlebars b/static/templates/actions_popover_content.handlebars index 0781082137..6bdd895724 100644 --- a/static/templates/actions_popover_content.handlebars +++ b/static/templates/actions_popover_content.handlebars @@ -57,8 +57,8 @@ {{/if}}
  • - - {{t "Link to this conversation" }} + + {{t "Copy link to conversation" }}