Skip to content

Commit 001295b

Browse files
Merge branch 'master' into dependabot/npm_and_yarn/sass-1.79.4
2 parents d9aac19 + e3f532d commit 001295b

File tree

22 files changed

+579
-107
lines changed

22 files changed

+579
-107
lines changed

CHANGELOG.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
## Version 24.05.14
2+
Fixes:
3+
- [code] Added better handling for countly servers while deployed using subdirectory
4+
- [data-manager] Added missing "Create" button for event groups
5+
- [data-manager] Fixes for auto toggling data masking setting on redaction change
6+
- [populator] Fixed issues in case of wrongly structured data
7+
- [push] token shouldn't be revoked if it's already in db
8+
- [server-stats] Fixed a data point calculation bug
9+
10+
Enterprise fixes:
11+
- [push_approver] Fixed issue with the plugin not handling being "soft disabled"
12+
- [surveys] fixed a bug with the Survey widget where the "submit" button could become non interactable
13+
- [surveys] fixed issues with dashboard editor in relation to the "terms and conditions"
14+
- [surveys] fixed issues with previewing, creating and editing nps widgets
15+
116
## Version 24.05.13
217
Fixes:
318
- [alerts] Fixed bugs related to NPS alerts
@@ -32,7 +47,7 @@ Fixes:
3247
- [logs] Show collected problems on logger
3348

3449
Enterprise fixes:
35-
- [data-manager] Fixes n UI to allow events starting with "/"
50+
- [data-manager] Fixes in UI to allow events starting with "/"
3651
- [flows] Fixes for flows step generation
3752
- [surveys] Other is not allowed as a valid answer for required questions
3853

Gruntfile.js

+20-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ module.exports = function(grunt) {
241241
'frontend/express/public/javascripts/dom/drop/drop-theme-countly.min.css',
242242
'frontend/express/public/javascripts/utils/tooltipster/tooltipster.bundle.min.css',
243243
'frontend/express/public/stylesheets/bulma/bulma-custom.css',
244-
'frontend/express/public/stylesheets/styles/manifest.css',
244+
'frontend/express/public/stylesheets/styles/manifest2.css',
245245
'frontend/express/public/stylesheets/vue/element-tiptap.css',
246246
]
247247
}
@@ -324,7 +324,25 @@ module.exports = function(grunt) {
324324

325325
grunt.registerTask('default', ['mochaTest']);
326326

327-
grunt.registerTask('dist', ['sass', 'concat', 'uglify', 'cssmin']);
327+
grunt.registerTask('replace-paths', 'Replace image paths in prod CSS files', function() {
328+
var cssFiles = [
329+
{
330+
filepath: 'frontend/express/public/stylesheets/styles/manifest.css',
331+
lookup: '../../images',
332+
replacement: '../images',
333+
newPath: 'frontend/express/public/stylesheets/styles/manifest2.css'
334+
}
335+
];
336+
337+
cssFiles.forEach(function(file) {
338+
var content = grunt.file.read(file.filepath);
339+
var newContent = content.replace(/\.\.\/\.\.\/images/g, file.replacement);
340+
grunt.file.write(file.newPath, newContent);
341+
grunt.log.writeln('Processed file: ' + file.filepath);
342+
});
343+
});
344+
345+
grunt.registerTask('dist', ['sass', 'concat', 'uglify', 'replace-paths', 'cssmin']);
328346

329347
grunt.registerTask('plugins', 'Minify plugin JS / CSS files and copy images', function() {
330348
var js = [], css = [], img = [], fs = require('fs'), path = require('path');

api/parts/data/cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ class StreamedCollection {
971971
let [col, last] = await createCollection(this.db, this.name, 1e7);
972972

973973
this.col = col;
974-
this.stream = col.find({_id: {$gt: last}}, {tailable: true, awaitData: true, noCursorTimeout: true, numberOfRetries: -1}).stream();
974+
this.stream = col.find({_id: {$gt: last}}, {tailable: true, awaitData: true, numberOfRetries: -1}).stream();
975975

976976
this.stream.on('data', doc => {
977977
if (this.inserts.indexOf(doc._id.toString()) !== -1) {

api/parts/mgmt/cms.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,21 @@ function syncCMSDataToDB(params) {
157157
}
158158

159159
cmsApi.saveEntries = function(params) {
160+
161+
var entries = [];
162+
try {
163+
entries = JSON.parse(params.qstring.entries);
164+
}
165+
catch (ex) {
166+
log.e(params.qstring.entries);
167+
common.returnMessage(params, 400, 'Invalid entries parameter');
168+
return;
169+
}
170+
160171
transformAndStoreData(
161172
Object.assign({dataTransformed: true}, params),
162173
null,
163-
JSON.parse(params.qstring.entries),
174+
entries,
164175
function(err1) {
165176
if (err1) {
166177
log.e('An error occured while storing entries in DB: ' + err1);

api/parts/mgmt/mail.js

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ mail.sendToNewMember = function(member, memberPassword) {
186186
mail.sendToNewMemberLink = function(member, prid) {
187187
member.lang = member.lang || "en";
188188
mail.lookup(function(err, host) {
189+
if (config.path) {
190+
host = host + config.path;
191+
}
189192
localize.getProperties(member.lang, function(err2, properties) {
190193
var message = localize.format(properties["mail.new-member-prid"], mail.escapedHTMLString(mail.getUserFirstName(member)), host, mail.escapedHTMLString(member.username), prid);
191194
mail.sendMessage(member.email, properties["mail.new-member-subject"], message);
@@ -217,6 +220,9 @@ mail.sendToUpdatedMember = function(member, memberPassword) {
217220
mail.sendPasswordResetInfo = function(member, prid) {
218221
member.lang = member.lang || "en";
219222
mail.lookup(function(err, host) {
223+
if (config.path) {
224+
host = host + config.path;
225+
}
220226
localize.getProperties(member.lang, function(err2, properties) {
221227
var message = localize.format(properties["mail.password-reset"], mail.escapedHTMLString(mail.getUserFirstName(member)), host, prid);
222228
mail.sendMessage(member.email, properties["mail.password-reset-subject"], message);

api/utils/common.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,14 @@ function getJSON(val) {
181181
}
182182
return ret;
183183
}
184+
184185
/**
185-
* Logger object for creating module specific logging
186-
* @type {module:api/utils/log~Logger}
187-
* @example
188-
* var log = common.log('myplugin:api');
189-
* log.i('myPlugin got a request: %j', params.qstring);
190-
*/
186+
* Logger object for creating module-specific logging
187+
* @type {function(string): Logger}
188+
* @example
189+
* const log = common.log('myplugin:api');
190+
* log.i('myPlugin got a request: %j', params.qstring);
191+
*/
191192
common.log = logger;
192193

193194
/**

api/utils/log.js

+123-43
Original file line numberDiff line numberDiff line change
@@ -275,57 +275,124 @@ var ipcHandler = function(msg) {
275275
};
276276

277277
/**
278-
* Creates new logger object for provided module
279-
* @param {string} name - name of the module
280-
* @returns {module:api/utils/log~Logger} logger object
281-
**/
278+
* @typedef {Object} Logger
279+
* @property {function(): string} id - Get the logger id
280+
* @example
281+
* const loggerId = logger.id();
282+
* console.log(`Current logger ID: ${loggerId}`);
283+
*
284+
* @property {function(...*): void} d - Log debug level messages
285+
* @example
286+
* logger.d('Debug message: %s', 'Some debug info');
287+
*
288+
* @property {function(...*): void} i - Log information level messages
289+
* @example
290+
* logger.i('Info message: User %s logged in', username);
291+
*
292+
* @property {function(...*): void} w - Log warning level messages
293+
* @example
294+
* logger.w('Warning: %d attempts failed', attempts);
295+
*
296+
* @property {function(...*): void} e - Log error level messages
297+
* @example
298+
* logger.e('Error occurred: %o', errorObject);
299+
*
300+
* @property {function(string, function, string, ...*): boolean} f - Log variable level messages
301+
* @example
302+
* logger.f('d', (log) => {
303+
* const expensiveOperation = performExpensiveCalculation();
304+
* log('Debug: Expensive operation result: %j', expensiveOperation);
305+
* }, 'i', 'Skipped expensive debug logging');
306+
*
307+
* @property {function(function=): function} callback - Create a callback function for logging
308+
* @example
309+
* const logCallback = logger.callback((result) => {
310+
* console.log('Operation completed with result:', result);
311+
* });
312+
* someAsyncOperation(logCallback);
313+
*
314+
* @property {function(string, function=, function=): function} logdb - Create a callback function for logging database operations
315+
* @example
316+
* const dbCallback = logger.logdb('insert user',
317+
* (result) => { console.log('User inserted:', result); },
318+
* (error) => { console.error('Failed to insert user:', error); }
319+
* );
320+
* database.insertUser(userData, dbCallback);
321+
*
322+
* @property {function(string): Logger} sub - Create a sub-logger
323+
* @example
324+
* const subLogger = logger.sub('database');
325+
* subLogger.i('Connected to database');
326+
*/
327+
328+
/**
329+
* Creates a new logger object for the provided module
330+
* @module api/utils/log
331+
* @param {string} name - Name of the module
332+
* @returns {Logger} Logger object
333+
* @example
334+
* const logger = require('./log.js')('myModule');
335+
* logger.i('MyModule initialized');
336+
*/
282337
module.exports = function(name) {
283338
setLevel(name, logLevel(name));
284339
// console.log('Got level for ' + name + ': ' + levels[name] + ' ( prefs ', prefs);
285340
/**
286-
* @class Logger
287-
**/
341+
* @type Logger
342+
**/
288343
return {
289344
/**
290-
* Get logger id
291-
* @returns {string} id of this logger
292-
*/
345+
* Get logger id
346+
* @returns {string} id of this logger
347+
* @example
348+
* const loggerId = logger.id();
349+
* console.log(`Current logger ID: ${loggerId}`);
350+
*/
293351
id: () => name,
294352
/**
295-
* Log debug level messages
296-
* @memberof module:api/utils/log~Logger
297-
* @param {...*} var_args - string and values to format string with
298-
**/
353+
* Log debug level messages
354+
* @param {...*} var_args - string and values to format string with
355+
* @example
356+
* logger.d('Debug message: %s', 'Some debug info');
357+
*/
299358
d: log(NAMES.d, name, getEnabledWithLevel(ACCEPTABLE.d, name), this, console.log),
300359

301360
/**
302-
* Log information level messages
303-
* @memberof module:api/utils/log~Logger
304-
* @param {...*} var_args - string and values to format string with
305-
**/
361+
* Log information level messages
362+
* @param {...*} var_args - string and values to format string with
363+
* @example
364+
* logger.i('Info message: User %s logged in', username);
365+
*/
306366
i: log(NAMES.i, name, getEnabledWithLevel(ACCEPTABLE.i, name), this, console.info),
307367

308368
/**
309-
* Log warning level messages
310-
* @memberof module:api/utils/log~Logger
311-
* @param {...*} var_args - string and values to format string with
312-
**/
369+
* Log warning level messages
370+
* @param {...*} var_args - string and values to format string with
371+
* @example
372+
* logger.w('Warning: %d attempts failed', attempts);
373+
*/
313374
w: log(NAMES.w, name, getEnabledWithLevel(ACCEPTABLE.w, name), this, console.warn, styles.stylers.warn),
314375

315376
/**
316-
* Log error level messages
317-
* @memberof module:api/utils/log~Logger
318-
* @param {...*} var_args - string and values to format string with
319-
**/
377+
* Log error level messages
378+
* @param {...*} var_args - string and values to format string with
379+
* @example
380+
* logger.e('Error occurred: %o', errorObject);
381+
*/
320382
e: log(NAMES.e, name, getEnabledWithLevel(ACCEPTABLE.e, name), this, console.error, styles.stylers.error),
321383

322384
/**
323385
* Log variable level messages (for cases when logging parameters calculation are expensive enough and shouldn't be done unless the level is enabled)
324-
* @param {String} l log level (d, i, w, e)
325-
* @param {function} fn function to call with single argument - logging function
326-
* @param {String} fl fallback level if l is disabled
327-
* @param {any[]} fargs fallback level arguments
386+
* @param {string} l - log level (d, i, w, e)
387+
* @param {function} fn - function to call with single argument - logging function
388+
* @param {string} fl - fallback level if l is disabled
389+
* @param {...*} fargs - fallback level arguments
328390
* @returns {boolean} true if f() has been called
391+
* @example
392+
* logger.f('d', (log) => {
393+
* const expensiveOperation = performExpensiveCalculation();
394+
* log('Debug: Expensive operation result: %j', expensiveOperation);
395+
* }, 'i', 'Skipped expensive debug logging');
329396
*/
330397
f: function(l, fn, fl, ...fargs) {
331398
if (ACCEPTABLE[l].indexOf(levels[name] || deflt) !== -1) {
@@ -338,11 +405,15 @@ module.exports = function(name) {
338405
},
339406

340407
/**
341-
* Logging inside callbacks
342-
* @memberof module:api/utils/log~Logger
343-
* @param {function=} next - next function to call, after callback executed
344-
* @returns {function} function to pass as callback
345-
**/
408+
* Logging inside callbacks
409+
* @param {function=} next - next function to call, after callback executed
410+
* @returns {function} function to pass as callback
411+
* @example
412+
* const logCallback = logger.callback((result) => {
413+
* console.log('Operation completed with result:', result);
414+
* });
415+
* someAsyncOperation(logCallback);
416+
*/
346417
callback: function(next) {
347418
var self = this;
348419
return function(err) {
@@ -356,13 +427,18 @@ module.exports = function(name) {
356427
};
357428
},
358429
/**
359-
* Logging database callbacks
360-
* @memberof module:api/utils/log~Logger
361-
* @param {string} opname - name of the performed operation
362-
* @param {function=} next - next function to call, after callback executed
363-
* @param {function=} nextError - function to pass error to
364-
* @returns {function} function to pass as callback
365-
**/
430+
* Logging database callbacks
431+
* @param {string} opname - name of the performed operation
432+
* @param {function=} next - next function to call, after callback executed
433+
* @param {function=} nextError - function to pass error to
434+
* @returns {function} function to pass as callback
435+
* @example
436+
* const dbCallback = logger.logdb('insert user',
437+
* (result) => { console.log('User inserted:', result); },
438+
* (error) => { console.error('Failed to insert user:', error); }
439+
* );
440+
* database.insertUser(userData, dbCallback);
441+
*/
366442
logdb: function(opname, next, nextError) {
367443
var self = this;
368444
return function(err) {
@@ -382,9 +458,13 @@ module.exports = function(name) {
382458
},
383459
/**
384460
* Add one more level to the logging output while leaving loglevel the same
385-
* @param {string} subname sublogger name
386-
* @returns {object} new logger
461+
* @param {string} subname - sublogger name
462+
* @returns {Logger} new logger
463+
* @example
464+
* const subLogger = logger.sub('database');
465+
* subLogger.i('Connected to database');
387466
*/
467+
388468
sub: function(subname) {
389469
let full = name + ':' + subname,
390470
self = this;

0 commit comments

Comments
 (0)