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