haraka-plugin-karma 2.0.4 → 2.1.1

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 (3) hide show
  1. package/Changes.md +14 -0
  2. package/index.js +8 -8
  3. package/package.json +3 -3
package/Changes.md CHANGED
@@ -2,6 +2,18 @@
2
2
  #### N.N.N - YYYY-MM-DD
3
3
 
4
4
 
5
+ ### [2.1.1] - 2023-08-22
6
+
7
+ - fix: check_result unexpected return #50
8
+
9
+
10
+ ### [2.1.0] - 2022-11-29
11
+
12
+ - fix: in disconnect, call redis_unsub after skip check
13
+ - dep(redis): 4 -> 4.1
14
+ - dep(pi-redis): 2 -> 2.0.5
15
+
16
+
5
17
  #### 2.0.4 - 2022-05-28
6
18
 
7
19
  - use .release as submodule
@@ -97,3 +109,5 @@
97
109
  #### 1.0.2 - 2017-01-24
98
110
 
99
111
  - use redis.merge_redis_ini()
112
+ [2.1.0]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.1.0
113
+ [2.1.1]: https://github.com/haraka/haraka-plugin-karma/releases/tag/2.1.1
package/index.js CHANGED
@@ -155,18 +155,18 @@ exports.check_result = function (connection, message) {
155
155
  if (!this.result_awards[m.plugin]) return // no awards for plugin
156
156
 
157
157
  for (const r of Object.keys(m.result)) { // each result in mess
158
- if (r === 'emit') return // r: pass, fail, skip, err, ...
158
+ if (r === 'emit') continue // r: pass, fail, skip, err, ...
159
159
 
160
160
  const pi_prop = this.result_awards[m.plugin][r]
161
- if (!pi_prop) return // no award for this plugin property
161
+ if (!pi_prop) continue // no award for this plugin property
162
162
 
163
163
  const thisResult = m.result[r]
164
164
  // ignore empty arrays, objects, and strings
165
- if (Array.isArray(thisResult) && thisResult.length === 0) return
165
+ if (Array.isArray(thisResult) && thisResult.length === 0) continue
166
166
  if (typeof thisResult === 'object' && !Object.keys(thisResult).length) {
167
- return
167
+ continue
168
168
  }
169
- if (typeof thisResult === 'string' && !thisResult) return // empty
169
+ if (typeof thisResult === 'string' && !thisResult) continue // empty
170
170
 
171
171
  // do any award conditions match this result?
172
172
  for (let i=0; i < pi_prop.length; i++) { // each award...
@@ -684,10 +684,10 @@ exports.increment = function (connection, key, val) {
684
684
  exports.hook_disconnect = function (next, connection) {
685
685
  const plugin = this
686
686
 
687
- plugin.redis_unsubscribe(connection)
688
-
689
687
  if (plugin.should_we_skip(connection)) return next()
690
688
 
689
+ plugin.redis_unsubscribe(connection)
690
+
691
691
  const k = connection.results.get('karma')
692
692
  if (!k || k.score === undefined) {
693
693
  connection.results.add(plugin, {err: 'karma results missing'})
@@ -708,7 +708,7 @@ exports.hook_disconnect = function (next, connection) {
708
708
  }
709
709
 
710
710
  connection.results.add(plugin, {emit: true })
711
- return next()
711
+ next()
712
712
  }
713
713
 
714
714
  exports.get_award_loc_from_note = function (connection, award) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haraka-plugin-karma",
3
- "version": "2.0.4",
3
+ "version": "2.1.1",
4
4
  "description": "A heuristics scoring and reputation engine for SMTP connections",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,8 +26,8 @@
26
26
  "address-rfc2821": "*",
27
27
  "haraka-constants": ">=1.0.2",
28
28
  "haraka-utils": "*",
29
- "haraka-plugin-redis": "2",
30
- "redis": "4"
29
+ "haraka-plugin-redis": "2.0.5",
30
+ "redis": "4.6.7"
31
31
  },
32
32
  "devDependencies": {
33
33
  "eslint": "8",