mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
25 lines
572 B
JavaScript
25 lines
572 B
JavaScript
import { action } from "@ember/object";
|
|
import Component from "@ember/component";
|
|
import DiscourseURL from "discourse/lib/url";
|
|
|
|
export default Component.extend({
|
|
tagName: "",
|
|
|
|
@action
|
|
openLinks(event) {
|
|
const dataset = event.target.dataset;
|
|
|
|
if (dataset.linkPostId) {
|
|
event.preventDefault();
|
|
|
|
this.store.find("post", dataset.linkPostId).then((post) => {
|
|
DiscourseURL.routeTo(post.url);
|
|
});
|
|
} else if (dataset.linkTopicId) {
|
|
event.preventDefault();
|
|
|
|
DiscourseURL.routeTo(`/t/${dataset.linkTopicId}`);
|
|
}
|
|
},
|
|
});
|