2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2023-10-11 02:38:59 +08:00
|
|
|
import { action } from "@ember/object";
|
|
|
|
import { tagName } from "@ember-decorators/component";
|
2018-02-14 04:58:32 +08:00
|
|
|
import DiscourseURL from "discourse/lib/url";
|
|
|
|
|
2023-02-23 23:32:53 +08:00
|
|
|
@tagName("")
|
|
|
|
export default class StaffActions extends Component {
|
2021-11-16 17:26:39 +08:00
|
|
|
@action
|
|
|
|
openLinks(event) {
|
|
|
|
const dataset = event.target.dataset;
|
2020-07-22 02:29:02 +08:00
|
|
|
|
2021-11-16 17:26:39 +08:00
|
|
|
if (dataset.linkPostId) {
|
|
|
|
event.preventDefault();
|
2020-07-22 02:29:02 +08:00
|
|
|
|
2021-11-16 17:26:39 +08:00
|
|
|
this.store.find("post", dataset.linkPostId).then((post) => {
|
|
|
|
DiscourseURL.routeTo(post.url);
|
|
|
|
});
|
|
|
|
} else if (dataset.linkTopicId) {
|
|
|
|
event.preventDefault();
|
2020-07-22 02:29:02 +08:00
|
|
|
|
2021-11-16 17:26:39 +08:00
|
|
|
DiscourseURL.routeTo(`/t/${dataset.linkTopicId}`);
|
|
|
|
}
|
2023-02-23 23:32:53 +08:00
|
|
|
}
|
|
|
|
}
|