User Profile re-written
This commit is contained in:
1 parent
b7fdc7feb7
commit
1cd04a056b
10 files changed
+308
-118
No files matched your search
@@ -36,6 +36,15 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
if (thisObject.profile === undefined) {
|
||||
throw ('Target User Profile Not Found.')
|
||||
}
|
||||
/*
|
||||
Validate Bot Profile
|
||||
*/
|
||||
if (queryReceived.targetBotProfileId !== undefined) {
|
||||
thisObject.profile = thisObject.profile.bots.get(queryReceived.targetBotProfileId)
|
||||
if (thisObject.profile === undefined) {
|
||||
throw ('Target Bot Profile Not Found.')
|
||||
}
|
||||
}
|
||||
/*
|
||||
Validate Initial Index
|
||||
*/
|
||||
@@ -94,17 +103,17 @@ exports.newProfilePosts = function newProfilePosts() {
|
||||
switch (thisObject.direction) {
|
||||
case DIRECTION_FUTURE: {
|
||||
for (let i = thisObject.initialIndex; i < thisObject.initialIndex + thisObject.amountRequested; i++) {
|
||||
let post = thisObject.profile.posts[i]
|
||||
if (post === undefined) { break }
|
||||
addToResponse(post)
|
||||
let arrayItem = thisObject.profile.arrays.posts[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
addToResponse(arrayItem)
|
||||
}
|
||||
break
|
||||
}
|
||||
case DIRECTION_PAST: {
|
||||
for (let i = thisObject.initialIndex; i > thisObject.initialIndex - thisObject.amountRequested; i--) {
|
||||
let post = thisObject.profile.posts[i]
|
||||
if (post === undefined) { break }
|
||||
addToResponse(post)
|
||||
let arrayItem = thisObject.profile.arrays.posts[i]
|
||||
if (arrayItem === undefined) { break }
|
||||
addToResponse(arrayItem)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user