showing guest handles in frontend UI #2569

This commit is contained in:
Julian Lam
2014-12-31 16:27:35 -05:00
parent b97c9e4467
commit 325815a78d
7 changed files with 60 additions and 32 deletions

View File

@@ -14,10 +14,10 @@ module.exports = function(Posts) {
Posts.create = function(data, callback) {
var uid = data.uid,
tid = data.tid,
handle = data.uid ? null : data.handle, // Only guests have handles!
content = data.content,
timestamp = data.timestamp || Date.now();
if (!uid && parseInt(uid, 10) !== 0) {
return callback(new Error('[[error:invalid-uid]]'));
}
@@ -51,6 +51,10 @@ module.exports = function(Posts) {
postData.ip = data.ip;
}
if (handle) {
postData.handle = handle;
}
plugins.fireHook('filter:post.save', postData, next);
},
function(postData, next) {