Files
discourse/plugins/chat/assets/javascripts/discourse/components/user-card-chat-button.js
Joffrey JAFFEUX f12724b5a5 DEV: routable chat part 2 (#20232)
This commit is expanding on previous work making everything chat working through an URL.

Improves drawer templates to be all URLs
Implements some kind of router for the drawer
Removes few remaining actions for opening channels
2023-02-14 11:27:07 +01:00

20 lines
526 B
JavaScript

import Component from "@ember/component";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
export default class UserCardChatButton extends Component {
@service chat;
@service appEvents;
@service router;
@action
startChatting() {
this.chat
.upsertDmChannelForUsernames([this.user.username])
.then((chatChannel) => {
this.router.transitionTo("chat.channel", ...chatChannel.routeModels);
this.appEvents.trigger("card:close");
});
}
}