Bugfix Day 1

* Fixed attachments being displayed that were on archived or deleted notes
* Added options to show attachments on archived or trashed notes
* Showing note files will show all attachments for note even if its archived or trashed with mixed file types
* Fixed text about "Flux" theme which was removed
* Fixed bug when opening metric tracking that would prevent default fields from being shown
This commit is contained in:
Max
2022-12-20 19:59:03 +00:00
parent 31473c02ea
commit 0202d1acda
8 changed files with 71 additions and 15 deletions

View File

@@ -56,16 +56,28 @@ Attachment.search = (userId, noteId, attachmentType, offset, setSize, includeSha
WHERE attachment.user_id = ? AND visible = 1 `
if(noteId && noteId > 0){
//
// Show everything if note ID is present
//
query += 'AND attachment.note_id = ? '
params.push(noteId)
}
if(attachmentType == 'links'){
query += 'AND attachment_type = 1 '
}
if(attachmentType == 'files'){
query += 'AND attachment_type > 1 '
} else {
//
// Other filters if NO note id
//
if(attachmentType == 'links'){
query += 'AND attachment_type = 1 '
}
if(attachmentType == 'files'){
query += 'AND attachment_type > 1 '
}
query += `AND note.archived = ${ attachmentType == 'archived' ? '1':'0' } `
query += `AND note.trashed = ${ attachmentType == 'trashed' ? '1':'0' } `
}
if(!noteId){
const sharedOrNot = includeShared ? ' NOT ':' '
@@ -79,6 +91,8 @@ Attachment.search = (userId, noteId, attachmentType, offset, setSize, includeSha
const parsedSetSize = parseInt(setSize, 10) || 20
query += ` LIMIT ${limitOffset}, ${parsedSetSize}`
console.log(query)
db.promise()
.query(query, params)
.then((rows, fields) => {
@@ -434,8 +448,10 @@ Attachment.processUrl = (userId, noteId, url) => {
const keywords = SiteScrape.getKeywords($)
var desiredSearchText = ''
desiredSearchText += pageTitle + "\n"
desiredSearchText += keywords
desiredSearchText += pageTitle
if(keywords){
desiredSearchText += "\n" + keywords
}
console.log({
pageTitle,

View File

@@ -205,7 +205,7 @@ User.getCounts = (userId) => {
`SELECT
SUM(archived = 1 && share_user_id IS NULL && trashed = 0) AS archivedNotes,
SUM(trashed = 1) AS trashedNotes,
SUM(share_user_id IS NULL && trashed = 0) AS totalNotes,
SUM(share_user_id IS NULL && trashed = 0 AND quick_note < 2) AS totalNotes,
SUM(share_user_id IS NOT null && opened IS null && trashed = 0) AS youGotMailCount,
SUM(share_user_id != ? && trashed = 0) AS sharedToNotes
FROM note