Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .discourse-compatibility
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
< 3.6.0.beta3-latest: 34fb1dd62d587318a96dc094f887dd2d51315025
< 3.6.0.beta1-dev: 26cb61c16343e266c089c34be70b3eeaa08e948c
< 3.5.0.beta8-dev: c54c2f2dc1714989024999dc3623867dcbeab4cb
< 3.5.0.beta5-dev: 7f8900e436d6a680d5bd9e5939f53a789c72f6f5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { service } from "@ember/service";
import { hbs } from "ember-cli-htmlbars";
import { Promise } from "rsvp";
import { bind } from "discourse/lib/decorators";
import { withSilencedDeprecations } from "discourse/lib/deprecated";
import { withPluginApi } from "discourse/lib/plugin-api";
import RenderGlimmer from "discourse/widgets/render-glimmer";
import { i18n } from "discourse-i18n";
import ActivityPubPostStatus from "../components/activity-pub-post-status";
import ActivityPubTopicMap from "../components/activity-pub-topic-map";
Expand Down Expand Up @@ -109,14 +106,10 @@ export default {
activity_pub_updated_at: data.model.updated_at,
activity_pub_delivered_at: data.model.delivered_at,
};
topic.postStream
.triggerActivityPubStateChange(data.model.id, props)
.then(() =>
// TODO (glimmer-post-stream) the Glimmer Post Stream does not listen to this event
this.appEvents.trigger("post-stream:refresh", {
id: data.model.id,
})
);
topic.postStream.triggerActivityPubStateChange(
data.model.id,
props
);
this.appEvents.trigger(
"activity-pub:post-updated",
data.model.id,
Expand Down Expand Up @@ -230,52 +223,4 @@ function customizePost(api, container) {
};
}
});

withSilencedDeprecations("discourse.post-stream-widget-overrides", () =>
customizeWidgetPost(api, container)
);
}

function customizeWidgetPost(api, container) {
const currentUser = api.getCurrentUser();
const site = container.lookup("service:site");
const siteSettings = container.lookup("service:site-settings");

api.reopenWidget("post-meta-data", {
html(attrs) {
const result = this._super(attrs);
let postStatuses = result[result.length - 1].children;
postStatuses = postStatuses.filter(
(n) => n.renderInto !== "div.post-info.activity-pub"
);
if (
site.activity_pub_enabled &&
attrs.activity_pub_enabled &&
attrs.post_number !== 1 &&
showStatusToUser(currentUser, siteSettings)
) {
const status = activityPubPostStatus(attrs);
if (status) {
let replyToTabIndex = postStatuses.findIndex((postStatus) => {
return postStatus.name === "reply-to-tab";
});
const post = this.findAncestorModel();
postStatuses.splice(
replyToTabIndex !== -1 ? replyToTabIndex + 1 : 0,
0,
new RenderGlimmer(
this,
"div.post-info.activity-pub",
hbs`<ActivityPubPostStatus @post={{@data.post}} />`,
{
post,
}
)
);
}
}
result[result.length - 1].children = postStatuses;
return result;
},
});
}
Loading