diff --git a/Network/event.js b/Network/event.js index 41537f25f..ecc2b501c 100644 --- a/Network/event.js +++ b/Network/event.js @@ -16,14 +16,14 @@ exports.newEvent = function newEvent() { REPLY_TO_MULTI_MEDIA_POST: 11, REPOST_MULTI_MEDIA: 12, QUOTE_REPOST_MULTI_MEDIA: 13, - FOLLOW_MULTI_MEDIA_POSTS: 14, - UNFOLLOW_MULTIMEDIA_POSTS: 15, + FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: 14, + UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: 15, NEW_TRADE_POST: 20, REPLY_TO_TRADE_POST: 21, RE_POST_TRADE: 22, QUOTE_REPOST_TRADE: 23, - FOLLOW_TRADE_POSTS: 24, - UNFOLLOW_TRADE_POSTS: 25, + FOLLOW_USER_PROFILE_TRADE_POSTS: 24, + UNFOLLOW_USER_PROFILE_TRADE_POSTS: 25, REACTION_LIKE: 100, REACTION_LOVE: 101, REACTION_HAHA: 102, @@ -66,12 +66,12 @@ exports.newEvent = function newEvent() { thisObject.targetUserProfile = NT.memory.USER_PROFILES.get(event.targetUserProfileId) if (thisObject.targetUserProfile === undefined) { - /* The message is ignored when it does not have a target user profile and is required*/ + /* We thow an exception when it does not have a target user profile and is required*/ if ( event.eventType !== EVENT_TYPES.NEW_MULTI_MEDIA_POST && event.eventType !== EVENT_TYPES.NEW_TRADE_POST ) - return + throw ('Target User Profile Not Found.') } thisObject.eventId = event.eventId @@ -79,28 +79,78 @@ exports.newEvent = function newEvent() { thisObject.asset = event.asset thisObject.timestamp = event.timestamp - switch (true) { - case ( - event.eventType === EVENT_TYPES.NEW_MULTI_MEDIA_POST || - event.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || - event.eventType === EVENT_TYPES.REPOST_MULTI_MEDIA || - event.eventType === EVENT_TYPES.QUOTE_REPOST_MULTI_MEDIA || - event.eventType === EVENT_TYPES.NEW_TRADE_POST || - event.eventType === EVENT_TYPES.REPLY_TO_TRADE_POST || - event.eventType === EVENT_TYPES.RE_POST_TRADE || - event.eventType === EVENT_TYPES.QUOTE_REPOST_TRADE - ): { - let post = NT.modules.POST.newPost() - post.initialize( - event.emitterPostHash, - event.targetPostHash, - thisObject.eventType, - thisObject.emitterUserProfile, - thisObject.asset, - thisObject.timestamp + /* + Is is a new post? + */ + if ( + event.eventType === EVENT_TYPES.NEW_MULTI_MEDIA_POST || + event.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || + event.eventType === EVENT_TYPES.REPOST_MULTI_MEDIA || + event.eventType === EVENT_TYPES.QUOTE_REPOST_MULTI_MEDIA || + event.eventType === EVENT_TYPES.NEW_TRADE_POST || + event.eventType === EVENT_TYPES.REPLY_TO_TRADE_POST || + event.eventType === EVENT_TYPES.RE_POST_TRADE || + event.eventType === EVENT_TYPES.QUOTE_REPOST_TRADE + ) { + let post = NT.modules.POST.newPost() + post.initialize( + event.emitterPostHash, + event.targetPostHash, + thisObject.eventType, + thisObject.emitterUserProfile, + thisObject.asset, + thisObject.timestamp + ) + return + } + /* + Is is a following? + */ + if ( + event.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS || + event.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS || + event.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE_TRADE_POSTS || + event.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE_TRADE_POSTS + ) { + switch (event.eventType) { + case EVENT_TYPES.FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: { + thisObject.emitterUserProfile.addMultiMediaPostsFollowing( + thisObject.targetUserProfile + ) + thisObject.targetUserProfile.addMultiMediaPostsFollower( + thisObject.emitterUserProfile ) break } + case EVENT_TYPES.UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: { + thisObject.emitterUserProfile.removeMultiMediaPostsFollowing( + thisObject.targetUserProfile + ) + thisObject.targetUserProfile.removeMultiMediaPostsFollower( + thisObject.emitterUserProfile + ) + break + } + case EVENT_TYPES.FOLLOW_USER_PROFILE_TRADE_POSTS: { + thisObject.emitterUserProfile.addTradePostsFollowing( + thisObject.targetUserProfile + ) + thisObject.targetUserProfile.addTradePostsFollower( + thisObject.emitterUserProfile + ) + break + } + case EVENT_TYPES.UNFOLLOW_USER_PROFILE_TRADE_POSTS: { + thisObject.emitterUserProfile.removeTradePostsFollowing( + thisObject.targetUserProfile + ) + thisObject.targetUserProfile.removeTradePostsFollower( + thisObject.emitterUserProfile + ) + break + } + } + return } } } \ No newline at end of file diff --git a/Network/post.js b/Network/post.js index 9fd9ae991..bac0a1a1c 100644 --- a/Network/post.js +++ b/Network/post.js @@ -54,12 +54,12 @@ exports.newPost = function newPost() { Let's find the Target Post */ if ( - event.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || - event.eventType === EVENT_TYPES.REPOST_MULTI_MEDIA || - event.eventType === EVENT_TYPES.QUOTE_REPOST_MULTI_MEDIA || - event.eventType === EVENT_TYPES.REPLY_TO_TRADE_POST || - event.eventType === EVENT_TYPES.RE_POST_TRADE || - event.eventType === EVENT_TYPES.QUOTE_REPOST_TRADE + event.eventType === POST_TYPES.REPLY_TO_MULTI_MEDIA_POST || + event.eventType === POST_TYPES.REPOST_MULTI_MEDIA || + event.eventType === POST_TYPES.QUOTE_REPOST_MULTI_MEDIA || + event.eventType === POST_TYPES.REPLY_TO_TRADE_POST || + event.eventType === POST_TYPES.RE_POST_TRADE || + event.eventType === POST_TYPES.QUOTE_REPOST_TRADE ) { thisObject.targetPost = NT.memory.POSTS.get(thisObject.targetPostHash) @@ -71,8 +71,8 @@ exports.newPost = function newPost() { Let's add this post to the replies of the Target Post */ if ( - event.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || - event.eventType === EVENT_TYPES.REPLY_TO_TRADE_POST + event.eventType === POST_TYPES.REPLY_TO_MULTI_MEDIA_POST || + event.eventType === POST_TYPES.REPLY_TO_TRADE_POST ) { thisObject.targetPost.replies.push(thisObject) } diff --git a/Network/userProfile.js b/Network/userProfile.js index 255bc1140..03bd37aa4 100644 --- a/Network/userProfile.js +++ b/Network/userProfile.js @@ -4,18 +4,26 @@ exports.newUserProfile = function newUserProfile() { userProfieId: undefined, githubUsername: undefined, blockchainAccount: undefined, - postFollowing: undefined, - postFollowers: undefined, - tradeFollowing: undefined, - tradeFollowers: undefined, + multiMediaPostsFollowing: undefined, + multiMediaPostsFollowers: undefined, + tradePostsFollowing: undefined, + tradePostsFollowers: undefined, ranking: undefined, events: undefined, - postFollowingCount: undefined, - postFollowersCount: undefined, - tradeFollowingCount: undefined, - tradeFollowersCount: undefined, + multiMediaPostFollowingCount: undefined, + multiMediaPostFollowersCount: undefined, + tradePostsFollowingCount: undefined, + tradePostsFollowersCount: undefined, eventsCount: undefined, postsCount: undefined, + addMultiMediaPostsFollowing: addMultiMediaPostsFollowing, + removeMultiMediaPostsFollowing: removeMultiMediaPostsFollowing, + addTradePostsFollowing: addTradePostsFollowing, + removeTradePostsFollowing: removeTradePostsFollowing, + addMultiMediaPostsFollower: addMultiMediaPostsFollower, + removeMultiMediaPostsFollower: removeMultiMediaPostsFollower, + addTradePostsFollower: addTradePostsFollower, + removeTradePostsFollower: removeTradePostsFollower, initialize: initialize, finalize: finalize } @@ -28,20 +36,92 @@ exports.newUserProfile = function newUserProfile() { function initialize() { - thisObject.postFollowing = new Map() - thisObject.postFollowers = new Map() + thisObject.multiMediaPostsFollowing = new Map() + thisObject.multiMediaPostsFollowers = new Map() - thisObject.tradeFollowing = new Map() - thisObject.tradeFollowers = new Map() + thisObject.tradePostsFollowing = new Map() + thisObject.tradePostsFollowers = new Map() - thisObject.events = [] + thisObject.events = [] // Dont know what this is - thisObject.postFollowingCount = 0 - thisObject.postFollowersCount = 0 - thisObject.tradeFollowingCount = 0 - thisObject.tradeFollowersCount = 0 + thisObject.multiMediaPostFollowingCount = 0 + thisObject.multiMediaPostFollowersCount = 0 + thisObject.tradePostsFollowingCount = 0 + thisObject.tradePostsFollowersCount = 0 thisObject.eventsCount = 0 thisObject.postsCount = 0 } + + function addMultiMediaPostsFollowing( + userProfile + ) { + if (thisObject.multiMediaPostsFollowing.get(userProfile.id) === undefined) { + thisObject.multiMediaPostsFollowing.set(userProfile.id, userProfile) + thisObject.multiMediaPostFollowingCount++ + } + } + + function removeMultiMediaPostsFollowing( + userProfile + ) { + if (thisObject.multiMediaPostsFollowing.get(userProfile.id) !== undefined) { + thisObject.multiMediaPostsFollowing.delete(userProfile.id) + thisObject.multiMediaPostFollowingCount-- + } + } + + function addTradePostsFollowing( + userProfile + ) { + if (thisObject.tradePostsFollowingCount.get(userProfile.id) === undefined) { + thisObject.tradePostsFollowingCount.set(userProfile.id, userProfile) + thisObject.tradePostsFollowingCount++ + } + } + + function removeTradePostsFollowing( + userProfile + ) { + if (thisObject.tradePostsFollowingCount.get(userProfile.id) !== undefined) { + thisObject.tradePostsFollowingCount.delete(userProfile.id) + thisObject.tradePostsFollowingCount-- + } + } + + function addMultiMediaPostsFollower( + userProfile + ) { + if (thisObject.multiMediaPostsFollowers.get(userProfile.id) === undefined) { + thisObject.multiMediaPostsFollowers.set(userProfile.id, userProfile) + thisObject.multiMediaPostFollowersCount++ + } + } + + function removeMultiMediaPostsFollower( + userProfile + ) { + if (thisObject.multiMediaPostsFollowers.get(userProfile.id) !== undefined) { + thisObject.multiMediaPostsFollowers.delete(userProfile.id) + thisObject.multiMediaPostFollowersCount-- + } + } + + function addTradePostsFollower( + userProfile + ) { + if (thisObject.tradePostsFollowers.get(userProfile.id) === undefined) { + thisObject.tradePostsFollowers.set(userProfile.id, userProfile) + thisObject.tradePostsFollowersCount++ + } + } + + function removeTradePostsFollower( + userProfile + ) { + if (thisObject.tradePostsFollowers.get(userProfile.id) !== undefined) { + thisObject.tradePostsFollowers.delete(userProfile.id) + thisObject.tradePostsFollowersCount-- + } + } } \ No newline at end of file diff --git a/Projects/Foundations/CL/Utilities/Plugins.js b/Projects/Foundations/CL/Utilities/Plugins.js index 60b18b8eb..7a639c1bc 100644 --- a/Projects/Foundations/CL/Utilities/Plugins.js +++ b/Projects/Foundations/CL/Utilities/Plugins.js @@ -37,6 +37,7 @@ exports.newFoundationsUtilitiesPlugins = function () { function onFileRead(err, file) { if (err) { + console.log('[WARN] getPluginFileContent -> File not Found -> Path = ' + path) reject() return } diff --git a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json index 1d2f6cfdb..2cdfb8bee 100644 --- a/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json +++ b/Projects/Governance/Plugins/User-Profiles/Luis-Fernando-Molina.json @@ -12687,7 +12687,7 @@ { "type": "Delegate Power Switch", "name": "Thomas", - "config": "{\n \"percentage\": 20\n}", + "config": "{\n \"percentage\": 25\n}", "project": "Governance", "delegatePowerSwitch": [], "userDelegates": [ @@ -12759,10 +12759,50 @@ { "type": "Delegate Power Switch", "name": "Carl", - "config": "{\n \"percentage\": 10\n}", + "config": "{\n \"percentage\": 5\n}", "project": "Governance", "delegatePowerSwitch": [], - "userDelegates": [], + "userDelegates": [ + { + "type": "User Delegate", + "name": "cozed-gh", + "config": "{}", + "project": "Governance", + "id": "ee1b374b-d4af-494c-93b8-3f83849d85f2", + "savedPayload": { + "position": { + "x": 29086.823038139588, + "y": 24155.700841731268 + }, + "targetPosition": { + "x": 29329.52813645207, + "y": 23979.365266043525 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + }, + "referenceParent": { + "type": "User Profile", + "name": "cozed-gh", + "id": "07f0b13a-a50f-4488-8a2c-a3f8f08e889d" + }, + "referenceParentCombinedNodePath": [ + [ + "cozed-gh", + "User Profile" + ] + ] + } + } + ], "id": "7edd2cfb-0e46-4d2a-8899-0e7193c85815", "savedPayload": { "position": { @@ -12899,7 +12939,9 @@ "referenceParentCombinedNodePath": [ [ "ssplatt", - "User Profile" + "User Profile", + "Governance", + "56600855-7a91-49e8-8a58-2fa28d07efd1" ] ] } @@ -13047,7 +13089,7 @@ "floatingObject": { "isPinned": false, "isFrozen": false, - "isCollapsed": false, + "isCollapsed": true, "angleToParent": 2, "distanceToParent": 3, "arrangementStyle": 0 diff --git a/Projects/Governance/Plugins/Workspaces/Token-Distribution-Superalgos.json b/Projects/Governance/Plugins/Workspaces/Token-Distribution-Superalgos.json index e80a69583..cb49542ee 100644 --- a/Projects/Governance/Plugins/Workspaces/Token-Distribution-Superalgos.json +++ b/Projects/Governance/Plugins/Workspaces/Token-Distribution-Superalgos.json @@ -751,8 +751,8 @@ "id": "cccfce2d-3497-419b-8c32-4cd62fb1b33f", "savedPayload": { "position": { - "x": 35658.20216094481, - "y": 10974.074517595023 + "x": 35663.291373066735, + "y": 10973.117651551496 }, "targetPosition": { "x": 35605.314597728066, @@ -779,8 +779,8 @@ "id": "5c0f79f5-416f-46cf-8055-708b71613278", "savedPayload": { "position": { - "x": 35585.99509830314, - "y": 10978.150418473559 + "x": 35596.339957877244, + "y": 10978.638866218294 }, "targetPosition": { "x": 35605.314597728066, @@ -834,8 +834,8 @@ "id": "49a18a94-de50-4285-bf38-fe43c700b93f", "savedPayload": { "position": { - "x": 35514.910814744515, - "y": 10964.827599917864 + "x": 35529.83856860471, + "y": 10969.123561068443 }, "targetPosition": { "x": 35605.314597728066, @@ -862,8 +862,8 @@ "id": "7096909f-b221-4fb7-a5ec-5a76d147dc2f", "savedPayload": { "position": { - "x": 35449.08047044852, - "y": 10934.880335715925 + "x": 35467.121862592874, + "y": 10945.04887323461 }, "targetPosition": { "x": 35605.314597728066, @@ -890,8 +890,8 @@ "id": "bdcdfb11-07a0-42fc-b5ec-09ba55c6dcf6", "savedPayload": { "position": { - "x": 35392.32988574206, - "y": 10890.04905200928 + "x": 35411.33471736332, + "y": 10907.622008091923 }, "targetPosition": { "x": 35605.314597728066, @@ -918,8 +918,8 @@ "id": "6ebdfb57-965a-43d4-a048-31315d0947cf", "savedPayload": { "position": { - "x": 35347.957198328295, - "y": 10832.939180051875 + "x": 35365.2745333247, + "y": 10858.719704939618 }, "targetPosition": { "x": 35605.314597728066, @@ -946,8 +946,8 @@ "id": "00a46dc7-6fbd-45d1-870a-fab7924ee5c0", "savedPayload": { "position": { - "x": 35318.54118751157, - "y": 10766.869738015934 + "x": 35331.25096043528, + "y": 10800.794129455984 }, "targetPosition": { "x": 35605.314597728066, @@ -974,36 +974,8 @@ "id": "99c7c2c7-eb03-476e-8e0b-9480e3dca261", "savedPayload": { "position": { - "x": 35305.79140491768, - "y": 10695.680441719935 - }, - "targetPosition": { - "x": 35605.314597728066, - "y": 10678.773136533244 - }, - "floatingObject": { - "isPinned": false, - "isFrozen": false, - "isCollapsed": false, - "angleToParent": 2, - "distanceToParent": 3, - "arrangementStyle": 0 - }, - "uiObject": { - "isRunning": false - } - } - }, - { - "type": "Plugin File", - "name": "Cachito", - "config": "{\"project\":\"Governance\",\"fileName\":\"Cachito\",\"folderName\":\"User-Profiles\",\"nodeType\":\"User Profile\",\"saveWithWorkspace\":false}", - "project": "Foundations", - "id": "15ab3baf-bc60-4b6a-8c6b-dc087271df68", - "savedPayload": { - "position": { - "x": 35310.448821567436, - "y": 10623.50855430204 + "x": 35310.97008270981, + "y": 10736.74991187191 }, "targetPosition": { "x": 35605.314597728066, @@ -1057,8 +1029,8 @@ "id": "aeed0c96-3e89-426c-bf61-12b6e23c6916", "savedPayload": { "position": { - "x": 35332.24276533416, - "y": 10554.54844352484 + "x": 35305.448868043015, + "y": 10669.798496682424 }, "targetPosition": { "x": 35605.314597728066, @@ -1112,8 +1084,8 @@ "id": "5d42dd71-edb0-409a-8caa-20a74e7ca269", "savedPayload": { "position": { - "x": 35369.90665142389, - "y": 10492.807820366901 + "x": 35314.964173192864, + "y": 10603.297107409891 }, "targetPosition": { "x": 35605.314597728066, @@ -1167,8 +1139,8 @@ "id": "e7165758-71ad-44dd-b6c4-585b5e295d85", "savedPayload": { "position": { - "x": 35421.25159167974, - "y": 10441.87482542813 + "x": 35339.0388610267, + "y": 10540.580401398054 }, "targetPosition": { "x": 35605.314597728066, @@ -1186,6 +1158,62 @@ "isRunning": false } } + }, + { + "type": "Plugin File", + "name": "cozed-gh", + "config": "{\"project\":\"Governance\",\"fileName\":\"cozed-gh\",\"folderName\":\"User-Profiles\",\"nodeType\":\"User Profile\",\"saveWithWorkspace\":false}", + "project": "Foundations", + "id": "21126c69-67ed-4839-8611-8feac8578cf6", + "savedPayload": { + "position": { + "x": 35376.46572616939, + "y": 10484.793256168505 + }, + "targetPosition": { + "x": 35605.314597728066, + "y": 10678.773136533244 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } + }, + { + "type": "Plugin File", + "name": "ssplatt", + "config": "{\"project\":\"Governance\",\"fileName\":\"ssplatt\",\"folderName\":\"User-Profiles\",\"nodeType\":\"User Profile\",\"saveWithWorkspace\":false}", + "project": "Foundations", + "id": "ded04ad6-6b18-4166-bb97-35a9521b9104", + "savedPayload": { + "position": { + "x": 35425.36802932169, + "y": 10438.733072129882 + }, + "targetPosition": { + "x": 35605.314597728066, + "y": 10678.773136533244 + }, + "floatingObject": { + "isPinned": false, + "isFrozen": false, + "isCollapsed": false, + "angleToParent": 2, + "distanceToParent": 3, + "arrangementStyle": 0 + }, + "uiObject": { + "isRunning": false + } + } } ], "id": "2c899fe9-1335-4e9f-b2d0-45a83e478fd0", @@ -1201,7 +1229,7 @@ "floatingObject": { "isPinned": false, "isFrozen": false, - "isCollapsed": true, + "isCollapsed": false, "angleToParent": 2, "distanceToParent": 3, "arrangementStyle": 0