mirror of
https://ghfast.top/https://github.com/discourse/discourse-signatures.git
synced 2026-07-15 11:26:42 +08:00
This updates the signature preferences connector to use modern Ember patterns and the new plugin API.
Changes:
- Convert to Glimmer component with `@service` injection
- Replace classic `<Input>` with native `<input>` and `{{on}}` modifier
- Use new `api.addSaveableCustomFields("profile")` API instead of `modifyClass save()` override
- Remove dead `@showUploadModal` argument from `DEditor`
- Add CSS to hide preview panel and match bio editor width
The `modifyClass` pattern for saving `custom_fields` was broken because `saveAttrNames` is now a getter that returns a fresh array on each call, so pushing to it in `save()` had no effect. The new `addSaveableCustomFields` API uses value transformers to properly add "`custom_fields`" to the save attributes.
cf. https://github.com/discourse/discourse/pull/36757
17 lines
542 B
JavaScript
17 lines
542 B
JavaScript
import { withPluginApi } from "discourse/lib/plugin-api";
|
|
import PostSignature from "../components/post-signature";
|
|
|
|
export default {
|
|
name: "extend-for-signatures",
|
|
initialize(container) {
|
|
const { signatures_enabled } = container.lookup("service:site-settings");
|
|
|
|
if (signatures_enabled) {
|
|
withPluginApi((api) => {
|
|
api.addTrackedPostProperties("user_signature");
|
|
api.renderAfterWrapperOutlet("post-content-cooked-html", PostSignature);
|
|
api.addSaveableCustomFields("profile");
|
|
});
|
|
}
|
|
},
|
|
};
|