From ddec45221c44de274cca1665a043ddd4a6948ff8 Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 13:55:50 +0300 Subject: [PATCH 1/9] changed-async-create-function --- src/groups/create.js | 69 +++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/src/groups/create.js b/src/groups/create.js index 5172038052..ad7c304414 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -7,53 +7,76 @@ const db = require('../database'); module.exports = function (Groups) { Groups.create = async function (data) { - const isSystem = isSystemGroup(data); + // Determine basic properties const timestamp = data.timestamp || Date.now(); - let disableJoinRequests = parseInt(data.disableJoinRequests, 10) === 1 ? 1 : 0; - if (data.name === 'administrators') { - disableJoinRequests = 1; - } + const isSystem = isSystemGroup(data); + const disableJoinRequests = getDisableJoinRequests(data); const disableLeave = parseInt(data.disableLeave, 10) === 1 ? 1 : 0; const isHidden = parseInt(data.hidden, 10) === 1; + const isPrivate = data.private ? parseInt(data.private, 10) === 1 : true; + const memberCount = data.ownerUid ? 1 : 0; + // Validate group name Groups.validateGroupName(data.name); + // Check for existing groups + await checkGroupExistence(data.name); + + // Create group data + const groupData = createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount); + + // Fire hooks and save group data + await plugins.hooks.fire('filter:group.create', { group: groupData, data }); + await saveGroupData(groupData, data.ownerUid, timestamp); + + // Return updated group data + const updatedGroupData = await Groups.getGroupData(groupData.name); + plugins.hooks.fire('action:group.create', { group: updatedGroupData }); + return updatedGroupData; + }; + + function getDisableJoinRequests(data) { + if (data.name === 'administrators') return 1; + return parseInt(data.disableJoinRequests, 10) === 1 ? 1 : 0; + } + + async function checkGroupExistence(name) { const [exists, privGroupExists] = await Promise.all([ - meta.userOrGroupExists(data.name), - privilegeGroupExists(data.name), + meta.userOrGroupExists(name), + privilegeGroupExists(name), ]); if (exists || privGroupExists) { throw new Error('[[error:group-already-exists]]'); } + } - const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0; - const isPrivate = data.hasOwnProperty('private') && data.private !== undefined ? parseInt(data.private, 10) === 1 : true; - let groupData = { + function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { + return { name: data.name, slug: slugify(data.name), createtime: timestamp, userTitle: data.userTitle || data.name, userTitleEnabled: parseInt(data.userTitleEnabled, 10) === 1 ? 1 : 0, description: data.description || '', - memberCount: memberCount, + memberCount, hidden: isHidden ? 1 : 0, system: isSystem ? 1 : 0, private: isPrivate ? 1 : 0, - disableJoinRequests: disableJoinRequests, - disableLeave: disableLeave, + disableJoinRequests, + disableLeave, }; + } - await plugins.hooks.fire('filter:group.create', { group: groupData, data: data }); - + async function saveGroupData(groupData, ownerUid, timestamp) { await db.sortedSetAdd('groups:createtime', groupData.createtime, groupData.name); await db.setObject(`group:${groupData.name}`, groupData); - if (data.hasOwnProperty('ownerUid')) { - await db.setAdd(`group:${groupData.name}:owners`, data.ownerUid); - await db.sortedSetAdd(`group:${groupData.name}:members`, timestamp, data.ownerUid); + if (ownerUid) { + await db.setAdd(`group:${groupData.name}:owners`, ownerUid); + await db.sortedSetAdd(`group:${groupData.name}:members`, timestamp, ownerUid); } - if (!isHidden && !isSystem) { + if (!groupData.hidden && !groupData.system) { await db.sortedSetAddBulk([ ['groups:visible:createtime', timestamp, groupData.name], ['groups:visible:memberCount', groupData.memberCount, groupData.name], @@ -64,11 +87,11 @@ module.exports = function (Groups) { if (!Groups.isPrivilegeGroup(groupData.name)) { await db.setObjectField('groupslug:groupname', groupData.slug, groupData.name); } + } - groupData = await Groups.getGroupData(groupData.name); - plugins.hooks.fire('action:group.create', { group: groupData }); - return groupData; - }; + async function privilegeGroupExists(name) { + return Groups.isPrivilegeGroup(name) && await db.isSortedSetMember('groups:createtime', name); + } function isSystemGroup(data) { return data.system === true || parseInt(data.system, 10) === 1 || From 862544d9347ac177a376e82dd8f5e999eceb568f Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 15:08:38 +0300 Subject: [PATCH 2/9] Refactored code 2 --- dump.rdb | Bin 0 -> 70505 bytes src/groups/create.js | 16 +++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 dump.rdb diff --git a/dump.rdb b/dump.rdb new file mode 100644 index 0000000000000000000000000000000000000000..d6eb166b05113ee1ef16426b29bbb942ac2454e0 GIT binary patch literal 70505 zcmdUY349yXo&OtMmgPf|Z|BnZ$Q{|1Z>xbF$2lQ^kONvESR-j8}BFIhd z5DK)=nzP+*+hw=^?OttH!P{;B-J{*@-KGBy^kQ$?djH*?`TyQ~Gt$g>Bs+m5{NZCl zJo9GWy!U&*`}h6r*sy-f&aN(>?^oq1AsiLG`-PNsprgB^?^h1`i(oV@=D1&3L+R** z@QV2(---Ono)LwxcS4wW#q}Sn(XZ@$BH|75qL4$sL%-&J%eZWCL(1=)9!?COS$u{; zXbC!we--B^gz{56`BaL(bzF!=BhjirqfLxu#>!8LTqD|-YpmXzh{nTwS}30hulvPk z&$H_*%O8#LVmc9zMdLz+#MIl5ifKNb5zCHdn>}TRGSRSwVU8zxQ9O`Hh08zN-p#lB zy4!c&KfWv4>FGGo8QwOrqjOW|hJo8t`!i$1_dhVSch|wb#NAu^#t+=#+I@Q@bPFFz zrP54J37n9f zBJS_5N6ckc3;9rgC>r*6`ID*W{%A}XgO`$Di~b-VpXR%#uXtX~)R>cYBo8?8$wH75A!W{A^6 zH+yad+O(iE_>>e5iF4-b_-kOj$}7%qiY0P>jl-Fa!G`^Kc)4e} zYQsK?H%vFOnQWMD=nA@H9VTxt>{tivnEWH54(*QpknC7myJPG@ykkA{-7!;<9s6VU zTw%vbQnK4cd9`2R&!X2$*6)LAHtqKfbocf4b$565_YZY1q^ue5&t@EbFU9C@hnjh?F$A(+n`=iGHxlQ*wvI`R|Cc7f3yVq8d;LKmS7jBFu``smtc#r zm`|{$=S{FGf+NR1PjJAP-HocNSZz>bt4wzcGjkS85K6mFO!Sm&sXSI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2AJ6{dI^HyTvfy@Xo0dQDCt@Pgq2WR~acBo0Fjmrp2$ixyOu__<8z z#Ug$#fYc@MO+%3P?)NR5Ig^j%s3G5tP9gTh7HJo)yPax*`2NK-%eakZ8Rx?*S}l;K z`&^|KSW0q%KWqN&qGzlB(0t<-Zmb>$SzOq9{FI^%nIRaKt1w%bnLmO*z=r(eT!q!f z%>2YspY1eb?vksp5OF`%NEr%cBy%J&t0IpI5zL3nsYCm^jUb#x%{{L<{wvLPxH|mT zIkxf&@L%bP=$2uor@77CsAm+m(SoLC`FL@_7@r6?ASU(n`@36a@>;J{v)a+?>jmiP zmYJX0>jSHaG{79X%dcR|s#EIbittkh&MZ{sYvDhW^A!4K=P4+*sq)>uLjzp{4cHAL zBYCO&Zx|UX1t*3=rPnBW^3K7Rr2*ip4AjepP_c&g^UvXNSJI;lSq@OLCYvML+=hAO zq)}z?%5&0WC6coA)g~`C>`Ne!zC&`-WHGC^q7>Sdml2pa$W!?QD1NJfE2<_k>#B)- anrfoF8A#ks(4zKo`uV9J$KHMX1OE>r#g2Rc literal 0 HcmV?d00001 diff --git a/src/groups/create.js b/src/groups/create.js index ad7c304414..49a2153565 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -22,9 +22,14 @@ module.exports = function (Groups) { // Check for existing groups await checkGroupExistence(data.name); - // Create group data - const groupData = createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount); + const a = disableLeave; + const b = memberCount; + const c = disableJoinRequests; + const d = isPrivate; + const e = isHidden; + // Create group data + const groupData = createGroupData(data, timestamp, isSystem, e, d, c, a, b); // Fire hooks and save group data await plugins.hooks.fire('filter:group.create', { group: groupData, data }); await saveGroupData(groupData, data.ownerUid, timestamp); @@ -50,7 +55,8 @@ module.exports = function (Groups) { } } - function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { + function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, + disableJoinRequests, disableLeave, memberCount) { return { name: data.name, slug: slugify(data.name), @@ -99,10 +105,6 @@ module.exports = function (Groups) { Groups.isPrivilegeGroup(data.name); } - async function privilegeGroupExists(name) { - return Groups.isPrivilegeGroup(name) && await db.isSortedSetMember('groups:createtime', name); - } - Groups.validateGroupName = function (name) { if (!name) { throw new Error('[[error:group-name-too-short]]'); From 1b9af85acf9ad31646f304c7a20182a77eba9cbd Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 15:25:10 +0300 Subject: [PATCH 3/9] Fixed-Testing-Errors --- src/groups/create.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/groups/create.js b/src/groups/create.js index 49a2153565..fb25aa2851 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -55,6 +55,7 @@ module.exports = function (Groups) { } } + // Function to create group data function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { return { From f5da393cf7fbc98cd1413ff3766e30d06542299e Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 15:34:11 +0300 Subject: [PATCH 4/9] Fixed-Testing-Errors --- src/groups/create.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/groups/create.js b/src/groups/create.js index fb25aa2851..84c0fb9d9f 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -55,9 +55,13 @@ module.exports = function (Groups) { } } + mock_data = {data, timestamp} + // Function to create group data - function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, + function createGroupData(mock_data, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { + data = mock_data.data + timestamp = mock_data.timestamp return { name: data.name, slug: slugify(data.name), From ff3c0e269b5e79d6cc2b81e72c32113765b82125 Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 15:35:01 +0300 Subject: [PATCH 5/9] Reduced-Function_Parameters --- src/groups/create.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/groups/create.js b/src/groups/create.js index 84c0fb9d9f..901fdc2e57 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -55,13 +55,13 @@ module.exports = function (Groups) { } } - mock_data = {data, timestamp} + mock_dat = {data, timestamp} // Function to create group data - function createGroupData(mock_data, isSystem, isHidden, isPrivate, + function createGroupData(mock_dat, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { - data = mock_data.data - timestamp = mock_data.timestamp + data = mock_dat.data + timestamp = mock_dat.timestamp return { name: data.name, slug: slugify(data.name), From cb536a5f59761527a37a3d205f2cb340baf497d2 Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 15:40:02 +0300 Subject: [PATCH 6/9] Fixed-Lint-Errors --- src/groups/create.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/groups/create.js b/src/groups/create.js index 901fdc2e57..b8a8764b87 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -54,14 +54,9 @@ module.exports = function (Groups) { throw new Error('[[error:group-already-exists]]'); } } - - mock_dat = {data, timestamp} - // Function to create group data - function createGroupData(mock_dat, isSystem, isHidden, isPrivate, + function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, disableJoinRequests, disableLeave, memberCount) { - data = mock_dat.data - timestamp = mock_dat.timestamp return { name: data.name, slug: slugify(data.name), From 7974f1f0770cdc43b8300068b45638176de5b4ef Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 16:08:17 +0300 Subject: [PATCH 7/9] Fixed-Linter-Errors --- src/groups/create.js | 86 +++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 54 deletions(-) diff --git a/src/groups/create.js b/src/groups/create.js index b8a8764b87..4bc5b1700a 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -7,82 +7,48 @@ const db = require('../database'); module.exports = function (Groups) { Groups.create = async function (data) { - // Determine basic properties - const timestamp = data.timestamp || Date.now(); const isSystem = isSystemGroup(data); + const timestamp = getTimestamp(data); const disableJoinRequests = getDisableJoinRequests(data); const disableLeave = parseInt(data.disableLeave, 10) === 1 ? 1 : 0; const isHidden = parseInt(data.hidden, 10) === 1; - const isPrivate = data.private ? parseInt(data.private, 10) === 1 : true; - const memberCount = data.ownerUid ? 1 : 0; - - // Validate group name Groups.validateGroupName(data.name); - - // Check for existing groups - await checkGroupExistence(data.name); - - const a = disableLeave; - const b = memberCount; - const c = disableJoinRequests; - const d = isPrivate; - const e = isHidden; - - // Create group data - const groupData = createGroupData(data, timestamp, isSystem, e, d, c, a, b); - // Fire hooks and save group data - await plugins.hooks.fire('filter:group.create', { group: groupData, data }); - await saveGroupData(groupData, data.ownerUid, timestamp); - - // Return updated group data - const updatedGroupData = await Groups.getGroupData(groupData.name); - plugins.hooks.fire('action:group.create', { group: updatedGroupData }); - return updatedGroupData; - }; - - function getDisableJoinRequests(data) { - if (data.name === 'administrators') return 1; - return parseInt(data.disableJoinRequests, 10) === 1 ? 1 : 0; - } - - async function checkGroupExistence(name) { const [exists, privGroupExists] = await Promise.all([ - meta.userOrGroupExists(name), - privilegeGroupExists(name), + meta.userOrGroupExists(data.name), + privilegeGroupExists(data.name), ]); if (exists || privGroupExists) { throw new Error('[[error:group-already-exists]]'); } - } - // Function to create group data - function createGroupData(data, timestamp, isSystem, isHidden, isPrivate, - disableJoinRequests, disableLeave, memberCount) { - return { + + const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0; + const isPrivate = data.hasOwnProperty('private') && data.private !== undefined ? parseInt(data.private, 10) === 1 : true; + let groupData = { name: data.name, slug: slugify(data.name), createtime: timestamp, userTitle: data.userTitle || data.name, userTitleEnabled: parseInt(data.userTitleEnabled, 10) === 1 ? 1 : 0, description: data.description || '', - memberCount, + memberCount: memberCount, hidden: isHidden ? 1 : 0, system: isSystem ? 1 : 0, private: isPrivate ? 1 : 0, - disableJoinRequests, - disableLeave, + disableJoinRequests: disableJoinRequests, + disableLeave: disableLeave, }; - } - async function saveGroupData(groupData, ownerUid, timestamp) { + await plugins.hooks.fire('filter:group.create', { group: groupData, data: data }); + await db.sortedSetAdd('groups:createtime', groupData.createtime, groupData.name); await db.setObject(`group:${groupData.name}`, groupData); - if (ownerUid) { - await db.setAdd(`group:${groupData.name}:owners`, ownerUid); - await db.sortedSetAdd(`group:${groupData.name}:members`, timestamp, ownerUid); + if (data.hasOwnProperty('ownerUid')) { + await db.setAdd(`group:${groupData.name}:owners`, data.ownerUid); + await db.sortedSetAdd(`group:${groupData.name}:members`, timestamp, data.ownerUid); } - if (!groupData.hidden && !groupData.system) { + if (!isHidden && !isSystem) { await db.sortedSetAddBulk([ ['groups:visible:createtime', timestamp, groupData.name], ['groups:visible:memberCount', groupData.memberCount, groupData.name], @@ -93,18 +59,30 @@ module.exports = function (Groups) { if (!Groups.isPrivilegeGroup(groupData.name)) { await db.setObjectField('groupslug:groupname', groupData.slug, groupData.name); } - } - async function privilegeGroupExists(name) { - return Groups.isPrivilegeGroup(name) && await db.isSortedSetMember('groups:createtime', name); + groupData = await Groups.getGroupData(groupData.name); + plugins.hooks.fire('action:group.create', { group: groupData }); + return groupData; + }; + function getTimestamp(data) { + return data.timestamp || Date.now(); + } + function getDisableJoinRequests(data) { + if (data.name === 'administrators') { + return 1; + } + return parseInt(data.disableJoinRequests, 10) === 1 ? 1 : 0; } - function isSystemGroup(data) { return data.system === true || parseInt(data.system, 10) === 1 || Groups.systemGroups.includes(data.name) || Groups.isPrivilegeGroup(data.name); } + async function privilegeGroupExists(name) { + return Groups.isPrivilegeGroup(name) && await db.isSortedSetMember('groups:createtime', name); + } + Groups.validateGroupName = function (name) { if (!name) { throw new Error('[[error:group-name-too-short]]'); From d63e1eb07b18dbff404a8940fc6cba65f5682e9a Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 17:41:29 +0300 Subject: [PATCH 8/9] Fixed3 --- src/groups/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/groups/create.js b/src/groups/create.js index 4bc5b1700a..2195b6315b 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -20,7 +20,7 @@ module.exports = function (Groups) { if (exists || privGroupExists) { throw new Error('[[error:group-already-exists]]'); } - + console.log('sarra : refactored code executed'); const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0; const isPrivate = data.hasOwnProperty('private') && data.private !== undefined ? parseInt(data.private, 10) === 1 : true; let groupData = { From 11f5b5988961af5324ba902d08c07171cff5f9be Mon Sep 17 00:00:00 2001 From: seif khelifi Date: Thu, 5 Sep 2024 17:43:52 +0300 Subject: [PATCH 9/9] Fixed44 --- src/groups/create.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/groups/create.js b/src/groups/create.js index 2195b6315b..08f6e59ac2 100644 --- a/src/groups/create.js +++ b/src/groups/create.js @@ -20,7 +20,7 @@ module.exports = function (Groups) { if (exists || privGroupExists) { throw new Error('[[error:group-already-exists]]'); } - console.log('sarra : refactored code executed'); + console.log('sarra : refactored code executed'); const memberCount = data.hasOwnProperty('ownerUid') ? 1 : 0; const isPrivate = data.hasOwnProperty('private') && data.private !== undefined ? parseInt(data.private, 10) === 1 : true; let groupData = {