Last active
December 2, 2019 20:46
-
-
Save jbis9051/e73930131f25d9043c4c12daf751a56c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function switchThread(convo) { | |
selectedConvo = convo; | |
document.querySelectorAll('.thread').forEach(el => { | |
if (el === convo.selector) { | |
el.setAttribute("selected", "") | |
} else { | |
el.removeAttribute("selected") | |
} | |
}); | |
convo.conversation.getMessages(); | |
convo.getTargetedMessages(); | |
updateMessagesView(); | |
scrollMessageNodeToMiddle(messagesView.querySelector('.target')); | |
contact_name.innerText = convo.conversation.getDisplayName(); | |
} | |
// Conversation.js | |
getMessages(limit, offset) { | |
if (typeof limit !== "undefined") { | |
this.limit = limit; | |
this.offset = offset; | |
} | |
this.messages = | |
db.execute(` | |
SELECT * | |
FROM chat_message_join | |
INNER JOIN message ON chat_message_join.message_id = message.ROWID | |
WHERE chat_message_join.chat_id = ${this.chat.ROWID} | |
ORDER BY message.date DESC | |
LIMIT ${this.limit} OFFSET ${this.offset} | |
`) | |
.map(msg => new Message(msg)).filter(msg => msg.text().length > 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment