Compare commits

..

No commits in common. "f0b6d7b85ee656a968c3748d647b331e2183df22" and "21f606b480952235b3787481e791a1fc6215eaec" have entirely different histories.

5 changed files with 24 additions and 44 deletions

View File

@ -212,7 +212,7 @@ a:hover {
scrollbar-width: none; scrollbar-width: none;
} }
/*Makes the first line real big */ /*Makes the first line real big */
.squire-box > p:first-child { .squire-box p:first-child {
font-size: 1.4em; font-size: 1.4em;
line-height: 1.7em; line-height: 1.7em;
} }

View File

@ -11,23 +11,12 @@
<div class="ui grid max-height"> <div class="ui grid max-height">
<!-- Show title and snippet below it --> <!-- Show title and snippet below it -->
<div class="top aligned row" @click.self="cardClicked"> <div class="top aligned row" @click.self="onClick(note.id)">
<div class="sixteen wide column overflow-hidden note-card-text" @click="cardClicked"> <div class="sixteen wide column overflow-hidden note-card-text" @click="e => onClick(note.id, e)">
<span class="subtext" v-if="note.shareUsername"> <div class="subtext" v-if="note.shareUsername">Shared by {{ note.shareUsername }}</div>
Shared by {{ note.shareUsername }} <div class="subtext" v-if="note.shared == 2">You Shared</div>
<span v-if="note.updated > note.opened && !beenClicked" class="ui tiny green compact right floated button">
Unread
</span>
</span>
<span class="subtext" v-if="note.shared == 2">
You Shared
<span v-if="note.updated > note.opened && !beenClicked" class="ui tiny green compact right floated button">
Updated
</span>
</span>
<!-- Title display --> <!-- Title display -->
@ -57,11 +46,11 @@
<!-- Toolbar on the bottom --> <!-- Toolbar on the bottom -->
<div class="bottom aligned row" @click.self="cardClicked"> <div class="bottom aligned row" @click.self="onClick(note.id)">
<div class="sixteen wide column"> <div class="sixteen wide column">
<div class="ui grid reduced-padding"> <div class="ui grid reduced-padding">
<div class="thirteen wide column clickable icon-bar" @click="cardClicked"> <div class="thirteen wide column clickable icon-bar" @click="onClick(note.id)">
<!-- {{$helpers.timeAgo(note.updated)}} --> <!-- {{$helpers.timeAgo(note.updated)}} -->
<span v-if="note.tags"> <span v-if="note.tags">
<span v-for="tag in (note.tags.split(','))" class="little-tag">{{ tag }}</span> <span v-for="tag in (note.tags.split(','))" class="little-tag">{{ tag }}</span>
@ -100,10 +89,6 @@
'delete-button': require('@/components/NoteDeleteButtonComponent.vue').default, 'delete-button': require('@/components/NoteDeleteButtonComponent.vue').default,
}, },
methods:{ methods:{
cardClicked(){
this.beenClicked = true
this.onClick(this.note.id)
},
cleanHighlight(text){ cleanHighlight(text){
//Basically just remove whitespace //Basically just remove whitespace
let updated = text.replace(/&nbsp;/g, '').replace(/<br>/g,'') let updated = text.replace(/&nbsp;/g, '').replace(/<br>/g,'')
@ -131,7 +116,6 @@
fontColor: null, fontColor: null,
noteIcon: null, noteIcon: null,
iconColor: null, iconColor: null,
beenClicked: false,
} }
}, },
computed: { computed: {

View File

@ -106,14 +106,14 @@ Note.create = (userId, noteText, quickNote = 0) => {
const created = Math.round((+new Date)/1000) const created = Math.round((+new Date)/1000)
db.promise() db.promise()
.query(`INSERT INTO note_raw_text (text, updated) VALUE (?, ?)`, [noteText, created]) .query(`INSERT INTO note_raw_text (text) VALUE (?)`, [noteText])
.then( (rows, fields) => { .then( (rows, fields) => {
const rawTextId = rows[0].insertId const rawTextId = rows[0].insertId
return db.promise() return db.promise()
.query('INSERT INTO note (user_id, note_raw_text_id, created, quick_note) VALUES (?,?,?,?)', .query('INSERT INTO note (user_id, note_raw_text_id, updated, created, quick_note) VALUES (?,?,?,?,?)',
[userId, rawTextId, created, quickNote]) [userId, rawTextId, created, created, quickNote])
}) })
.then((rows, fields) => { .then((rows, fields) => {
// Indexing is done on save // Indexing is done on save
@ -177,14 +177,14 @@ Note.update = (io, userId, noteId, noteText, color, pinned, archived) => {
//Update Note text //Update Note text
return db.promise() return db.promise()
.query('UPDATE note_raw_text SET text = ?, updated = ? WHERE id = ?', [noteText, now, textId]) .query('UPDATE note_raw_text SET text = ? WHERE id = ?', [noteText, textId])
}) })
.then( (rows, fields) => { .then( (rows, fields) => {
//Update other note attributes //Update other note attributes
return db.promise() return db.promise()
.query('UPDATE note SET pinned = ?, archived = ?, color = ? WHERE id = ? AND user_id = ? LIMIT 1', .query('UPDATE note SET pinned = ?, archived = ?, updated = ?, color = ? WHERE id = ? AND user_id = ? LIMIT 1',
[pinned, archived, color, noteId, userId]) [pinned, archived, now, color, noteId, userId])
}) })
.then((rows, fields) => { .then((rows, fields) => {
@ -330,17 +330,16 @@ Note.get = (userId, noteId) => {
.query(` .query(`
SELECT SELECT
note_raw_text.text, note_raw_text.text,
note_raw_text.updated as updated, note.updated,
note.pinned, note.pinned,
note.archived, note.archived,
note.color, note.color,
count(distinct attachment.id) as attachment_count, count(distinct attachment.id) as attachment_count,
note.note_raw_text_id as rawTextId, note.note_raw_text_id as rawTextId
shareUser.username as shareUsername
FROM note FROM note
JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id) JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id)
LEFT JOIN attachment ON (note.id = attachment.note_id) LEFT JOIN attachment ON (note.id = attachment.note_id)
LEFT JOIN user as shareUser ON (note.share_user_id = shareUser.id) LEFT JOIN user ON (note.share_user_id = user.id)
WHERE note.user_id = ? AND note.id = ? LIMIT 1`, [userId,noteId]) WHERE note.user_id = ? AND note.id = ? LIMIT 1`, [userId,noteId])
.then((rows, fields) => { .then((rows, fields) => {
@ -360,7 +359,7 @@ Note.get = (userId, noteId) => {
Note.getShared = (noteId) => { Note.getShared = (noteId) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
db.promise() db.promise()
.query('SELECT text, color FROM note WHERE id = ? AND shared = 1 LIMIT 1', [noteId]) .query('SELECT text, updated, color FROM note WHERE id = ? AND shared = 1 LIMIT 1', [noteId])
.then((rows, fields) => { .then((rows, fields) => {
//Return note data //Return note data
@ -453,8 +452,7 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
let noteSearchQuery = ` let noteSearchQuery = `
SELECT note.id, SELECT note.id,
SUBSTRING(note_raw_text.text, 1, 1500) as text, SUBSTRING(note_raw_text.text, 1, 1500) as text,
note_raw_text.updated as updated, updated,
opened,
color, color,
count(distinct note_tag.id) as tag_count, count(distinct note_tag.id) as tag_count,
count(distinct attachment.id) as attachment_count, count(distinct attachment.id) as attachment_count,
@ -534,15 +532,15 @@ Note.search = (userId, searchQuery, searchTags, fastFilters) => {
// Always prioritize pinned notes in searches. // Always prioritize pinned notes in searches.
//Default Sort, order by last updated //Default Sort, order by last updated
let defaultOrderBy = ' ORDER BY note.pinned DESC, updated DESC, note.created DESC, note.opened DESC, id DESC' let defaultOrderBy = ' ORDER BY note.pinned DESC, note.updated DESC, note.created DESC, note.opened DESC, id DESC'
//Order by Last Created Date //Order by Last Created Date
if(fastFilters.lastCreated == 1){ if(fastFilters.lastCreated == 1){
defaultOrderBy = ' ORDER BY note.pinned DESC, note.created DESC, updated DESC, note.opened DESC, id DESC' defaultOrderBy = ' ORDER BY note.pinned DESC, note.created DESC, note.updated DESC, note.opened DESC, id DESC'
} }
//Order by last Opened Date //Order by last Opened Date
if(fastFilters.lastOpened == 1){ if(fastFilters.lastOpened == 1){
defaultOrderBy = ' ORDER BY note.pinned DESC, opened DESC, updated DESC, note.created DESC, id DESC' defaultOrderBy = ' ORDER BY note.pinned DESC, opened DESC, note.updated DESC, note.created DESC, id DESC'
} }
//Append Order by to query //Append Order by to query

View File

@ -211,13 +211,12 @@ Tag.latest = (userId, noteId) => {
.query(`SELECT tag.text FROM note_tag .query(`SELECT tag.text FROM note_tag
JOIN tag ON note_tag.tag_id = tag.id JOIN tag ON note_tag.tag_id = tag.id
JOIN note ON note_tag.note_id = note.id JOIN note ON note_tag.note_id = note.id
JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id)
WHERE note_tag.user_id = ? WHERE note_tag.user_id = ?
AND note_tag.tag_id NOT IN ( AND note_tag.tag_id NOT IN (
SELECT note_tag.tag_id FROM note_tag WHERE note_tag.note_id = ? SELECT note_tag.tag_id FROM note_tag WHERE note_tag.note_id = ?
) )
GROUP BY tag.text, note_raw_text.updated GROUP BY tag.text, note.updated
ORDER BY note_raw_text.updated DESC ORDER BY note.updated DESC
LIMIT 8;`, [userId, noteId]) LIMIT 8;`, [userId, noteId])
.then((rows, fields) => { .then((rows, fields) => {
resolve(rows[0]) //Return found tags resolve(rows[0]) //Return found tags

View File

@ -126,9 +126,8 @@ User.getCounts = (userId) => {
SUM(archived = 1 && share_user_id IS NULL) AS archivedNotes, SUM(archived = 1 && share_user_id IS NULL) AS archivedNotes,
SUM(share_user_id IS NULL) AS totalNotes, SUM(share_user_id IS NULL) AS totalNotes,
SUM(share_user_id != ?) AS sharedToNotes, SUM(share_user_id != ?) AS sharedToNotes,
SUM( (share_user_id != ? && opened IS null) || (share_user_id != ? && note_raw_text.updated > opened) ) AS unreadNotes SUM( (share_user_id != ? && opened IS null) || (share_user_id != ? && updated > opened) ) AS unreadNotes
FROM note FROM note
JOIN note_raw_text ON (note_raw_text.id = note.note_raw_text_id)
WHERE user_id = ?`, [userId, userId, userId, userId]) WHERE user_id = ?`, [userId, userId, userId, userId])
.then( (rows, fields) => { .then( (rows, fields) => {