ThreadUpdater.thread -> thread, ThreadUpdater.thread.board -> board.
This commit is contained in:
parent
acf31945b1
commit
b629b3dca1
@ -268,15 +268,17 @@ ThreadUpdater =
|
|||||||
|
|
||||||
postObjects = req.response.posts
|
postObjects = req.response.posts
|
||||||
OP = postObjects[0]
|
OP = postObjects[0]
|
||||||
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler
|
{thread} = ThreadUpdater
|
||||||
|
{board} = thread
|
||||||
|
Build.spoilerRange[board] = OP.custom_spoiler
|
||||||
|
|
||||||
# XXX Some threads such as /g/'s sticky https://a.4cdn.org/g/thread/39894014.json still use a string as the archived property.
|
# XXX Some threads such as /g/'s sticky https://a.4cdn.org/g/thread/39894014.json still use a string as the archived property.
|
||||||
ThreadUpdater.thread.setStatus 'Archived', !!+OP.archived
|
thread.setStatus 'Archived', !!+OP.archived
|
||||||
ThreadUpdater.updateThreadStatus 'Sticky', !!OP.sticky
|
ThreadUpdater.updateThreadStatus 'Sticky', !!OP.sticky
|
||||||
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
|
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
|
||||||
ThreadUpdater.thread.postLimit = !!OP.bumplimit
|
thread.postLimit = !!OP.bumplimit
|
||||||
ThreadUpdater.thread.fileLimit = !!OP.imagelimit
|
thread.fileLimit = !!OP.imagelimit
|
||||||
ThreadUpdater.thread.ipCount = OP.unique_ips if OP.unique_ips?
|
thread.ipCount = OP.unique_ips if OP.unique_ips?
|
||||||
|
|
||||||
posts = [] # post objects
|
posts = [] # post objects
|
||||||
index = [] # existing posts
|
index = [] # existing posts
|
||||||
@ -290,22 +292,22 @@ ThreadUpdater =
|
|||||||
continue if num <= ThreadUpdater.lastPost
|
continue if num <= ThreadUpdater.lastPost
|
||||||
# Insert new posts, not older ones.
|
# Insert new posts, not older ones.
|
||||||
count++
|
count++
|
||||||
node = Build.postFromObject postObject, ThreadUpdater.thread.board.ID
|
node = Build.postFromObject postObject, board.ID
|
||||||
posts.push new Post node, ThreadUpdater.thread, ThreadUpdater.thread.board
|
posts.push new Post node, thread, board
|
||||||
# Fetching your own posts after posting
|
# Fetching your own posts after posting
|
||||||
delete ThreadUpdater.postID if ThreadUpdater.postID is num
|
delete ThreadUpdater.postID if ThreadUpdater.postID is num
|
||||||
|
|
||||||
# Check for deleted posts.
|
# Check for deleted posts.
|
||||||
deletedPosts = []
|
deletedPosts = []
|
||||||
for ID in ThreadUpdater.postIDs when ID not in index
|
for ID in ThreadUpdater.postIDs when ID not in index
|
||||||
ThreadUpdater.thread.posts[ID].kill()
|
thread.posts[ID].kill()
|
||||||
deletedPosts.push ID
|
deletedPosts.push ID
|
||||||
ThreadUpdater.postIDs = index
|
ThreadUpdater.postIDs = index
|
||||||
|
|
||||||
# Check for deleted files.
|
# Check for deleted files.
|
||||||
deletedFiles = []
|
deletedFiles = []
|
||||||
for ID in ThreadUpdater.fileIDs when not (ID in files or ID in deletedPosts)
|
for ID in ThreadUpdater.fileIDs when not (ID in files or ID in deletedPosts)
|
||||||
ThreadUpdater.thread.posts[ID].kill true
|
thread.posts[ID].kill true
|
||||||
deletedFiles.push ID
|
deletedFiles.push ID
|
||||||
ThreadUpdater.fileIDs = files
|
ThreadUpdater.fileIDs = files
|
||||||
|
|
||||||
@ -346,10 +348,10 @@ ThreadUpdater =
|
|||||||
|
|
||||||
$.event 'ThreadUpdate',
|
$.event 'ThreadUpdate',
|
||||||
404: false
|
404: false
|
||||||
threadID: ThreadUpdater.thread.fullID
|
threadID: thread.fullID
|
||||||
newPosts: (post.fullID for post in posts)
|
newPosts: (post.fullID for post in posts)
|
||||||
deletedPosts: deletedPosts
|
deletedPosts: deletedPosts
|
||||||
deletedFiles: deletedFiles
|
deletedFiles: deletedFiles
|
||||||
postCount: OP.replies + 1
|
postCount: OP.replies + 1
|
||||||
fileCount: OP.images + (!!ThreadUpdater.thread.OP.file and !ThreadUpdater.thread.OP.file.isDead)
|
fileCount: OP.images + (!!thread.OP.file and !thread.OP.file.isDead)
|
||||||
ipCount: OP.unique_ips
|
ipCount: OP.unique_ips
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user