2024-05-15 04:06:38 -04:00
|
|
|
import { service } from "@ember/service";
|
2024-03-12 01:51:41 -04:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
|
2024-05-15 04:06:38 -04:00
|
|
|
export default class DiscourseAiSharedConversationShowRoute extends DiscourseRoute {
|
|
|
|
@service currentUser;
|
|
|
|
|
2024-03-12 01:51:41 -04:00
|
|
|
beforeModel(transition) {
|
2024-05-15 04:06:38 -04:00
|
|
|
if (this.currentUser?.user_option?.external_links_in_new_tab) {
|
|
|
|
window.open(transition.intent.url, "_blank");
|
|
|
|
} else {
|
|
|
|
this.redirect(transition.intent.url);
|
|
|
|
}
|
2024-03-12 01:51:41 -04:00
|
|
|
transition.abort();
|
2024-05-15 04:06:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
redirect(url) {
|
|
|
|
window.location = url;
|
|
|
|
}
|
|
|
|
}
|