* messages.recent_messages now uses the /message/recent

This should be more clear in its intentions and basically gives the behavior
you expect when looking at this method
This commit is contained in:
shockrah 2021-04-27 13:40:12 -07:00
parent e0d5b8b5f7
commit 32eb669f96

View File

@ -109,16 +109,28 @@ function push_message(message) {
* @param {u64} auth.id user | id required by most/all endpoints
*
* @param {String} server.url | HTTP URL
* @param {String} server.wsurl | Websocket URL
*
* @param {String} channel.description | Description of channel
* @params {u64} channel.id | channel id to query
* @params {u64} channel_id | channel id to query
* @returns void
*/
exports.recent_messages = async function (auth, server, channel, start_time, end_time, limit) {
exports.recent_messages = async function recent_messages(auth, server, channel_id, limit) {
$('#messages-list').html('')
const messages = await get_range(auth, server, channel['id'], start_time, end_time, limit)
try {
const response = await got(server.url + '/message/recent',{
searchParams: {
jwt: auth.jwt,
channel_id: channel_id,
limit: 80
},
responseType: 'json'
})
const messages = response.body['messages']
for(const message of messages) {
}
} catch (err) {
}
const messages = await get_range(auth, server, channel['id'], limit)
for(const message of messages) {
console.log(message)