Merge branch 'master' of github.com:designcreateplay/NodeBB

v1.18.x
Julian Lam 11 years ago
commit 9c55b202e7

@ -44,11 +44,18 @@ var nconf = require('nconf'),
nconf.argv();
// Start the daemon!
if (nconf.get('d')) {
// Check for a still-active NodeBB process
if (fs.existsSync(pidFilePath)) {
console.log('\n Error: Another NodeBB is already running!');
process.exit();
try {
var pid = fs.readFileSync(pidFilePath, { encoding: 'utf-8' });
process.kill(pid, 0);
console.log('\n Error: Another NodeBB is already running!');
process.exit();
} catch (e) {
fs.unlinkSync(pidFilePath);
}
}
// Initialise logging streams

@ -303,7 +303,9 @@ define(['uploader'], function(uploader) {
}
var numResults = results.length,
trEl,
resultObj;
resultObj;
groupsResultsEl.empty();
for(var x = 0; x < numResults; x++) {
resultObj = results[x];

@ -24,9 +24,9 @@ define(function() {
createSubmitBtn.on('click', function() {
var submitObj = {
name: createNameEl.val(),
description: $('#create-group-desc').val()
},
name: createNameEl.val(),
description: $('#create-group-desc').val()
},
errorEl = $('#create-modal-error'),
errorText;
@ -91,8 +91,9 @@ define(function() {
groupMembersEl.empty();
for (x = 0; x < numMembers; x++) {
var memberIcon = $('<li />')
.attr('data-uid', groupObj.members[x].uid)
.append($('<img />').attr('src', groupObj.members[x].picture))
.append($('<span />').attr('data-uid', groupObj.members[x].uid).html(groupObj.members[x].username));
.append($('<span />').html(groupObj.members[x].username));
groupMembersEl.append(memberIcon);
}
}
@ -127,7 +128,7 @@ define(function() {
.append($('<img />').attr('src', results.users[x].picture))
.append($('<span />').html(results.users[x].username));
resultsEl.appendChild(foundUser);
resultsEl.append(foundUser);
}
} else {
resultsEl.html('<li>No Users Found</li>');
@ -152,7 +153,7 @@ define(function() {
uid: uid
}, function(err, data) {
if (!err) {
groupMembersEl.append(userLabel.cloneNode(true));
groupMembersEl.append(userLabel.clone(true));
}
});
}
@ -164,10 +165,6 @@ define(function() {
socket.emit('admin.groups.get', gid, function(err, groupObj){
if (!err){
if (groupObj.name == 'Administrators' && uid == yourid){
bootbox.alert('You cannot remove yourself from the Administrator Group');
return;
}
bootbox.confirm('Are you sure you want to remove this user?', function(confirm) {
if (confirm){
socket.emit('admin.groups.leave', {

@ -17,8 +17,6 @@ define(function() {
return pagination.loadPage(pagination.currentPage - 1);
}).on('click', '.next', function() {
return pagination.loadPage(pagination.currentPage + 1);
}).on('click', '.page', function() {
return pagination.loadPage($(this).attr('data-page'));
}).on('click', '.select_page', function(e) {
e.preventDefault();
bootbox.prompt('Enter page number:', function(pageNum) {
@ -77,7 +75,11 @@ define(function() {
return false;
}
ajaxify.go(window.location.pathname.slice(1) + '?page=' + page);
ajaxify.go(window.location.pathname.slice(1) + '?page=' + page, function() {
if (typeof callback === 'function') {
callback();
}
});
return true;
}

@ -309,7 +309,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
var bookmark = localStorage.getItem('topic:' + tid + ':bookmark');
if (window.location.hash) {
Topic.scrollToPost(window.location.hash.substr(1), true);
} else if (bookmark) {
} else if (bookmark && (!config.usePagination || (config.usePagination && pagination.currentPage === 1))) {
app.alert({
alert_id: 'bookmark',
message: '[[topic:bookmark_instructions]]',
@ -324,7 +324,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
});
}
updateHeader();
if (!window.location.hash && !config.usePagination) {
updateHeader();
}
$('#post-container').on('mouseenter', '.favourite-tooltip', function(e) {
if (!$(this).data('users-loaded')) {
@ -1037,26 +1039,29 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
if(index > Topic.postCount) {
index = Topic.postCount;
}
$('#pagination').html(index + ' out of ' + Topic.postCount);
$('.progress-bar').width((index / Topic.postCount * 100) + '%');
if(!parseInt(el.attr('data-index'), 10)) {
localStorage.removeItem('topic:' + templates.get('topic_id') + ':bookmark');
} else {
var currentBookmark = localStorage.getItem('topic:' + templates.get('topic_id') + ':bookmark');
if (!currentBookmark || parseInt(el.attr('data-pid'), 10) > parseInt(currentBookmark, 10)) {
localStorage.setItem('topic:' + templates.get('topic_id') + ':bookmark', el.attr('data-pid'));
}
if (!scrollingToPost) {
var newUrl = window.location.protocol + '//' + window.location.host + window.location.pathname + '#' + el.attr('data-pid')
if (newUrl !== currentUrl) {
if (history.replaceState) {
history.replaceState({
url: window.location.pathname.slice(1) + '#' + el.attr('data-pid')
}, null, newUrl);
}
currentUrl = newUrl;
if (!scrollingToPost) {
var newUrl = window.location.href.replace(window.location.hash, '') + '#' + el.attr('data-pid');
if (newUrl !== currentUrl) {
if (history.replaceState) {
history.replaceState({
url: window.location.pathname.slice(1) + (window.location.search ? window.location.search : '' ) + '#' + el.attr('data-pid')
}, null, newUrl);
}
currentUrl = newUrl;
}
}
return false;
}
});
@ -1090,7 +1095,9 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
return;
}
if(parseInt(page, 10) !== pagination.currentPage) {
pagination.loadPage(page);
pagination.loadPage(page, function() {
scrollToPid(pid);
});
} else {
scrollToPid(pid);
}
@ -1106,6 +1113,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
if(after < 0) {
after = 0;
}
loadMorePosts(tid, after, function() {
scrollToPid(pid);
});
@ -1123,6 +1131,7 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
scrollTop: (scrollTo.offset().top - $('#header-menu').height() - offset) + "px"
}, duration !== undefined ? duration : 400, function() {
scrollingToPost = false;
updateHeader();
if (highlight) {
scrollTo.parent().find('.topic-item').addClass('highlight');
setTimeout(function() {

@ -115,7 +115,7 @@
</div>
<div class="panel-body">
<!-- BEGIN ips -->
{ips.ip}
<div>{ips.ip}</div>
<!-- END ips -->
</div>
</div>

@ -28,6 +28,7 @@
<script>
var RELATIVE_PATH = "{relative_path}";
</script>
<script src="{relative_path}/socket.io/socket.io.js"></script>
<!-- BEGIN clientScripts -->
<script src="{relative_path}/{clientScripts.script}?{cache-buster}"></script>
<!-- END clientScripts -->

@ -261,7 +261,10 @@ var fs = require('fs'),
}).filter(function(a) { return a; });
if (matches.length) {
var relPath = jsPath.slice(new String('plugins/' + matches[0]).length);
var relPath = jsPath.slice(new String('plugins/' + matches[0]).length),
pluginId = matches[0].split(path.sep)[0];
winston.warn('[meta.scripts.get (' + pluginId + ')] filter:scripts.get is deprecated, consider using "scripts" in plugin.json');
return plugins.staticDirs[matches[0]] + relPath;
} else {
winston.warn('[meta.scripts.get] Could not resolve mapped path: ' + jsPath + '. Are you sure it is defined by a plugin?');
@ -275,9 +278,6 @@ var fs = require('fs'),
// Remove scripts that could not be found (remove this line at v0.5.0)
Meta.js.scripts = jsPaths.filter(function(path) { return path !== null });
// Add socket.io client library
Meta.js.scripts.push(path.join(__dirname, '../node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js'));
// Add plugin scripts
Meta.js.scripts = Meta.js.scripts.concat(plugins.clientScripts);
@ -288,32 +288,34 @@ var fs = require('fs'),
},
minify: function (callback) {
var uglifyjs = require('uglify-js'),
jsPaths = this.scripts,
minified;
if (process.env.NODE_ENV === 'development') {
winston.info('Minifying client-side libraries');
}
minified = uglifyjs.minify(jsPaths);
minified = uglifyjs.minify(this.scripts);
this.cache = minified.code;
callback();
},
compress: function(callback) {
var uglifyjs = require('uglify-js'),
jsPaths = this.scripts,
compressed;
concatenate: function(callback) {
if (process.env.NODE_ENV === 'development') {
winston.info('Compressing client-side libraries into one file');
winston.info('Concatenating client-side libraries into one file');
}
minified = uglifyjs.minify(jsPaths, {
mangle: false,
compress: false
async.map(this.scripts, function(path, next) {
fs.readFile(path, { encoding: 'utf-8' }, next);
}, function(err, contents) {
if (err) {
winston.error('[meta.js.concatenate] Could not minify javascript! Error: ' + err.message);
process.exit();
}
Meta.js.cache = contents.reduce(function(output, src) {
return output.length ? output + ';\n' + src : src;
}, '');
callback();
});
this.cache = minified.code;
callback();
}
};

@ -233,7 +233,7 @@ var fs = require('fs'),
}
Plugins.clientScripts = Plugins.clientScripts.concat(pluginData.scripts.map(function(file) {
return path.join(pluginData.id, file);
return path.join(__dirname, '../node_modules/', pluginData.id, file);
}));
}

@ -57,7 +57,7 @@ var path = require('path'),
});
} else {
// Compress only
meta.js.compress(function() {
meta.js.concatenate(function() {
sendCached();
});
}

@ -864,6 +864,12 @@ Upgrade.upgrade = function(callback) {
if(err) {
return next(err);
}
// If there was no order present, put it at the end
if (!order) {
order = cids.length;
}
db.sortedSetAdd('categories:cid', order, cid, next);
});
}, function(err) {

Loading…
Cancel
Save