anons cant edit after posting #365

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

@ -344,8 +344,8 @@ var socket,
app.createNewPosts = function (data) {
if (data.posts[0].uid !== app.uid) {
data.posts[0].display_moderator_tools = 'none';
}
data.posts[0].display_moderator_tools = 'none';
}
var html = templates.prepare(templates['topic'].blocks['posts']).parse(data);
translator.translate(html, function(translatedHTML) {

@ -32,7 +32,7 @@ define(function() {
window.open(twitter_url, '_blank', 'width=550,height=420,scrollbars=no,status=no');
return false;
});
$('.facebook-share').on('click', function () {
window.open(facebook_url, '_blank', 'width=626,height=436,scrollbars=no,status=no');
return false;
@ -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