[Issue]: # 26. timelines/home on append uses the link header for min/max id

This commit is contained in:
Mark Washeim 2023-01-18 09:20:27 +01:00
parent 16ec0cc090
commit 7dfae96394
3 changed files with 22 additions and 20 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.2, 2023-01-11T16:00:45. -->
<!-- Written by QtCreator 4.15.2, 2023-01-18T08:56:46. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View file

@ -8,27 +8,24 @@ var max_id ;
var since_id;
WorkerScript.onMessage = function(msg) {
/*
console.log("Action > " + msg.action)
console.log("Model > " + msg.model)
console.log("Mode > " + msg.mode)
console.log("Conf > " + JSON.stringify(msg.conf))
console.log("Params > " + JSON.stringify(msg.params))
*/
if (debug) console.log("Action > " + msg.action)
if (debug) console.log("Mode > " + msg.mode)
// this is not elegant. it's max_id and ids from MyList
if (msg.params[1]) {
// we should always get max_id on append
if (msg.mode === "append") {
if ( msg.params[0]["name"] === "max_id" ) {
max_id = msg.params[0]["data"]
} else {
}
} else if ( msg.mode === "prepend" && msg.params[0]) {
// prepend could be min_id or since_id
since_id = msg.params[0]["data"]
}
// we don't want to pass it onto the backend
if ( msg.params[1]["name"] === "ids" ) {
knownIds = msg.params[1]["data"]
msg.params.pop()
}
// ids are always the last param
if (msg.params[2]) {
if ( msg.params[2]["name"] === "ids" ) {
knownIds = msg.params[2]["data"]
msg.params.pop()
@ -65,7 +62,7 @@ WorkerScript.onMessage = function(msg) {
* this falls through and continues for GET
*/
if (msg.action === "bookmarks"){
if (msg.action === "bookmarks" || ( msg.action === "timelines/home" && msg.mode === "append") ){
API.getLink(msg.action, msg.params, function(data) {
if (debug) console.log(JSON.stringify(data))
WorkerScript.sendMessage({ 'LinkHeader': data })

View file

@ -7,7 +7,7 @@ import "."
SilicaListView {
id: myList
property bool debug: false
property bool debug: true
property string type
property string title
property string description
@ -350,11 +350,16 @@ SilicaListView {
}
}
//if (debug) console.log(JSON.stringify(uniqueIds))
// to keep the number of params the same for all requests
// always set local
if(title === "Local") {
type = "timelines/public"
p.push({name:'local', data: "true"})
} else {
p.push({name:'local', data: "false"})
}
// we push the ids via params which we remove in the WorkerScript
if (model.count) {
p.push({name:'ids', data: uniqueIds})