mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
passing in a picture into notifications now
This commit is contained in:
@@ -20,12 +20,23 @@ define(function() {
|
||||
notifList.html('');
|
||||
|
||||
if (!err && (data.read.length + data.unread.length) > 0) {
|
||||
var image = '';
|
||||
for (x = 0; x < numUnread; x++) {
|
||||
notifList.append($('<li class="' + data.unread[x].readClass + '"><a href="' + data.unread[x].path + '"><span class="pull-right">' + utils.relativeTime(data.unread[x].datetime, true) + '</span>' + data.unread[x].text + '</a></li>'));
|
||||
if (data.unread[x].image) {
|
||||
image = '<img src="' + data.unread[x].image + '" />';
|
||||
} else {
|
||||
image = '';
|
||||
}
|
||||
notifList.append($('<li class="' + data.unread[x].readClass + '"><a href="' + data.unread[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.unread[x].datetime, true) + '</span><span class="text">' + data.unread[x].text + '</span></a></li>'));
|
||||
}
|
||||
|
||||
for (x = 0; x < numRead; x++) {
|
||||
notifList.append($('<li class="' + data.read[x].readClass + '"><a href="' + data.read[x].path + '"><span class="pull-right">' + utils.relativeTime(data.read[x].datetime, true) + '</span>' + data.read[x].text + '</a></li>'));
|
||||
if (data.read[x].image) {
|
||||
image = '<img src="' + data.read[x].image + '" />';
|
||||
} else {
|
||||
image = '';
|
||||
}
|
||||
notifList.append($('<li class="' + data.read[x].readClass + '"><a href="' + data.read[x].path + '">' + image + '<span class="pull-right relTime">' + utils.relativeTime(data.read[x].datetime, true) + '</span><span class="text">' + data.read[x].text + '</span></a></li>'));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,8 @@ var async = require('async'),
|
||||
|
||||
db = require('./database'),
|
||||
utils = require('../public/src/utils'),
|
||||
events = require('./events');
|
||||
events = require('./events'),
|
||||
User = require('./user');
|
||||
|
||||
(function(Notifications) {
|
||||
"use strict";
|
||||
@@ -27,11 +28,18 @@ var async = require('async'),
|
||||
if (exists) {
|
||||
db.sortedSetRank('uid:' + uid + ':notifications:read', nid, function(err, rank) {
|
||||
|
||||
db.getObjectFields('notifications:' + nid, ['nid', 'text', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
|
||||
|
||||
db.getObjectFields('notifications:' + nid, ['nid', 'from', 'text', 'score', 'path', 'datetime', 'uniqueId'], function(err, notification) {
|
||||
notification.read = rank !== null ? true:false;
|
||||
|
||||
if (notification.from) {
|
||||
User.getUserField(notification.from, 'picture', function(err, picture) {
|
||||
notification.image = picture;
|
||||
callback(notification);
|
||||
});
|
||||
} else {
|
||||
callback(notification);
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// Remove from the user's boxes
|
||||
|
||||
@@ -106,7 +106,8 @@ SocketModules.chats.send = function(socket, data) {
|
||||
notifications.create({
|
||||
text: notifText,
|
||||
path: 'javascript:app.openChat('' + username + '', ' + socket.uid + ');',
|
||||
uniqueId: 'notification_' + socket.uid + '_' + touid
|
||||
uniqueId: 'notification_' + socket.uid + '_' + touid,
|
||||
from: socket.uid
|
||||
}, function(nid) {
|
||||
notifications.push(nid, [touid], function(success) {
|
||||
|
||||
|
||||
@@ -263,7 +263,8 @@ SocketPosts.flag = function(socket, pid, callback) {
|
||||
notifications.create({
|
||||
text: message,
|
||||
path: path,
|
||||
uniqueId: 'post_flag:' + pid
|
||||
uniqueId: 'post_flag:' + pid,
|
||||
from: socket.uid
|
||||
}, function(nid) {
|
||||
notifications.push(nid, adminGroup.members, function() {
|
||||
next(null);
|
||||
|
||||
@@ -271,7 +271,8 @@ var winston = require('winston'),
|
||||
notifications.create({
|
||||
text: '<strong>' + username + '</strong> has posted a reply to: "<strong>' + topicData.title + '</strong>"',
|
||||
path: nconf.get('relative_path') + '/topic/' + topicData.slug + '#' + pid,
|
||||
uniqueId: 'topic:' + tid
|
||||
uniqueId: 'topic:' + tid,
|
||||
from: exceptUid
|
||||
}, function(nid) {
|
||||
next(null, nid);
|
||||
});
|
||||
|
||||
@@ -717,7 +717,8 @@ var bcrypt = require('bcryptjs'),
|
||||
notifications.create({
|
||||
text: message,
|
||||
path: nconf.get('relative_path') + '/topic/' + slug + '#' + pid,
|
||||
uniqueId: 'topic:' + tid
|
||||
uniqueId: 'topic:' + tid,
|
||||
from: uid
|
||||
}, function(nid) {
|
||||
notifications.push(nid, followers);
|
||||
});
|
||||
@@ -1029,6 +1030,7 @@ var bcrypt = require('bcryptjs'),
|
||||
getNotifications('uid:' + uid + ':notifications:read', 0, 9, null, next);
|
||||
}
|
||||
}, function(err, notifications) {
|
||||
console.log(notifications);
|
||||
if(err) {
|
||||
return calback(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user