Skip to content

Commit

Permalink
DEV: Use the native modifyClass API (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Jan 21, 2025
1 parent cbc39e4 commit b294ace
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions javascripts/discourse/initializers/gif-integration.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { action } from "@ember/object";
import { service } from "@ember/service";
import { withPluginApi } from "discourse/lib/plugin-api";
import GifModal from "../components/modal/gif";

Expand Down Expand Up @@ -34,24 +35,28 @@ export default {
position: "dropdown",
});

api.modifyClass("component:chat-composer", {
pluginId: "discourse-gifs",
api.modifyClass(
"component:chat-composer",
(Superclass) =>
class extends Superclass {
@service modal;

@action
showChatGifModal(context) {
this.modal.show(GifModal, {
model: {
customPickHandler: (message) => {
api.sendChatMessage(this.draft.channel.id, {
message,
threadId:
context === "thread" ? this.draft.thread.id : null,
});
},
},
});
},
});
@action
showChatGifModal(context) {
this.modal.show(GifModal, {
model: {
customPickHandler: (message) => {
api.sendChatMessage(this.draft.channel.id, {
message,
threadId:
context === "thread" ? this.draft.thread.id : null,
});
},
},
});
}
}
);
}
});

Expand Down

0 comments on commit b294ace

Please sign in to comment.