@zenginehq/backend-webhooks
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.1.0"></a> | ||
# 1.1.0 (2018-06-29) | ||
### Features | ||
* split up activity record checking into 2 functions ([7fc9fae](https://github.com/ZengineHQ/zn-backend-webhooks/commit/7fc9fae)) | ||
<a name="1.0.0"></a> | ||
@@ -13,1 +23,11 @@ # 1.0.0 (2018-06-28) | ||
* initial module with secret validation and activity folder checks ([679a949](https://github.com/ZengineHQ/zn-backend-webhooks/commit/679a949)) | ||
<a name="1.0.0"></a> | ||
# 1.0.0 (2018-06-28) | ||
### Features | ||
* initial module with secret validation and activity folder checks ([679a949](https://github.com/ZengineHQ/zn-backend-webhooks/commit/679a949)) |
35
index.js
@@ -44,24 +44,35 @@ 'use strict'; | ||
/** | ||
* Returns whether a record went into a folder, optionally specifying from where it came from. | ||
* Returns whether a record went into the specified folder. | ||
* | ||
* @param {Object} activity | ||
* @param {number} toFolderId Destination folder id. | ||
* @param {number} [fromFolderId] Optional. Source folder id. | ||
* @param {number} folder Destination folder id. | ||
* | ||
* @return {boolean} | ||
*/ | ||
module.exports.activityFolders = function (activity, toFolderId, fromFolderId) { | ||
module.exports.activityToFolder = function (activity, folder) { | ||
var activityChanges = activity.changes || {}; | ||
if (activityChanges.to && activityChanges.to.folder && activityChanges.to.folder.id && | ||
activityChanges.to.folder.id === toFolderId) { | ||
activityChanges.to.folder.id === folder) { | ||
if (!fromFolderId) { | ||
return true; | ||
} | ||
return true; | ||
} | ||
if (activityChanges.from && activityChanges.from.folder && activityChanges.from.folder.id && | ||
activityChanges.from.folder.id === fromFolderId) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
/** | ||
* Returns whether a record came from the specified folder when moving to another one. | ||
* | ||
* @param {Object} activity | ||
* @param {number} folder Destination folder id. | ||
* | ||
* @return {boolean} | ||
*/ | ||
module.exports.activityFromFolder = function (activity, folder) { | ||
var activityChanges = activity.changes || {}; | ||
if (activityChanges.from && activityChanges.from.folder && activityChanges.from.folder.id && | ||
activityChanges.from.folder.id === folder) { | ||
return true; | ||
} | ||
@@ -68,0 +79,0 @@ |
{ | ||
"name": "@zenginehq/backend-webhooks", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Helper library for working with Webhooks in Zengine backend plugins.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15992
67