nodebb-plugin-composer-default 10.2.15 → 10.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.2.15",
3
+ "version": "10.2.17",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -3,20 +3,20 @@
3
3
  define('composer/post-queue', [], function () {
4
4
  const postQueue = {};
5
5
 
6
- postQueue.isExempt = async function (postData) {
6
+ postQueue.showAlert = async function (postContainer, postData) {
7
7
  if (!config.postQueue || app.user.isAdmin || app.user.isGlobalMod || app.user.isMod) {
8
- return true;
8
+ return;
9
9
  }
10
- return await socket.emit('plugins.composer.isExemptFromPostQueue', { postData: postData });
10
+ const shouldQueue = await socket.emit('plugins.composer.shouldQueue', { postData: postData });
11
+ postContainer.find('[component="composer/post-queue/alert"]')
12
+ .toggleClass('show', shouldQueue);
11
13
  };
12
14
 
13
15
  postQueue.onChangeCategory = async function (postContainer, postData) {
14
16
  if (!config.postQueue) {
15
17
  return;
16
18
  }
17
- const isExempt = await postQueue.isExempt(postData);
18
- postContainer.find('[component="composer/post-queue/alert"]')
19
- .toggleClass('hidden', isExempt);
19
+ postQueue.showAlert(postContainer, postData);
20
20
  };
21
21
 
22
22
  return postQueue;
@@ -343,7 +343,7 @@ define('composer', [
343
343
  formatting.addHandler(postContainer);
344
344
  formatting.addComposerButtons();
345
345
  preview.handleToggler(postContainer);
346
-
346
+ postQueue.showAlert(postContainer, postData);
347
347
  uploads.initialize(post_uuid);
348
348
  tags.init(postContainer, composer.posts[post_uuid]);
349
349
  autocomplete.init(postContainer, post_uuid);
@@ -477,7 +477,6 @@ define('composer', [
477
477
  tagWhitelist: postData.category ? postData.category.tagWhitelist : ajaxify.data.tagWhitelist,
478
478
  privileges: app.user.privileges,
479
479
  selectedCategory: postData.category,
480
- exemptFromPostQueue: await postQueue.isExempt(postData),
481
480
  submitOptions: [
482
481
  // Add items using `filter:composer.create`, or just add them to the <ul> in DOM
483
482
  // {
@@ -1,7 +1,7 @@
1
1
  <div class="write-preview-container d-flex gap-2 flex-grow-1 overflow-auto">
2
2
  <div class="write-container d-flex d-md-flex w-50 position-relative">
3
- <div component="composer/post-queue/alert" class="{{{ if exemptFromPostQueue }}}hidden{{{ end }}} m-2 alert alert-info position-absolute top-0 start-0 alert-dismissible">[[modules:composer.post-queue-alert]]<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>
4
- <div class="float-end draft-icon hidden-md hidden-lg"></div>
3
+ <div component="composer/post-queue/alert" class="m-2 alert alert-info fade position-absolute top-0 start-0 alert-dismissible">[[modules:composer.post-queue-alert]]<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button></div>
4
+ <div class="draft-icon position-absolute end-0 top-0 mx-2 my-1 hidden-md hidden-lg"></div>
5
5
  <textarea class="write shadow-none rounded-1 w-100 form-control" tabindex="4" placeholder="[[modules:composer.textarea.placeholder]]">{body}</textarea>
6
6
  </div>
7
7
  <div class="preview-container d-none d-md-flex w-50">
package/websockets.js CHANGED
@@ -69,7 +69,7 @@ Sockets.getFormattingOptions = async function () {
69
69
  return await require('./library').getFormattingOptions();
70
70
  };
71
71
 
72
- Sockets.isExemptFromPostQueue = async function (socket, data) {
72
+ Sockets.shouldQueue = async function (socket, data) {
73
73
  if (!data || !data.postData) {
74
74
  throw new Error('[[error:invalid-data]]');
75
75
  }
@@ -90,5 +90,5 @@ Sockets.isExemptFromPostQueue = async function (socket, data) {
90
90
  content: postData.content || '',
91
91
  });
92
92
  }
93
- return !shouldQueue;
93
+ return shouldQueue;
94
94
  };