diff --git a/Network/NetwokNode.js b/Network/NetwokNode.js index c2b1b55a5..fa5c8f701 100644 --- a/Network/NetwokNode.js +++ b/Network/NetwokNode.js @@ -16,9 +16,9 @@ global.NT = { }, modules: { USER_PROFILE: require('./UserProfile.js'), + BOT: require('./BotProfile.js'), EVENT: require('./Event.js'), POST: require('./Post.js'), - BOT: require('./Bot.js'), QUERY: require('./Query.js'), QUERY_PROFILE_STATS: require('./Queries/ProfileStats.js'), QUERY_PROFILE_POSTS: require('./Queries/ProfilePosts.js'), diff --git a/Network/Queries/Events.js b/Network/Queries/Events.js index fb401ea2f..bb84a4de8 100644 --- a/Network/Queries/Events.js +++ b/Network/Queries/Events.js @@ -145,13 +145,13 @@ exports.newEvents = function newEvents() { Test #2 : The Emitter or Traget profile must be at the Following map of the Query Profile. */ if (emitterUserProfile !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(emitterUserProfile.userProfieId) !== undefined) { + if (thisObject.profile.following.get(emitterUserProfile.userProfieId) !== undefined) { addToResponse(event) return } } if (targetUserProfile !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(targetUserProfile.userProfieId) !== undefined) { + if (thisObject.profile.following.get(targetUserProfile.userProfieId) !== undefined) { addToResponse(event) return } @@ -160,25 +160,25 @@ exports.newEvents = function newEvents() { Test #3 : The Emmiter or Target post must be belong to any profile at the Following of the Query Profile. */ if (emitterPost !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(emitterPost.emitterUserProfileId) !== undefined) { + if (thisObject.profile.following.get(emitterPost.emitterUserProfileId) !== undefined) { addToResponse(event) return } } if (emitterPost !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(emitterPost.targetUserProfileId) !== undefined) { + if (thisObject.profile.following.get(emitterPost.targetUserProfileId) !== undefined) { addToResponse(event) return } } if (targetPost !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(targetPost.emitterUserProfileId) !== undefined) { + if (thisObject.profile.following.get(targetPost.emitterUserProfileId) !== undefined) { addToResponse(event) return } } if (targetPost !== undefined) { - if (thisObject.profile.multiMediaPostsFollowing.get(targetPost.targetUserProfileId) !== undefined) { + if (thisObject.profile.following.get(targetPost.targetUserProfileId) !== undefined) { addToResponse(event) return } diff --git a/Network/Queries/ProfileStats.js b/Network/Queries/ProfileStats.js index 350ed48f4..56de88255 100644 --- a/Network/Queries/ProfileStats.js +++ b/Network/Queries/ProfileStats.js @@ -36,10 +36,8 @@ exports.newProfileStats = function newProfileStats() { "userProfileHandle": thisObject.profile.userProfileHandle, "blockchainAccount": thisObject.profile.blockchainAccount, "ranking": thisObject.profile.ranking, - "multiMediaPostFollowingCount": thisObject.profile.multiMediaPostFollowingCount, - "multiMediaPostFollowersCount": thisObject.profile.multiMediaPostFollowersCount, - "tradePostsFollowingCount": thisObject.profile.tradePostsFollowingCount, - "tradePostsFollowersCount": thisObject.profile.tradePostsFollowersCount, + "followingCount": thisObject.profile.followingCount, + "followersCount": thisObject.profile.followersCount, "emitterEventsCount": thisObject.profile.emitterEventsCount, "targetEventsCount": thisObject.profile.targetEventsCount, "postsCount": thisObject.profile.postsCount, diff --git a/Network/bot.js b/Network/bot.js deleted file mode 100644 index b6ad63f2b..000000000 --- a/Network/bot.js +++ /dev/null @@ -1,28 +0,0 @@ -exports.newBot = function newBot() { - - let thisObject = { - botId: undefined, - botAsset: undefined, - botExchange: undefined, - enabled: undefined, - initialize: initialize, - finalize: finalize - } - - return thisObject - - function finalize() { - - } - - function initialize( - botId, - botAsset, - botExchange - ) { - thisObject.botId = botId - thisObject.botAsset = botAsset - thisObject.botExchange = botExchange - thisObject.enabled = true - } -} \ No newline at end of file diff --git a/Network/botProfile.js b/Network/botProfile.js new file mode 100644 index 000000000..643571170 --- /dev/null +++ b/Network/botProfile.js @@ -0,0 +1,131 @@ +exports.newUserProfile = function newUserProfile() { + + let thisObject = { + botProfileId: undefined, + botProfileHandle: undefined, + botAsset: undefined, + botExchange: undefined, + enabled: undefined, + following: undefined, + followers: undefined, + followingCount: undefined, + followersCount: undefined, + emitterEventsCount: undefined, + targetEventsCount: undefined, + postsCount: undefined, + posts: undefined, + addPost: addPost, + removePost: removePost, + addFollowing: addFollowing, + removeFollowing: removeFollowing, + addFollower: addFollower, + removeFollower: removeFollower, + initialize: initialize, + finalize: finalize + } + + return thisObject + + function finalize() { + thisObject.following = undefined + thisObject.followers = undefined + + thisObject.posts = undefined + } + + function initialize() { + + thisObject.following = new Map() + thisObject.followers = new Map() + + thisObject.followingCount = 0 + thisObject.followersCount = 0 + + thisObject.emitterEventsCount = 0 + thisObject.targetEventsCount = 0 + thisObject.postsCount = 0 + + thisObject.posts = [] + } + + function addPost( + emitterPostHash, + targetPostHash, + postType, + botProfile, + timestamp + ) { + if (NT.memory.maps.POSTS.get(emitterPostHash) !== undefined) { + throw ('Post Already Exists.') + } + + let post = NT.modules.POST.newPost() + post.initialize( + emitterPostHash, + targetPostHash, + postType, + botProfile, + timestamp + ) + + thisObject.maps.POSTS.push(post) + NT.memory.maps.POSTS.set(emitterPostHash, post) + thisObject.postsCount++ + } + + function removePost( + emitterPostHash + ) { + if (NT.memory.maps.POSTS.get(emitterPostHash) === undefined) { + throw ('Post Does Not Exist.') + } + + let post = thisObject.posts.get(emitterPostHash) + post.finalize() + + for (let i = thisObject.posts.length - 1; i >= 0; i--) { + if (thisObject.posts[i].emitterPostHash === emitterPostHash) { + thisObject.posts.splice(i, 1) + break + } + } + NT.memory.maps.POSTS.delete(emitterPostHash) + thisObject.postsCount-- + } + + function addFollowing( + botProfile + ) { + if (thisObject.following.get(botProfile.id) === undefined) { + thisObject.following.set(botProfile.id, botProfile) + thisObject.followingCount++ + } + } + + function removeFollowing( + botProfile + ) { + if (thisObject.following.get(botProfile.id) !== undefined) { + thisObject.following.delete(botProfile.id) + thisObject.followingCount-- + } + } + + function addFollower( + botProfile + ) { + if (thisObject.followers.get(botProfile.id) === undefined) { + thisObject.followers.set(botProfile.id, botProfile) + thisObject.followersCount++ + } + } + + function removeFollower( + botProfile + ) { + if (thisObject.followers.get(botProfile.id) !== undefined) { + thisObject.followers.delete(botProfile.id) + thisObject.followersCount-- + } + } +} diff --git a/Network/event.js b/Network/event.js index e69fd9ead..7cddc9c22 100644 --- a/Network/event.js +++ b/Network/event.js @@ -4,6 +4,8 @@ exports.newEvent = function newEvent() { eventId: undefined, emitterUserProfileId: undefined, targetUserProfileId: undefined, + emitterBotProfileId: undefined, + targetBotProfileId: undefined, emitterPostHash: undefined, targetPostHash: undefined, timestamp: undefined, @@ -16,19 +18,19 @@ exports.newEvent = function newEvent() { const EVENT_TYPES = { - NEW_MULTI_MEDIA_POST: 10, - REPLY_TO_MULTI_MEDIA_POST: 11, - REPOST_MULTI_MEDIA: 12, - QUOTE_REPOST_MULTI_MEDIA: 13, - FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: 14, - UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: 15, + NEW_USER_POST: 10, + REPLY_TO_USER_POST: 11, + REPOST_USER_POST: 12, + QUOTE_REPOST_USER_POST: 13, + FOLLOW_USER_PROFILE: 14, + UNFOLLOW_USER_PROFILE: 15, - NEW_TRADE_POST: 20, - REPLY_TO_TRADE_POST: 21, - RE_POST_TRADE: 22, - QUOTE_REPOST_TRADE: 23, - FOLLOW_USER_PROFILE_TRADE_POSTS: 24, - UNFOLLOW_USER_PROFILE_TRADE_POSTS: 25, + NEW_BOT_POST: 20, + REPLY_TO_BOT_POST: 21, + REPOST_BOT_POST: 22, + QUOTE_REPOST_BOT_POST: 23, + FOLLOW_BOT_PROFILE: 24, + UNFOLLOW_BOT_PROFILE: 25, ADD_BOT: 50, REMOVE_BOT: 51, @@ -66,6 +68,8 @@ exports.newEvent = function newEvent() { thisObject.eventId = eventReceived.eventId thisObject.emitterUserProfileId = eventReceived.emitterUserProfileId thisObject.targetUserProfileId = eventReceived.targetUserProfileId + thisObject.emitterBotProfileId = eventReceived.emitterBotProfileId + thisObject.targetBotProfileId = eventReceived.targetBotProfileId thisObject.emitterPostHash = eventReceived.emitterPostHash thisObject.targetPostHash = eventReceived.targetPostHash thisObject.timestamp = eventReceived.timestamp @@ -87,8 +91,8 @@ exports.newEvent = function newEvent() { if (targetUserProfile === undefined) { /* We thow an exception when it does not have a target user profile and is required*/ if ( - thisObject.eventType !== EVENT_TYPES.NEW_MULTI_MEDIA_POST && - thisObject.eventType !== EVENT_TYPES.NEW_TRADE_POST + thisObject.eventType !== EVENT_TYPES.NEW_USER_POST && + thisObject.eventType !== EVENT_TYPES.NEW_BOT_POST ) { throw ('Target User Profile Not Found.') } @@ -99,27 +103,29 @@ exports.newEvent = function newEvent() { Is is a new post? */ if ( - thisObject.eventType === EVENT_TYPES.NEW_MULTI_MEDIA_POST || - thisObject.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || - thisObject.eventType === EVENT_TYPES.REPOST_MULTI_MEDIA || - thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_MULTI_MEDIA || - thisObject.eventType === EVENT_TYPES.NEW_TRADE_POST || - thisObject.eventType === EVENT_TYPES.REPLY_TO_TRADE_POST || - thisObject.eventType === EVENT_TYPES.RE_POST_TRADE || - thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_TRADE + thisObject.eventType === EVENT_TYPES.NEW_USER_POST || + thisObject.eventType === EVENT_TYPES.REPLY_TO_USER_POST || + thisObject.eventType === EVENT_TYPES.REPOST_USER_POST || + thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_USER_POST || + thisObject.eventType === EVENT_TYPES.NEW_BOT_POST || + thisObject.eventType === EVENT_TYPES.REPLY_TO_BOT_POST || + thisObject.eventType === EVENT_TYPES.REPOST_BOT_POST || + thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_BOT_POST ) { if ( - thisObject.eventType === EVENT_TYPES.NEW_MULTI_MEDIA_POST || - thisObject.eventType === EVENT_TYPES.REPLY_TO_MULTI_MEDIA_POST || - thisObject.eventType === EVENT_TYPES.REPOST_MULTI_MEDIA || - thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_MULTI_MEDIA + thisObject.eventType === EVENT_TYPES.NEW_USER_POST || + thisObject.eventType === EVENT_TYPES.REPLY_TO_USER_POST || + thisObject.eventType === EVENT_TYPES.REPOST_USER_POST || + thisObject.eventType === EVENT_TYPES.QUOTE_REPOST_USER_POST ) { emitterUserProfile.addPost( thisObject.emitterUserProfileId, thisObject.targetUserProfileId, + thisObject.emitterBotProfileId, + thisObject.targetBotProfileId, thisObject.emitterPostHash, thisObject.targetPostHash, - thisObject.eventType, + thisObject.eventType - 10, thisObject.timestamp ) } @@ -130,31 +136,31 @@ exports.newEvent = function newEvent() { Is is a following? */ if ( - thisObject.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS || - thisObject.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS || - thisObject.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE_TRADE_POSTS || - thisObject.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE_TRADE_POSTS + thisObject.eventType === EVENT_TYPES.FOLLOW_USER_PROFILE || + thisObject.eventType === EVENT_TYPES.UNFOLLOW_USER_PROFILE || + thisObject.eventType === EVENT_TYPES.FOLLOW_BOT_PROFILE || + thisObject.eventType === EVENT_TYPES.UNFOLLOW_BOT_PROFILE ) { switch (thisObject.eventType) { - case EVENT_TYPES.FOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: { - emitterUserProfile.addMultiMediaPostsFollowing( + case EVENT_TYPES.FOLLOW_USER_PROFILE: { + emitterUserProfile.addFollowing( targetUserProfile ) - targetUserProfile.addMultiMediaPostsFollower( + targetUserProfile.addFollower( emitterUserProfile ) break } - case EVENT_TYPES.UNFOLLOW_USER_PROFILE_MULTI_MEDIA_POSTS: { - emitterUserProfile.removeMultiMediaPostsFollowing( + case EVENT_TYPES.UNFOLLOW_USER_PROFILE: { + emitterUserProfile.removeFollowing( targetUserProfile ) - targetUserProfile.removeMultiMediaPostsFollower( + targetUserProfile.removeFollower( emitterUserProfile ) break } - case EVENT_TYPES.FOLLOW_USER_PROFILE_TRADE_POSTS: { + case EVENT_TYPES.FOLLOW_BOT_PROFILE: { emitterUserProfile.addTradePostsFollowing( targetUserProfile ) @@ -163,7 +169,7 @@ exports.newEvent = function newEvent() { ) break } - case EVENT_TYPES.UNFOLLOW_USER_PROFILE_TRADE_POSTS: { + case EVENT_TYPES.UNFOLLOW_BOT_PROFILE: { emitterUserProfile.removeTradePostsFollowing( targetUserProfile ) diff --git a/Network/post.js b/Network/post.js index f3e3bd873..9b35c95cb 100644 --- a/Network/post.js +++ b/Network/post.js @@ -3,6 +3,8 @@ exports.newPost = function newPost() { let thisObject = { emitterUserProfileId: undefined, targetUserProfileId: undefined, + emitterBotProfileId: undefined, + targetBotProfileId: undefined, emitterPostHash: undefined, targetPostHash: undefined, postType: undefined, @@ -17,14 +19,10 @@ exports.newPost = function newPost() { } const POST_TYPES = { - NEW_MULTI_MEDIA_POST: 10, - REPLY_TO_MULTI_MEDIA_POST: 11, - REPOST_MULTI_MEDIA: 12, - QUOTE_REPOST_MULTI_MEDIA: 13, - NEW_TRADE_POST: 20, - REPLY_TO_TRADE_POST: 21, - RE_POST_TRADE: 22, - QUOTE_REPOST_TRADE: 23 + NEW_POST: 0, + REPLY_TO_POST: 1, + REPOST_: 2, + QUOTE_REPOST_: 3 } const REACTION_TYPES = { @@ -53,6 +51,8 @@ exports.newPost = function newPost() { function finalize() { thisObject.emitterUserProfileId = undefined thisObject.targetUserProfileId = undefined + thisObject.emitterBotProfileId = undefined + thisObject.targetBotProfileId = undefined thisObject.emitterPostHash = undefined thisObject.targetPostHash = undefined thisObject.postType = undefined @@ -63,6 +63,8 @@ exports.newPost = function newPost() { function initialize( emitterUserProfileId, targetUserProfileId, + emitterBotProfileId, + targetBotProfileId, emitterPostHash, targetPostHash, postType, @@ -71,6 +73,8 @@ exports.newPost = function newPost() { thisObject.emitterUserProfileId = emitterUserProfileId thisObject.targetUserProfileId = targetUserProfileId + thisObject.emitterBotProfileId = emitterBotProfileId + thisObject.targetBotProfileId = targetBotProfileId thisObject.emitterPostHash = emitterPostHash thisObject.targetPostHash = targetPostHash thisObject.postType = postType @@ -83,12 +87,9 @@ exports.newPost = function newPost() { let targetPost if ( - 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.postType === POST_TYPES.REPLY_TO_POST || + thisObject.postType === POST_TYPES.REPOST_ || + thisObject.postType === POST_TYPES.QUOTE_REPOST_ ) { targetPost = NT.memory.maps.POSTS.get(thisObject.targetPostHash) @@ -100,8 +101,7 @@ exports.newPost = function newPost() { Let's add this post to the replies of the Target Post */ if ( - event.eventType === POST_TYPES.REPLY_TO_MULTI_MEDIA_POST || - event.eventType === POST_TYPES.REPLY_TO_TRADE_POST + thisObject.postType === POST_TYPES.REPLY_TO_POST ) { targetPost.replies.push(thisObject) } diff --git a/Network/userProfile.js b/Network/userProfile.js index 500b713bb..a7d308cf6 100644 --- a/Network/userProfile.js +++ b/Network/userProfile.js @@ -4,15 +4,11 @@ exports.newUserProfile = function newUserProfile() { userProfieId: undefined, userProfileHandle: undefined, blockchainAccount: undefined, - multiMediaPostsFollowing: undefined, - multiMediaPostsFollowers: undefined, - tradePostsFollowing: undefined, - tradePostsFollowers: undefined, ranking: undefined, - multiMediaPostFollowingCount: undefined, - multiMediaPostFollowersCount: undefined, - tradePostsFollowingCount: undefined, - tradePostsFollowersCount: undefined, + following: undefined, + followers: undefined, + followingCount: undefined, + followersCount: undefined, emitterEventsCount: undefined, targetEventsCount: undefined, postsCount: undefined, @@ -21,14 +17,10 @@ exports.newUserProfile = function newUserProfile() { posts: undefined, addPost: addPost, removePost: removePost, - addMultiMediaPostsFollowing: addMultiMediaPostsFollowing, - removeMultiMediaPostsFollowing: removeMultiMediaPostsFollowing, - addTradePostsFollowing: addTradePostsFollowing, - removeTradePostsFollowing: removeTradePostsFollowing, - addMultiMediaPostsFollower: addMultiMediaPostsFollower, - removeMultiMediaPostsFollower: removeMultiMediaPostsFollower, - addTradePostsFollower: addTradePostsFollower, - removeTradePostsFollower: removeTradePostsFollower, + addFollowing: addFollowing, + removeFollowing: removeFollowing, + addFollower: addFollower, + removeFollower: removeFollower, addBot: addBot, removeBot: removeBot, enableBot: enableBot, @@ -40,11 +32,8 @@ exports.newUserProfile = function newUserProfile() { return thisObject function finalize() { - thisObject.multiMediaPostsFollowing = undefined - thisObject.multiMediaPostsFollowers = undefined - - thisObject.tradePostsFollowing = undefined - thisObject.tradePostsFollowers = undefined + thisObject.following = undefined + thisObject.followers = undefined thisObject.posts = undefined thisObject.bots = undefined @@ -52,26 +41,24 @@ exports.newUserProfile = function newUserProfile() { function initialize() { - thisObject.multiMediaPostsFollowing = new Map() - thisObject.multiMediaPostsFollowers = new Map() + thisObject.following = new Map() + thisObject.followers = new Map() - thisObject.tradePostsFollowing = new Map() - thisObject.tradePostsFollowers = new Map() + thisObject.followingCount = 0 + thisObject.followersCount = 0 - thisObject.multiMediaPostFollowingCount = 0 - thisObject.multiMediaPostFollowersCount = 0 - thisObject.tradePostsFollowingCount = 0 - thisObject.tradePostsFollowersCount = 0 thisObject.emitterEventsCount = 0 thisObject.targetEventsCount = 0 thisObject.postsCount = 0 thisObject.botsCount = 0 thisObject.posts = [] - thisObject.bots = undefined + thisObject.bots = [] } function addPost( + emitterUserProfileId, + targetUserProfileId, emitterPostHash, targetPostHash, postType, @@ -84,6 +71,10 @@ exports.newUserProfile = function newUserProfile() { let post = NT.modules.POST.newPost() post.initialize( + emitterUserProfileId, + targetUserProfileId, + undefined, + undefined, emitterPostHash, targetPostHash, postType, @@ -116,75 +107,39 @@ exports.newUserProfile = function newUserProfile() { thisObject.postsCount-- } - function addMultiMediaPostsFollowing( + function addFollowing( userProfile ) { - if (thisObject.multiMediaPostsFollowing.get(userProfile.id) === undefined) { - thisObject.multiMediaPostsFollowing.set(userProfile.id, userProfile) - thisObject.multiMediaPostFollowingCount++ + if (thisObject.following.get(userProfile.id) === undefined) { + thisObject.following.set(userProfile.id, userProfile) + thisObject.followingCount++ } } - function removeMultiMediaPostsFollowing( + function removeFollowing( userProfile ) { - if (thisObject.multiMediaPostsFollowing.get(userProfile.id) !== undefined) { - thisObject.multiMediaPostsFollowing.delete(userProfile.id) - thisObject.multiMediaPostFollowingCount-- + if (thisObject.following.get(userProfile.id) !== undefined) { + thisObject.following.delete(userProfile.id) + thisObject.followingCount-- } } - function addTradePostsFollowing( + function addFollower( userProfile ) { - if (thisObject.tradePostsFollowingCount.get(userProfile.id) === undefined) { - thisObject.tradePostsFollowingCount.set(userProfile.id, userProfile) - thisObject.tradePostsFollowingCount++ + if (thisObject.followers.get(userProfile.id) === undefined) { + thisObject.followers.set(userProfile.id, userProfile) + thisObject.followersCount++ } } - function removeTradePostsFollowing( + function removeFollower( 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-- + if (thisObject.followers.get(userProfile.id) !== undefined) { + thisObject.followers.delete(userProfile.id) + thisObject.followersCount-- } }