anons cant edit after posting #365

v1.18.x
Baris Usakli 12 years ago
parent 0179a55ee4
commit c8ec095d99

@ -548,7 +548,7 @@ define(function() {
});
socket.on('api:post.privileges', function(privileges) {
if (privileges.editable) toggle_mod_tools(privileges.pid, true);
toggle_mod_tools(privileges.pid, privileges.editable);
});
function adjust_rep(value, pid, uid) {

@ -25,7 +25,13 @@ var RDB = require('./redis.js'),
}
PostTools.privileges = function(pid, uid, callback) {
//todo: break early if one condition is true
if(uid == 0) {
callback({
editable: false,
view_deleted: false
});
return;
}
function getThreadPrivileges(next) {
posts.getPostField(pid, 'tid', function(tid) {

@ -304,6 +304,7 @@ var RDB = require('./redis.js'),
var socketData = {
posts: [postData]
};
io.sockets.in('topic_' + tid).emit('event:new_post', socketData);
io.sockets.in('recent_posts').emit('event:new_post', socketData);
io.sockets.in('user/' + uid).emit('event:new_post', socketData);

@ -541,8 +541,15 @@ module.exports.init = function(io) {
});
socket.on('api:posts.edit', function(data) {
if (!data.title || data.title.length < topics.minimumTitleLength) {
if(!uid) {
socket.emit('event:alert', {
title: 'Can&apos;t edit',
message: 'Guests can&apos;t edit posts!',
type: 'warning',
timeout: 2000
});
return;
} else if (!data.title || data.title.length < topics.minimumTitleLength) {
topics.emitTitleTooShortAlert(socket);
return;
} else if (!data.content || data.content.length < require('../public/config.json').minimumPostLength) {

Loading…
Cancel
Save