Added some realtime events to the app
* When a user gets a new shared message, it will popup instantly * When a new website is scraped, it will update in real time * Various other little bug fixes and improvements * Sharing displays correct notes and handles shared notes correctly * Tags were not displaying on notes, they do now. They better.
This commit is contained in:
@@ -54,7 +54,7 @@ router.post('/upload', upload.single('file'), function (req, res, next) {
|
||||
.then( uploadResults => {
|
||||
//Reindex note, attachment may have had text
|
||||
Note.reindex(userId, noteId)
|
||||
.then( data => res.send(uploadResults) )
|
||||
.then( data => {res.send(uploadResults)})
|
||||
})
|
||||
|
||||
})
|
||||
|
@@ -23,7 +23,7 @@ router.use(function setUserId (req, res, next) {
|
||||
// Note actions
|
||||
//
|
||||
router.post('/get', function (req, res) {
|
||||
req.io.emit('welcome_homie', 'Welcome, dont poop from excitement')
|
||||
// req.io.emit('welcome_homie', 'Welcome, dont poop from excitement')
|
||||
Notes.get(userId, req.body.noteId)
|
||||
.then( data => {
|
||||
//Join room when user opens note
|
||||
@@ -43,7 +43,7 @@ router.post('/create', function (req, res) {
|
||||
})
|
||||
|
||||
router.post('/update', function (req, res) {
|
||||
Notes.update(userId, req.body.noteId, req.body.text, req.body.color, req.body.pinned, req.body.archived)
|
||||
Notes.update(req.io, userId, req.body.noteId, req.body.text, req.body.color, req.body.pinned, req.body.archived)
|
||||
.then( id => res.send({id}) )
|
||||
})
|
||||
|
||||
@@ -72,7 +72,13 @@ router.post('/getshareusers', function (req, res) {
|
||||
|
||||
router.post('/shareadduser', function (req, res) {
|
||||
ShareNote.addUser(userId, req.body.noteId, req.body.rawTextId, req.body.username)
|
||||
.then(results => res.send(results))
|
||||
.then( ({success, shareUserId}) => {
|
||||
|
||||
//Emit update count event to user shared with - so they see the note in real time
|
||||
req.io.to(shareUserId).emit('update_counts')
|
||||
|
||||
res.send(success)
|
||||
})
|
||||
})
|
||||
|
||||
router.post('/shareremoveuser', function (req, res) {
|
||||
|
Reference in New Issue
Block a user