Removed the limit=12, it seems the extra paramater was causing issues
with calls to /timelines/home
This commit is contained in:
parent
3bb76d7121
commit
bd91ee5611
2 changed files with 24 additions and 40 deletions
|
@ -15,6 +15,7 @@ WorkerScript.onMessage = function(msg) {
|
|||
console.log("Conf > " + JSON.stringify(msg.conf))
|
||||
console.log("Params > " + JSON.stringify(msg.params))
|
||||
*/
|
||||
|
||||
// this is not elegant. it's max_id and ids from MyList
|
||||
if (msg.params[1]) {
|
||||
if ( msg.params[0]["name"] === "max_id" ) {
|
||||
|
@ -54,6 +55,7 @@ WorkerScript.onMessage = function(msg) {
|
|||
|
||||
/** POST statuses */
|
||||
var API = mastodonAPI({ instance: msg.conf.instance, api_user_token: msg.conf.api_user_token});
|
||||
|
||||
if (msg.method === "POST"){
|
||||
API.post(msg.action, msg.params, function(data) {
|
||||
if (msg.bgAction){
|
||||
|
@ -79,9 +81,9 @@ WorkerScript.onMessage = function(msg) {
|
|||
}
|
||||
|
||||
API.get(msg.action, msg.params, function(data) {
|
||||
var items = [];
|
||||
|
||||
//console.log(msg.ids)
|
||||
var items = [];
|
||||
//console.log(data)
|
||||
|
||||
for (var i in data) {
|
||||
var item;
|
||||
|
@ -146,9 +148,14 @@ WorkerScript.onMessage = function(msg) {
|
|||
|
||||
if(msg.model && items.length) {
|
||||
addDataToModel(msg.model, msg.mode, items)
|
||||
} else {
|
||||
// for some reason, home chokes.
|
||||
console.log( "items.length = " + items.length)
|
||||
}
|
||||
|
||||
/*if(msg.action === "notifications")
|
||||
orderNotifications(items)*/
|
||||
|
||||
console.log("Get em all?")
|
||||
WorkerScript.sendMessage({ 'updatedAll': true})
|
||||
});
|
||||
|
@ -160,25 +167,25 @@ function addDataToModel (model, mode, items) {
|
|||
|
||||
var length = items.length;
|
||||
console.log("Fetched > " +length + " in " + mode)
|
||||
console.log("ids > " + knownIds.length )
|
||||
var i
|
||||
if (mode === "append") {
|
||||
model.append(items)
|
||||
/*
|
||||
for(i = 0; i <= length-1; i++) {
|
||||
if ( knownIds.indexOf( items[i]["id"]) === -1) {
|
||||
if ( items[i]["id"] < max_id ) {
|
||||
model.append(items[i])
|
||||
} else {
|
||||
console.log("max: " + max_id + " i: " + items[i]["id"] + " known: " + knownIds[knownIds.length-1])
|
||||
console.log("nope: " + items[i]["id"] )
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//model.append(items)
|
||||
|
||||
} else if (mode === "prepend") {
|
||||
for(i = length-1; i >= 0 ; i--) {
|
||||
if ( knownIds.indexOf( items[i]["id"]) === -1) {
|
||||
model.insert(0,items[i])
|
||||
}
|
||||
/*if ( knownIds.indexOf( items[i]["id"]) === -1) {
|
||||
model.insert(0,items[i])
|
||||
}*/
|
||||
}
|
||||
}
|
||||
model.sync()
|
||||
|
|
|
@ -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
|
||||
|
@ -78,12 +78,6 @@ SilicaListView {
|
|||
pageStack.push(Qt.resolvedUrl("../SettingsPage.qml"), {})
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("Clear")
|
||||
onClicked: {
|
||||
clearLast()
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: qsTr("New Toot")
|
||||
visible: !profilePage
|
||||
|
@ -173,11 +167,10 @@ SilicaListView {
|
|||
id: worker
|
||||
source: "../../lib/Worker.js"
|
||||
onMessage: {
|
||||
//if (debug) console.log("worker says")
|
||||
//if (debug) console.log(JSON.stringify(messageObject))
|
||||
if (messageObject.error){
|
||||
if (debug) console.log(JSON.stringify(messageObject))
|
||||
} else {
|
||||
if (debug) console.log(JSON.stringify(messageObject))
|
||||
loadStarted = false
|
||||
}
|
||||
|
||||
|
@ -188,7 +181,7 @@ SilicaListView {
|
|||
// should be resolved within loadData()
|
||||
if (messageObject.updatedAll){
|
||||
if (debug) console.log("Got em all.")
|
||||
if (model.count > 20) deDouble()
|
||||
if (model.count > 12) deDouble()
|
||||
loadStarted = false
|
||||
}
|
||||
}
|
||||
|
@ -290,22 +283,6 @@ SilicaListView {
|
|||
}
|
||||
|
||||
|
||||
/* utility to clear last, debugging
|
||||
*
|
||||
*/
|
||||
|
||||
function clearLast() {
|
||||
var msg = {
|
||||
'action' : "CLEAR",
|
||||
'model' : model,
|
||||
'conf' : Logic.conf
|
||||
}
|
||||
|
||||
//if (debug) console.log(JSON.stringify(msg))
|
||||
if (model.count)
|
||||
worker.sendMessage(msg)
|
||||
}
|
||||
|
||||
/* Principle load function, uses websocket's worker.js
|
||||
*
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue