Skip to content

A platform for community discussion. Free, open, simple.

DEV: allow composer option to skip jumping to a post on save (#14675)

Jeff Wong6192189fd248
diff --git a/app/assets/javascripts/discourse/app/controllers/composer.js b/app/assets/javascripts/discourse/app/controllers/composer.js
index 7d4c810fe52..8567c4056cd 100644
--- a/app/assets/javascripts/discourse/app/controllers/composer.js
+++ b/app/assets/javascripts/discourse/app/controllers/composer.js
@@ -632,7 +632,9 @@ export default Controller.extend({
},
save(ignore, event) {
- this.save(false, { jump: !(event && event.shiftKey) });
+ this.save(false, {
+ jump: !event?.shiftKey && !this.skipJumpOnSave,
+ });
},
displayEditReason() {
@@ -956,6 +958,7 @@ export default Controller.extend({
@param {Number} [opts.prioritizedCategoryId]
@param {String} [opts.draftSequence]
@param {Boolean} [opts.skipDraftCheck]
+ @param {Boolean} [opts.skipJumpOnSave] Option to skip navigating to the post when saved in this composer session
**/
open(opts) {
opts = opts || {};
@@ -982,6 +985,8 @@ export default Controller.extend({
skipAutoSave: true,
});
+ this.set("skipJumpOnSave", !!opts.skipJumpOnSave);
+
// Scope the categories drop down to the category we opened the composer with.
if (opts.categoryId && !opts.disableScopedCategory) {
const category = this.site.categories.findBy("id", opts.categoryId);