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 789a4e47d4
commit 7f65587db6
8 changed files with 71 additions and 15 deletions

View File

@ -20,7 +20,7 @@
.image-placeholder { .image-placeholder {
width: 100%; width: 100%;
height: 100%; height: 100%;
max-height: 100px; max-height: 75px;
} }
.image-placeholder:after { .image-placeholder:after {
content: 'No Image'; content: 'No Image';
@ -89,7 +89,14 @@
<!-- image and text --> <!-- image and text -->
<div class="six wide center aligned middle aligned column"> <div class="six wide center aligned middle aligned column">
<a :href="linkUrl" target="_blank" > <a :href="linkUrl" target="_blank" >
<img v-if="item.file_location" class="attachment-image" :src="`/api/static/thumb_${item.file_location}`"> <img v-if="item.file_location" class="attachment-image"
onerror="
this.onerror=null;
this.src='/api/static/assets/marketing/void.svg';
this.classList.add('image-placeholder');
this.insertAdjacentText('afterend', 'Image not found');
"
:src="`/api/static/thumb_${item.file_location}`">
<span v-else> <span v-else>
<img class="image-placeholder" loading="lazy" src="/api/static/assets/marketing/void.svg"> <img class="image-placeholder" loading="lazy" src="/api/static/assets/marketing/void.svg">
No Image No Image
@ -171,6 +178,9 @@
this.checkKeyup() this.checkKeyup()
}) })
}, },
updated: function(){
this.checkKeyup()
},
methods: { methods: {
checkKeyup(){ checkKeyup(){
let elm = this.$refs.edit let elm = this.$refs.edit

View File

@ -108,7 +108,14 @@
<div v-if="getThumbs.length > 0"> <div v-if="getThumbs.length > 0">
<div class="tiny-thumb-box" v-on:click="openEditAttachment"> <div class="tiny-thumb-box" v-on:click="openEditAttachment">
<img v-for="thumb in getThumbs" class="tiny-thumb" :src="`/api/static/thumb_${thumb}`"> <img v-for="thumb in getThumbs"
class="tiny-thumb"
:src="`/api/static/thumb_${thumb}`"
onerror="
this.onerror=null;
this.src='/api/static/assets/marketing/void.svg';
"
/>
</div> </div>
</div> </div>

View File

@ -35,6 +35,23 @@
<i class="copy icon"></i> <i class="copy icon"></i>
Other Files Other Files
</router-link> </router-link>
<router-link
v-if="$store.getters.totals && $store.getters.totals['archivedNotes']"
exact-active-class="green"
class="ui basic button shrinking"
to="/attachments/type/archived">
<i class="archive icon"></i>
Archived
</router-link>
<router-link
v-if="$store.getters.totals && $store.getters.totals['trashedNotes']"
exact-active-class="green"
class="ui basic button shrinking"
to="/attachments/type/trashed">
<i class="trash icon"></i>
Trashed
</router-link>
<router-link <router-link
v-if="$store.getters.totals && $store.getters.totals['sharedToNotes']" v-if="$store.getters.totals && $store.getters.totals['sharedToNotes']"

View File

@ -1229,7 +1229,11 @@
this.setApplicationStateJson(appData) this.setApplicationStateJson(appData)
} }
}) })
.catch(error => { this.$bus.$emit('notification', error) }) .catch(error => {
this.$bus.$emit('notification', error)
this.setApplicationStateJson(null)
})
}, },
setApplicationStateJson(json){ setApplicationStateJson(json){
@ -1238,7 +1242,7 @@
// Can be called via import or Ajax on load // Can be called via import or Ajax on load
this.cycleData = json?.cycleData || this.cycleData this.cycleData = json?.cycleData || this.cycleData
this.fields = [...new Set(json.fields)] || this.fields this.fields = [...new Set(json?.fields)] || this.fields
this.userFields = json?.userFields || this.userFields this.userFields = json?.userFields || this.userFields
// this.graphs = json?.graphs || this.graphs // this.graphs = json?.graphs || this.graphs

File diff suppressed because one or more lines are too long

View File

@ -23,6 +23,8 @@
</div> </div>
<tag-display <tag-display
v-if="$store.getters.totals && Object.keys($store.getters.totals['tags'] || {}).length"
:user-tags="$store.getters.totals['tags']"
:active-tags="searchTags" :active-tags="searchTags"
v-on:tagClick="tagId => toggleTagFilter(tagId)" v-on:tagClick="tagId => toggleTagFilter(tagId)"
/> />

View File

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

View File

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