mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 14:05:46 +01:00
fixed topic reply if title was 255, better notif text in unread and recent,removed console.log
This commit is contained in:
@@ -59,23 +59,21 @@ define(function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Recent.updateAlertText = function() {
|
Recent.updateAlertText = function() {
|
||||||
var text = '';
|
var text = 'There';
|
||||||
|
|
||||||
if (Recent.newTopicCount > 1)
|
if (newTopicCount > 1) {
|
||||||
text = 'There are ' + Recent.newTopicCount + ' new topics';
|
text += ' are ' + newTopicCount + ' new topics';
|
||||||
else if (Recent.newTopicCount === 1)
|
} else if (newTopicCount === 1) {
|
||||||
text = 'There is 1 new topic';
|
text += ' is a new topic';
|
||||||
else
|
}
|
||||||
text = 'There are no new topics';
|
|
||||||
|
|
||||||
if (Recent.newPostCount > 1)
|
if (newPostCount > 1) {
|
||||||
text += ' and ' + Recent.newPostCount + ' new posts.';
|
text += (newTopicCount?' and ':' are ') + newPostCount + ' new posts';
|
||||||
else if (Recent.newPostCount === 1)
|
} else if(newPostCount === 1) {
|
||||||
text += ' and 1 new post.';
|
text += (newTopicCount?' and ':' is ') + ' a new post';
|
||||||
else
|
}
|
||||||
text += ' and no new posts.';
|
|
||||||
|
|
||||||
text += ' Click here to reload.';
|
text += '. Click here to reload.';
|
||||||
|
|
||||||
$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');
|
$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,6 @@ define(['composer'], function(composer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('.topic').on('click', '.post_reply', function() {
|
$('.topic').on('click', '.post_reply', function() {
|
||||||
console.log('gg twice');
|
|
||||||
var selectionText = '',
|
var selectionText = '',
|
||||||
selection = window.getSelection() || document.getSelection();
|
selection = window.getSelection() || document.getSelection();
|
||||||
|
|
||||||
|
|||||||
@@ -19,16 +19,25 @@ define(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('event:new_topic', function(data) {
|
socket.on('event:new_topic', function(data) {
|
||||||
|
|
||||||
++newTopicCount;
|
++newTopicCount;
|
||||||
updateAlertText();
|
updateAlertText();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateAlertText() {
|
function updateAlertText() {
|
||||||
var text = '';
|
var text = 'There';
|
||||||
|
|
||||||
if (newTopicCount > 1)
|
if (newTopicCount > 1) {
|
||||||
|
text += ' are ' + newTopicCount + ' new topics';
|
||||||
|
} else if (newTopicCount === 1) {
|
||||||
|
text += ' is a new topic';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newPostCount > 1) {
|
||||||
|
text += (newTopicCount?' and ':' are ') + newPostCount + ' new posts';
|
||||||
|
} else if(newPostCount === 1) {
|
||||||
|
text += (newTopicCount?' and ':' is ') + ' a new post';
|
||||||
|
}
|
||||||
|
/*if (newTopicCount > 1)
|
||||||
text = 'There are ' + newTopicCount + ' new topics';
|
text = 'There are ' + newTopicCount + ' new topics';
|
||||||
else if (newTopicCount === 1)
|
else if (newTopicCount === 1)
|
||||||
text = 'There is 1 new topic';
|
text = 'There is 1 new topic';
|
||||||
@@ -40,9 +49,9 @@ define(function() {
|
|||||||
else if (newPostCount === 1)
|
else if (newPostCount === 1)
|
||||||
text += ' and 1 new post.';
|
text += ' and 1 new post.';
|
||||||
else
|
else
|
||||||
text += ' and no new posts.';
|
text += ' and no new posts.';*/
|
||||||
|
|
||||||
text += ' Click here to reload.';
|
text += '. Click here to reload.';
|
||||||
|
|
||||||
$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');
|
$('#new-topics-alert').html(text).removeClass('hide').fadeIn('slow');
|
||||||
$('#category-no-topics').addClass('hidden');
|
$('#category-no-topics').addClass('hidden');
|
||||||
|
|||||||
@@ -384,18 +384,19 @@ define(['taskbar'], function(taskbar) {
|
|||||||
titleEl.val(titleEl.val().trim());
|
titleEl.val(titleEl.val().trim());
|
||||||
bodyEl.val(bodyEl.val().trim());
|
bodyEl.val(bodyEl.val().trim());
|
||||||
|
|
||||||
|
var checkTitle = parseInt(postData.cid, 10) || parseInt(postData.pid, 10);
|
||||||
|
|
||||||
if(postData.uploadsInProgress && postData.uploadsInProgress.length) {
|
if(postData.uploadsInProgress && postData.uploadsInProgress.length) {
|
||||||
return composerAlert('Still uploading', 'Please wait for uploads to complete.');
|
return composerAlert('Still uploading', 'Please wait for uploads to complete.');
|
||||||
} else if (titleEl.val().length < parseInt(config.minimumTitleLength, 10)) {
|
} else if (checkTitle && titleEl.val().length < parseInt(config.minimumTitleLength, 10)) {
|
||||||
return composerAlert('Title too short', 'Please enter a longer title. At least ' + config.minimumTitleLength+ ' characters.');
|
return composerAlert('Title too short', 'Please enter a longer title. At least ' + config.minimumTitleLength+ ' characters.');
|
||||||
} else if (titleEl.val().length > parseInt(config.maximumTitleLength, 10)) {
|
} else if (checkTitle && titleEl.val().length > parseInt(config.maximumTitleLength, 10)) {
|
||||||
return composerAlert('Title too long', 'Please enter a shorter title. Titles can\'t be longer than ' + config.maximumTitleLength + ' characters.');
|
return composerAlert('Title too long', 'Please enter a shorter title. Titles can\'t be longer than ' + config.maximumTitleLength + ' characters.');
|
||||||
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
} else if (bodyEl.val().length < parseInt(config.minimumPostLength, 10)) {
|
||||||
return composerAlert('Content too short', 'Please enter a longer post. At least ' + config.minimumPostLength + ' characters.');
|
return composerAlert('Content too short', 'Please enter a longer post. At least ' + config.minimumPostLength + ' characters.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Still here? Let's post.
|
if (parseInt(postData.cid, 10) > 0) {
|
||||||
if (parseInt(postData.cid) > 0) {
|
|
||||||
socket.emit('topics.post', {
|
socket.emit('topics.post', {
|
||||||
'title' : titleEl.val(),
|
'title' : titleEl.val(),
|
||||||
'content' : bodyEl.val(),
|
'content' : bodyEl.val(),
|
||||||
@@ -403,14 +404,14 @@ define(['taskbar'], function(taskbar) {
|
|||||||
}, function() {
|
}, function() {
|
||||||
composer.discard(post_uuid);
|
composer.discard(post_uuid);
|
||||||
});
|
});
|
||||||
} else if (parseInt(postData.tid) > 0) {
|
} else if (parseInt(postData.tid, 10) > 0) {
|
||||||
socket.emit('posts.reply', {
|
socket.emit('posts.reply', {
|
||||||
'topic_id' : postData.tid,
|
'topic_id' : postData.tid,
|
||||||
'content' : bodyEl.val()
|
'content' : bodyEl.val()
|
||||||
}, function() {
|
}, function() {
|
||||||
composer.discard(post_uuid);
|
composer.discard(post_uuid);
|
||||||
});
|
});
|
||||||
} else if (parseInt(postData.pid) > 0) {
|
} else if (parseInt(postData.pid, 10) > 0) {
|
||||||
socket.emit('posts.edit', {
|
socket.emit('posts.edit', {
|
||||||
pid: postData.pid,
|
pid: postData.pid,
|
||||||
content: bodyEl.val(),
|
content: bodyEl.val(),
|
||||||
|
|||||||
@@ -104,7 +104,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="chats dropdown text-center hidden-xs">
|
<li class="chats dropdown text-center hidden-xs">
|
||||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="chat_dropdown"><i class="fa fa-comment"></i></a>
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#" id="chat_dropdown"><i class="fa fa-comment-o"></i></a>
|
||||||
<ul id="chat-list" class="dropdown-menu" aria-labelledby="chat_dropdown">
|
<ul id="chat-list" class="dropdown-menu" aria-labelledby="chat_dropdown">
|
||||||
<li>
|
<li>
|
||||||
<a href="#"><i class="fa fa-refresh fa-spin"></i> [[global:chats.loading]]</a>
|
<a href="#"><i class="fa fa-refresh fa-spin"></i> [[global:chats.loading]]</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user