@@ -105,7 +105,7 @@ export function insertMessageIntoTable (channelObject, messageTable, message, fr
105105export async function infiniteMessageArea ( dom , wasStore , chatChannel , options ) {
106106 // ///////////////////////////////////////////////////////////////////////
107107
108- function syncMessages ( about , messageTable ) {
108+ function syncMessages ( chatChannel , messageTable ) {
109109 const displayed = { }
110110 let ele , ele2
111111 for ( ele = messageTable . firstChild ; ele ; ele = ele . nextSibling ) {
@@ -116,7 +116,7 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
116116
117117 const messages = store
118118 . statementsMatching (
119- about ,
119+ chatChannel ,
120120 ns . wf ( 'message' ) ,
121121 null ,
122122 messageTable . chatDocument
@@ -155,6 +155,21 @@ export async function infiniteMessageArea (dom, wasStore, chatChannel, options)
155155 if ( isDeleted ( latest ) && ! options . showDeletedMessages ) {
156156 return // ignore deleted messaged -- @@ could also leave a placeholder
157157 }
158+ if ( options . thread ) { // only show things in thread
159+ const thread = store . any ( message , ns . sioc ( 'has_container' ) , null , message . doc ( ) )
160+ if ( message . sameTerm ( options . thread ) ) {
161+ // console.log(' displaying root of thread ' + thread)
162+ } else if ( thread . sameTerm ( options . thread ) ) {
163+ // console.log(' displaying body of thread ' + thread)
164+ } else {
165+ return // suppress message not in thread
166+ }
167+ }
168+
169+ // const replyTo = store.any(message, ns.sioc('reply_of'), null, message.doc())
170+ // @@ best thing to do with a reply? Move to after the thing replied to and shift right?
171+ // Sort by originalMessageDate, reply number?
172+
158173 insertMessageIntoTable ( channelObject ,
159174 messageTable ,
160175 message ,
0 commit comments