Commit 7e44e13afc44b6b906290606afe84a7c45b33eff
append own root posts directly to rollup without refresh
Matt McKegg committed on 6/25/2018, 1:49:11 AMParent: aae000974cbf50d2a0e3bcee4440ca9e6e5f7b26
Files changed
modules/feed/html/rollup.js | changed |
modules/feed/html/rollup.js | ||
---|---|---|
@@ -118,22 +118,29 @@ | ||
118 | 118 | newSinceRefresh.add(msg.key) |
119 | 119 | unreadIds.add(msg.key) |
120 | 120 | } |
121 | 121 | |
122 | - if (updates() === 0 && msg.value.author === yourId && container.scrollTop < 500) { | |
123 | - refresh() | |
124 | - } else if (msg.value.author === yourId && content()) { | |
122 | + if (msg.value.author === yourId && content()) { | |
125 | 123 | // dynamically insert this post into the feed! (manually so that it doesn't get slow with mutant) |
126 | - var existingContainer = content().querySelector(`[data-root-id="${msg.value.content.root}"]`) | |
127 | - if (existingContainer) { | |
128 | - var replies = existingContainer.querySelector('div.replies') | |
129 | - var lastReply = existingContainer.querySelector('div.replies > .Message:last-child') | |
130 | - var previousId = lastReply ? lastReply.getAttribute('data-id') : existingContainer.getAttribute('data-root-id') | |
131 | - replies.appendChild(api.message.html.render(msg, { | |
132 | - previousId, | |
133 | - compact: false, | |
134 | - priority: 2 | |
135 | - })) | |
124 | + if (api.message.sync.root(msg)) { | |
125 | + var existingContainer = content().querySelector(`[data-root-id="${api.message.sync.root(msg)}"]`) | |
126 | + if (existingContainer) { | |
127 | + var replies = existingContainer.querySelector('div.replies') | |
128 | + var lastReply = existingContainer.querySelector('div.replies > .Message:last-child') | |
129 | + var previousId = lastReply ? lastReply.getAttribute('data-id') : existingContainer.getAttribute('data-root-id') | |
130 | + replies.appendChild(api.message.html.render(msg, { | |
131 | + previousId, | |
132 | + compact: false, | |
133 | + priority: 2 | |
134 | + })) | |
135 | + } | |
136 | + } else { | |
137 | + highlightItems.add(msg.key) | |
138 | + content().prepend( | |
139 | + renderItem(extend(msg, { | |
140 | + replies: [] | |
141 | + })) | |
142 | + ) | |
136 | 143 | } |
137 | 144 | } |
138 | 145 | |
139 | 146 | updates.set(newSinceRefresh.size) |
Built with git-ssb-web