Skip to content

Commit 9616e11

Browse files
Merge pull request #6832 from Countly/master-v25.03.24-into-next
Master v25.03.24 into next
2 parents 3ed3766 + 748372f commit 9616e11

File tree

8 files changed

+110
-105
lines changed

8 files changed

+110
-105
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@v3
44+
uses: github/codeql-action/init@v4
4545
with:
4646
languages: ${{ matrix.language }}
4747
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +52,7 @@ jobs:
5252
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5353
# If this step fails, then you should remove it and run the build manually (see below)
5454
- name: Autobuild
55-
uses: github/codeql-action/autobuild@v3
55+
uses: github/codeql-action/autobuild@v4
5656

5757
# ℹ️ Command-line programs to run using the OS shell.
5858
# 📚 https://git.io/JvXDl
@@ -66,4 +66,4 @@ jobs:
6666
# make release
6767

6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@v3
69+
uses: github/codeql-action/analyze@v4

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22
Dependencies:
33
- Remove SQLite
44

5+
## Version 25.03.24
6+
Fixes:
7+
- [jobs] Fix condition for scheduling alert job
8+
9+
Enterprise Fixes:
10+
- [compliance-hub] Fixed query patterns
11+
- [data-manager] Fixed bug preventing transformation of events ending in a dot
12+
- [data-manager] Fixed segment data deletion
13+
- [license] Stop sending metric after license expired
14+
- [users] Fix add/remove user to profile group
15+
- [users] Remove link to profile group page after removing user from group
16+
17+
Dependencies
18+
- Bump @faker-js/faker from 10.0.0 to 10.1.0 in /ui-tests
19+
- Bump countly-sdk-nodejs from 24.10.2 to 24.10.3
20+
- Bump lint-staged from 16.2.3 to 16.2.4
21+
- Bump puppeteer from 24.23.0 to 24.24.1
22+
523
## Version 25.03.23
624
Fixes:
725
- [events] Entries in the event list are now sorted alphabetically

api/parts/data/usage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ plugins.register("/sdk/user_properties", async function(ob) {
11251125
userProps.av_major = null;
11261126
userProps.av_minor = null;
11271127
userProps.av_patch = null;
1128-
userProps.av_rel = null;
1128+
userProps.av_prerel = null;
11291129
userProps.av_build = null;
11301130
}
11311131
}

api/parts/jobs/job.js

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -254,32 +254,33 @@ class Job extends EventEmitter {
254254

255255
this._json.next = next.getTime();
256256
}
257-
if (this.name !== "alerts:monitor") {
258-
//check if any job already scheduled or running
259-
let query = {
260-
status: {"$in": [STATUS.SCHEDULED, STATUS.RUNNING]},
261-
name: this.name,
262-
};
263-
if (this._id) {
264-
query._id = {$ne: this._id};
265-
}
266-
var self = this;
267-
return new Promise((resolve, reject) => {
268-
Job.findMany(this.db(), query).then(existing => {
269-
if (existing && existing.length) {
270-
log.d('Job already scheduled or running: %j', existing);
271-
this._json.status = STATUS.CANCELLED; //set this as cancelled now as we have other scheduled
272-
}
273-
else {
274-
self._save().then(resolve, reject);
275-
}
276257

277-
});
278-
});
258+
//check if any job already scheduled or running
259+
let query = {
260+
status: {"$in": [STATUS.SCHEDULED, STATUS.RUNNING]},
261+
name: this.name,
262+
};
263+
264+
if (this.name === 'alerts:monitor' && this.data && Object.keys(this.data).length) {
265+
query.data = this.data;
279266
}
280-
else {
281-
return this._save();
267+
268+
if (this._id) {
269+
query._id = {$ne: this._id};
282270
}
271+
272+
var self = this;
273+
return new Promise((resolve, reject) => {
274+
Job.findMany(this.db(), query).then(existing => {
275+
if (existing && existing.length) {
276+
log.d('Job already scheduled or running: %j', existing);
277+
this._json.status = STATUS.CANCELLED; //set this as cancelled now as we have other scheduled
278+
}
279+
else {
280+
self._save().then(resolve, reject);
281+
}
282+
});
283+
});
283284
}
284285

285286
/**
@@ -1142,4 +1143,4 @@ module.exports = {
11421143
STATUS: STATUS,
11431144
STATUS_MAP: STATUS_MAP,
11441145
debounce: debounce
1145-
};
1146+
};

package-lock.json

Lines changed: 46 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/compliance-hub/api/api.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ const FEATURE_NAME = 'compliance_hub';
1616

1717
plugins.internalDrillEvents.push("[CLY]_consent");
1818

19+
plugins.register("/master", function() {
20+
common.db.collection('consent_history').ensureIndex({app_id: 1, device_id: 1}, function() {});
21+
common.db.collection('consent_history').ensureIndex({app_id: 1, uid: 1}, function() {});
22+
common.db.collection('consent_history').ensureIndex({app_id: 1, type: 1}, function() {});
23+
common.db.collection('consent_history').ensureIndex({app_id: 1, ts: 1}, function() {});
24+
});
25+
1926
//write api call
2027
plugins.register("/sdk/user_properties", function(ob) {
2128
var params = ob.params;
@@ -162,7 +169,8 @@ const FEATURE_NAME = 'compliance_hub';
162169
query = {};
163170
}
164171
}
165-
common.db.collection("consent_history").count(query, function(err, total) {
172+
query.app_id = params.app_id.toString();
173+
common.db.collection("consent_history").countDocuments(query, function(err, total) {
166174
if (err) {
167175
common.returnMessage(params, 400, err);
168176
}
@@ -338,7 +346,7 @@ const FEATURE_NAME = 'compliance_hub';
338346
var newUid = ob.newUser.uid;
339347
if (oldUid !== newUid) {
340348
return new Promise(function(resolve, reject) {
341-
common.db.collection('consent_history').update({uid: oldUid}, {'$set': {uid: newUid}}, {multi: true}, function(err) {
349+
common.db.collection('consent_history').update({uid: oldUid}, {'$set': {app_id: ob.app_id, uid: newUid}}, {multi: true}, function(err) {
342350
if (err) {
343351
reject(err);
344352
return;
@@ -364,7 +372,7 @@ const FEATURE_NAME = 'compliance_hub';
364372
plugins.register("/i/apps/delete", function(ob) {
365373
var appId = ob.appId;
366374
common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {});
367-
common.db.collection('consent_history').drop(function() {});
375+
common.db.collection('consent_history').deleteMany({app_id: appId}, function() {});
368376
if (common.drillDb) {
369377
common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {});
370378
}
@@ -373,7 +381,7 @@ const FEATURE_NAME = 'compliance_hub';
373381
plugins.register("/i/apps/reset", function(ob) {
374382
var appId = ob.appId;
375383
common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {});
376-
common.db.collection('consent_history').drop(function() {});
384+
common.db.collection('consent_history').deleteMany({app_id: appId}, function() {});
377385
if (common.drillDb) {
378386
common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {});
379387
}
@@ -382,6 +390,7 @@ const FEATURE_NAME = 'compliance_hub';
382390
plugins.register("/i/apps/clear_all", function(ob) {
383391
var appId = ob.appId;
384392
common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {});
393+
common.db.collection('consent_history').deleteMany({app_id: appId}, function() {});
385394
if (common.drillDb) {
386395
common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {});
387396
}
@@ -391,6 +400,7 @@ const FEATURE_NAME = 'compliance_hub';
391400
var appId = ob.appId;
392401
var ids = ob.ids;
393402
common.db.collection('consents').remove({$and: [{'_id': {$regex: appId + ".*"}}, {'_id': {$nin: ids}}]}, function() {});
403+
common.db.collection('consent_history').deleteMany({app_id: appId, ts: {$lt: ob.moment.valueOf()}}, function() {});
394404
if (common.drillDb) {
395405
common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).remove({ts: {$lt: ob.moment.valueOf()}}, function() {});
396406
}

plugins/compliance-hub/install.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +0,0 @@
1-
var pluginManager = require('../pluginManager.js'),
2-
async = require('async');
3-
4-
console.log("Installing compliance-hub plugin");
5-
pluginManager.dbConnection().then((countlyDb) => {
6-
countlyDb.collection('apps').find({}).toArray(function(err, apps) {
7-
8-
if (!apps || err) {
9-
console.log("No apps to upgrade");
10-
countlyDb.close();
11-
return;
12-
}
13-
function upgrade(app, done) {
14-
console.log("Adding compliance-hub indexes to " + app.name);
15-
var cnt = 0;
16-
function cb() {
17-
cnt++;
18-
if (cnt == 4) {
19-
done();
20-
}
21-
}
22-
countlyDb.collection('consent_history').ensureIndex({device_id: 1}, cb);
23-
countlyDb.collection('consent_history').ensureIndex({uid: 1}, cb);
24-
countlyDb.collection('consent_history').ensureIndex({type: 1}, cb);
25-
countlyDb.collection('consent_history').ensureIndex({ts: 1}, cb);
26-
}
27-
async.forEach(apps, upgrade, function() {
28-
console.log("Compliance hub plugin installation finished");
29-
countlyDb.close();
30-
});
31-
});
32-
});

0 commit comments

Comments
 (0)