mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	delete_topic: Refactor delete_topic modal to confirm_dialog module.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							161645c83c
						
					
				
				
					commit
					91b83cf09f
				
			@@ -11,9 +11,10 @@ import * as blueslip from "./blueslip";
 | 
			
		||||
import * as browser_history from "./browser_history";
 | 
			
		||||
import * as channel from "./channel";
 | 
			
		||||
import * as compose_actions from "./compose_actions";
 | 
			
		||||
import * as confirm_dialog from "./confirm_dialog";
 | 
			
		||||
import {DropdownListWidget as dropdown_list_widget} from "./dropdown_list_widget";
 | 
			
		||||
import * as hash_util from "./hash_util";
 | 
			
		||||
import {$t} from "./i18n";
 | 
			
		||||
import {$t, $t_html} from "./i18n";
 | 
			
		||||
import * as message_edit from "./message_edit";
 | 
			
		||||
import * as muting from "./muting";
 | 
			
		||||
import * as muting_ui from "./muting_ui";
 | 
			
		||||
@@ -600,14 +601,20 @@ export function register_topic_handlers() {
 | 
			
		||||
 | 
			
		||||
        hide_topic_popover();
 | 
			
		||||
 | 
			
		||||
        $("#delete-topic-modal-holder").html(render_delete_topic_modal(args));
 | 
			
		||||
        const modal_parent = $("#delete-topic-modal-holder");
 | 
			
		||||
        const html_body = render_delete_topic_modal(args);
 | 
			
		||||
 | 
			
		||||
        $("#do_delete_topic_button").on("click", () => {
 | 
			
		||||
            message_edit.delete_topic(stream_id, topic);
 | 
			
		||||
        confirm_dialog.launch({
 | 
			
		||||
            parent: modal_parent,
 | 
			
		||||
            html_heading: $t_html({defaultMessage: "Delete topic"}),
 | 
			
		||||
            help_link: "/help/delete-a-topic",
 | 
			
		||||
            html_body,
 | 
			
		||||
            html_yes_button: $t_html({defaultMessage: "Confirm"}),
 | 
			
		||||
            on_click: () => {
 | 
			
		||||
                message_edit.delete_topic(stream_id, topic);
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $("#delete_topic_modal").modal("show");
 | 
			
		||||
 | 
			
		||||
        e.stopPropagation();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,19 +1,6 @@
 | 
			
		||||
<div id="delete_topic_modal" class="modal modal-bg hide fade new-style" tabindex="-1" role="dialog" aria-labelledby="delete_topic_modal_label" aria-hidden="true">
 | 
			
		||||
    <div class="modal-header">
 | 
			
		||||
        <button type="button" class="close" data-dismiss="modal" aria-label="{{t 'Close' }}"><span aria-hidden="true">×</span></button>
 | 
			
		||||
        <h3 id="delete_topic_modal_label">
 | 
			
		||||
            {{t "Delete topic" }}
 | 
			
		||||
            {{> ./help_link_widget link="/help/delete-a-topic" }}
 | 
			
		||||
        </h3>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="modal-body">
 | 
			
		||||
        <p>{{t "Deleting a topic will immediately remove it and its messages for everyone. Other users may find this confusing, especially if they had received an email or push notification related to the deleted messages." }}</p>
 | 
			
		||||
        <p>{{#tr}}Are you sure you want to permanently delete <b>{topic_name}</b>?{{/tr}}</p>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="modal-footer">
 | 
			
		||||
        <button class="button" data-dismiss="modal">{{t "Cancel" }}</button>
 | 
			
		||||
        <button class="button btn-danger rounded" id="do_delete_topic_button">
 | 
			
		||||
            {{t "Confirm" }}
 | 
			
		||||
        </button>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<p>
 | 
			
		||||
    {{t "Deleting a topic will immediately remove it and its messages for everyone. Other users may find this confusing, especially if they had received an email or push notification related to the deleted messages." }}
 | 
			
		||||
</p>
 | 
			
		||||
<p>
 | 
			
		||||
    {{#tr}}Are you sure you want to permanently delete <b>{topic_name}</b>?{{/tr}}
 | 
			
		||||
</p>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user