@xuda.io/notification_module 1.1.52 → 1.1.54

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.
Files changed (2) hide show
  1. package/index.js +11 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -704,18 +704,27 @@ exports.get_system_notifications = async function (req) {
704
704
  // module.exports = notifications_validation_class;
705
705
 
706
706
  exports.notifications_validation_fx = async function (notification_id) {
707
- const { code, doc } = await db_module.get_couch_doc(
707
+ let { code, doc } = await db_module.get_couch_doc(
708
708
  "xuda_notification",
709
709
  notification_id
710
710
  );
711
+ const deactivate_notification = async function () {
712
+ doc.stat = 4;
713
+ await db_module.get_couch_doc("xuda_notification", notification_id);
714
+ };
711
715
 
712
716
  if (code < 0) return;
713
717
 
718
+ if (!doc.topic) {
719
+ await deactivate_notification();
720
+ return false;
721
+ }
722
+
714
723
  const fx = {
715
724
  new_version_available: async function () {},
716
725
  };
717
726
 
718
727
  if (fx[method]) {
719
- return await fx[method]();
728
+ return await fx[doc.topic]();
720
729
  }
721
730
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/notification_module",
3
- "version": "1.1.52",
3
+ "version": "1.1.54",
4
4
  "description": "Xuda Notification Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {