Skip to content

Node.js based forum software built for the modern web

feat: add app.newReply

Barış Soner Uşaklı101fe81d42a9
diff --git a/public/src/app.js b/public/src/app.js
index 295555f19f..a4e25beab2 100644
--- a/public/src/app.js
+++ b/public/src/app.js
@@ -289,6 +289,17 @@ if (document.readyState === 'loading') {
});
};
+ app.newReply = async function (tid) {
+ const [hooks, api] = await app.require(['hooks', 'api']);
+ const titleRaw = ajaxify.data.template.topic ?
+ ajaxify.data.titleRaw :
+ (await api.get(`/topics/${tid}`)).titleRaw;
+ hooks.fire('action:composer.post.new', {
+ tid: tid,
+ topicName: titleRaw,
+ });
+ };
+
app.loadJQueryUI = function (callback) {
if (typeof $().autocomplete === 'function') {
return callback();