Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Use the new modifyClass api #61

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions .github/workflows/discourse-theme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ on:
jobs:
ci:
uses: discourse/.github/.github/workflows/discourse-theme.yml@v1
with:
core_ref: 0-extend-native
39 changes: 22 additions & 17 deletions javascripts/discourse/initializers/gif-integration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { withPluginApi } from "discourse/lib/plugin-api";
import ChatComposer from "discourse/plugins/chat/discourse/components/chat-composer";
import GifModal from "../components/modal/gif";

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

api.modifyClass("component:chat-composer", {
pluginId: "discourse-gifs",
api.modifyClass(
ChatComposer,
(Base) =>
class extends Base {
@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