0.3.1: la nota nasce nella cartella aperta, navigazione senza voci fantasma
- NewNoteDialog riceve la cartella corrente: il file va dove sei, non nella radice del caveau. Un nome gia' presente viene rifiutato (la PUT avrebbe sovrascritto la nota senza chiedere) e il nome non puo' contenere "/". - PropfindParser.listing(): scarta la collezione stessa (il PROPFIND Depth:1 la include, e dentro una cartella sembrava di non essere entrati) e le voci nascoste (.obsidian/, .trash/), anche nella scansione di ricerca e tag: le note nel cestino non finiscono piu' nei risultati. - MainPage: se il client e' occupato la navigazione va in coda invece di essere persa, e l'elenco precedente viene svuotato subito (non resta sotto l'intestazione nuova). - Test del filtro con la risposta reale di Libro/; verificatore aggiornato per i segnali di cambio proprieta' (onBusyChanged).
This commit is contained in:
1 parent
8259297a27
commit
82d85ab30b
9 files changed
+179
-25
No files matched your search
@@ -113,7 +113,10 @@ Item {
|
||||
request("PROPFIND", fullUrl(relPath || ""), "", function (xhr) {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
var entries = Prop.parse(xhr.responseText, appSettings.serverUrl)
|
||||
listReady(entries)
|
||||
// Senza questo filtro la cartella appena aperta compare come
|
||||
// prima voce di se stessa (Depth:1 la include) e .obsidian/
|
||||
// .trash sporcano la navigazione.
|
||||
listReady(Prop.listing(entries, relPath || ""))
|
||||
} else {
|
||||
failed(statusMessage(xhr.status))
|
||||
}
|
||||
@@ -206,7 +209,7 @@ Item {
|
||||
request("PROPFIND", fullUrl(folder), "", function (xhr) {
|
||||
if (!dav.scanning) return
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
var entries = Prop.parse(xhr.responseText, appSettings.serverUrl)
|
||||
var entries = Prop.listing(Prop.parse(xhr.responseText, appSettings.serverUrl), folder)
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i]
|
||||
if (e.isDir) {
|
||||
|
||||
@@ -73,6 +73,26 @@ function parse(xml, baseUrl) {
|
||||
return entries;
|
||||
}
|
||||
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
module.exports = { parse: parse };
|
||||
// Entries to show in a folder listing, given the folder being listed:
|
||||
// - the collection ITSELF is dropped (a Depth:1 PROPFIND returns it, and in
|
||||
// the app it looked like the folder had not been entered at all);
|
||||
// - hidden entries (".obsidian", ".trash", ".git") are dropped: they are
|
||||
// configuration, not notes, and they only add noise to the navigation.
|
||||
// Pure ES5 so the node tests cover it.
|
||||
function listing(entries, currentPath) {
|
||||
var out = [];
|
||||
if (!entries) return out;
|
||||
var self = currentPath || "";
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var e = entries[i];
|
||||
if (e.path === self) continue;
|
||||
var name = e.name || "";
|
||||
if (!name || name.charAt(0) === ".") continue;
|
||||
out.push(e);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
if (typeof module !== "undefined" && module.exports) {
|
||||
module.exports = { parse: parse, listing: listing };
|
||||
}
|
||||
Reference in new issue
Block a user