Merge pull request #103 from poetaster/master
Fixes for home not updating & search.
This commit is contained in:
commit
49ded1a775
5 changed files with 33 additions and 45 deletions
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!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>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Qt.include("Mastodon.js")
|
Qt.include("Mastodon.js")
|
||||||
|
|
||||||
var debug = true;
|
var debug = false;
|
||||||
var loadImages = true;
|
var loadImages = true;
|
||||||
// used to dedupe on append/insert
|
// used to dedupe on append/insert
|
||||||
var knownIds = [];
|
var knownIds = [];
|
||||||
|
@ -8,27 +8,24 @@ var max_id ;
|
||||||
var since_id;
|
var since_id;
|
||||||
|
|
||||||
WorkerScript.onMessage = function(msg) {
|
WorkerScript.onMessage = function(msg) {
|
||||||
/*
|
|
||||||
console.log("Action > " + msg.action)
|
if (debug) console.log("Action > " + msg.action)
|
||||||
console.log("Model > " + msg.model)
|
if (debug) console.log("Mode > " + msg.mode)
|
||||||
console.log("Mode > " + msg.mode)
|
|
||||||
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
|
// this is not elegant. it's max_id and ids from MyList
|
||||||
|
// we should always get max_id on append
|
||||||
if (msg.params[1]) {
|
if (msg.mode === "append") {
|
||||||
if ( msg.params[0]["name"] === "max_id" ) {
|
if ( msg.params[0]["name"] === "max_id" ) {
|
||||||
max_id = msg.params[0]["data"]
|
max_id = msg.params[0]["data"]
|
||||||
} else {
|
|
||||||
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()
|
|
||||||
}
|
}
|
||||||
|
} else if ( msg.mode === "prepend" && msg.params[0]) {
|
||||||
|
|
||||||
|
// prepend could be min_id or since_id
|
||||||
|
since_id = msg.params[0]["data"]
|
||||||
|
|
||||||
|
}
|
||||||
|
// ids are always the last param
|
||||||
|
if (msg.params[2]) {
|
||||||
if ( msg.params[2]["name"] === "ids" ) {
|
if ( msg.params[2]["name"] === "ids" ) {
|
||||||
knownIds = msg.params[2]["data"]
|
knownIds = msg.params[2]["data"]
|
||||||
msg.params.pop()
|
msg.params.pop()
|
||||||
|
@ -65,7 +62,9 @@ WorkerScript.onMessage = function(msg) {
|
||||||
* this falls through and continues for GET
|
* this falls through and continues for GET
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (msg.action === "bookmarks"){
|
if (msg.action === "bookmarks" ||
|
||||||
|
( msg.action === "timelines/home" && msg.mode === "append") ||
|
||||||
|
( msg.action.indexOf("timelines/tag/") !== -1 ) ){
|
||||||
API.getLink(msg.action, msg.params, function(data) {
|
API.getLink(msg.action, msg.params, function(data) {
|
||||||
if (debug) console.log(JSON.stringify(data))
|
if (debug) console.log(JSON.stringify(data))
|
||||||
WorkerScript.sendMessage({ 'LinkHeader': data })
|
WorkerScript.sendMessage({ 'LinkHeader': data })
|
||||||
|
|
|
@ -158,19 +158,11 @@ Page {
|
||||||
delegate: VisualContainer
|
delegate: VisualContainer
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
view.type = "timelines/tag/"+tlSearch.search.substring(1)
|
view.type = "timelines/tag/"+tlSearch.search.substring(1)
|
||||||
var ids = []
|
|
||||||
view.params = []
|
|
||||||
view.params.push({name: 'limit', data: "20" });
|
|
||||||
/* we push the ids via params which we remove in the WorkerScript
|
|
||||||
* see: MyList:loadData() and should move */
|
|
||||||
if (mdl.count) {
|
if (mdl.count) {
|
||||||
for(var i = 0 ; i < mdl.count ; i++) {
|
view.loadData("append")
|
||||||
ids.push(mdl.get(i).id)
|
} else {
|
||||||
//if (debug) console.log(model.get(i).id)
|
view.loadData("prepend")
|
||||||
}
|
|
||||||
view.params.push({name: 'ids', data: ids });
|
|
||||||
}
|
}
|
||||||
view.loadData("append")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,20 +233,12 @@ Page {
|
||||||
|
|
||||||
delegate: VisualContainer
|
delegate: VisualContainer
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
var ids = []
|
|
||||||
view3.params = []
|
|
||||||
view3.params.push({name: 'limit', data: "20" });
|
|
||||||
/* we push the ids via params which we remove in the WorkerScript
|
|
||||||
* see: MyList:loadData() and should move */
|
|
||||||
if (mdl.count) {
|
|
||||||
for(var i = 0 ; i < mdl.count ; i++) {
|
|
||||||
ids.push(mdl.get(i).id)
|
|
||||||
//if (debug) console.log(model.get(i).id)
|
|
||||||
}
|
|
||||||
view3.params.push({name: 'ids', data: ids });
|
|
||||||
}
|
|
||||||
view3.type = "timelines/tag/"+tlSearch.search
|
view3.type = "timelines/tag/"+tlSearch.search
|
||||||
view3.loadData("prepend")
|
if (mdl.count) {
|
||||||
|
view3.loadData("append")
|
||||||
|
} else {
|
||||||
|
view3.loadData("prepend")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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") {
|
if(title === "Local") {
|
||||||
type = "timelines/public"
|
type = "timelines/public"
|
||||||
p.push({name:'local', data: "true"})
|
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
|
// we push the ids via params which we remove in the WorkerScript
|
||||||
if (model.count) {
|
if (model.count) {
|
||||||
p.push({name:'ids', data: uniqueIds})
|
p.push({name:'ids', data: uniqueIds})
|
||||||
|
|
|
@ -13,7 +13,7 @@ Name: harbour-tooterb
|
||||||
%{!?qtc_make:%define qtc_make make}
|
%{!?qtc_make:%define qtc_make make}
|
||||||
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
%{?qtc_builddir:%define _builddir %qtc_builddir}
|
||||||
Summary: Tooter β
|
Summary: Tooter β
|
||||||
Version: 1.1.3
|
Version: 1.1.4
|
||||||
Release: 1
|
Release: 1
|
||||||
Group: Qt/Qt
|
Group: Qt/Qt
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
|
|
Loading…
Reference in a new issue