mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	frontend: Allow users to see the source of messages they can't edit.
Previously we showed an "Edit" item in the actions popover menu when a user could edit the content or topic of a message, and nothing otherwise. We now show "Edit", "Edit Topic", or "View Source" in the popover menu for every message, depending on the editability of the message, and present an appropriate version of message_edit_form when the menu item is clicked. Finishes #1604 and #1761.
This commit is contained in:
		@@ -60,6 +60,14 @@ exports.toggle_actions_popover = function (element, id) {
 | 
			
		||||
        var editability = message_edit.get_editability(message);
 | 
			
		||||
        var is_editable = (editability === message_edit.editability_types.TOPIC_ONLY ||
 | 
			
		||||
                           editability === message_edit.editability_types.FULL);
 | 
			
		||||
        var editability_menu_item;
 | 
			
		||||
        if (editability === message_edit.editability_types.FULL) {
 | 
			
		||||
            editability_menu_item = i18n.t("Edit");
 | 
			
		||||
        } else if (editability === message_edit.editability_types.TOPIC_ONLY) {
 | 
			
		||||
            editability_menu_item = i18n.t("Edit Topic");
 | 
			
		||||
        } else {
 | 
			
		||||
            editability_menu_item = i18n.t("View Source");
 | 
			
		||||
        }
 | 
			
		||||
        var can_mute_topic =
 | 
			
		||||
                message.stream &&
 | 
			
		||||
                message.subject &&
 | 
			
		||||
@@ -72,6 +80,7 @@ exports.toggle_actions_popover = function (element, id) {
 | 
			
		||||
        var args = {
 | 
			
		||||
            message: message,
 | 
			
		||||
            is_editable: is_editable,
 | 
			
		||||
            editability_menu_item: editability_menu_item,
 | 
			
		||||
            can_mute_topic: can_mute_topic,
 | 
			
		||||
            can_unmute_topic: can_unmute_topic,
 | 
			
		||||
            conversation_time_uri: narrow.by_conversation_and_time_uri(message),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user