mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-12 07:30:45 +01:00
Merge remote-tracking branch 'origin/master' into 0.7.0
This commit is contained in:
@@ -253,11 +253,8 @@ app.uid = null;
|
||||
|
||||
app.replaceSelfLinks();
|
||||
|
||||
setTimeout(function () {
|
||||
if (window.scrollY === 0) {
|
||||
window.scrollTo(0, 1); // rehide address bar on mobile after page load completes.
|
||||
}
|
||||
}, 100);
|
||||
// Scroll back to top of page
|
||||
window.scrollTo(0, 0);
|
||||
};
|
||||
|
||||
app.showLoginMessage = function () {
|
||||
|
||||
@@ -457,6 +457,17 @@ define('settings', function () {
|
||||
console.log('[settings] Unable to load settings for hash: ', hash);
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
// Parse all values. If they are json, return json
|
||||
for(var key in values) {
|
||||
if (values.hasOwnProperty(key)) {
|
||||
try {
|
||||
values[key] = JSON.parse(values[key]);
|
||||
} catch (e) {
|
||||
// Leave the value as is
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(formEl).deserialize(values);
|
||||
|
||||
@@ -471,9 +482,16 @@ define('settings', function () {
|
||||
formEl.find('input[type="checkbox"]').each(function (idx, inputEl) {
|
||||
inputEl = $(inputEl);
|
||||
if (!inputEl.is(':checked')) {
|
||||
values[inputEl.attr('id')] = 'off';
|
||||
values[inputEl.attr('name')] = 'off';
|
||||
}
|
||||
});
|
||||
|
||||
// Normalizing value of multiple selects
|
||||
formEl.find('select[multiple]').each(function(idx, selectEl) {
|
||||
selectEl = $(selectEl);
|
||||
values[selectEl.attr('name')] = JSON.stringify(selectEl.val());
|
||||
});
|
||||
|
||||
socket.emit('admin.settings.set', {
|
||||
hash: hash,
|
||||
values: values
|
||||
|
||||
1
public/vendor/colorpicker/colorpicker.css
vendored
1
public/vendor/colorpicker/colorpicker.css
vendored
@@ -139,7 +139,6 @@
|
||||
left: 282px;
|
||||
}
|
||||
.colorpicker_submit {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
|
||||
@@ -32,7 +32,7 @@ groupsController.details = function(req, res, next) {
|
||||
}, next);
|
||||
},
|
||||
posts: function(next) {
|
||||
groups.getLatestMemberPosts(req.params.name, 10, uid, next);
|
||||
groups.getLatestMemberPosts(req.params.slug, 10, uid, next);
|
||||
}
|
||||
}, function(err, results) {
|
||||
if (err) {
|
||||
|
||||
@@ -48,32 +48,32 @@ usersController.getOnlineUsers = function(req, res, next) {
|
||||
};
|
||||
|
||||
usersController.getUsersSortedByPosts = function(req, res, next) {
|
||||
getUsers('users:postcount', res, next);
|
||||
usersController.getUsers('users:postcount', 50, res, next);
|
||||
};
|
||||
|
||||
usersController.getUsersSortedByReputation = function(req, res, next) {
|
||||
getUsers('users:reputation', res, next);
|
||||
usersController.getUsers('users:reputation', 50, res, next);
|
||||
};
|
||||
|
||||
usersController.getUsersSortedByJoinDate = function(req, res, next) {
|
||||
getUsers('users:joindate', res, next);
|
||||
usersController.getUsers('users:joindate', 50, res, next);
|
||||
};
|
||||
|
||||
function getUsers(set, res, next) {
|
||||
getUsersAndCount(set, 50, function(err, data) {
|
||||
usersController.getUsers = function(set, count, res, next) {
|
||||
getUsersAndCount(set, count, function(err, data) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
var userData = {
|
||||
search_display: 'hidden',
|
||||
loadmore_display: data.count > 50 ? 'block' : 'hide',
|
||||
loadmore_display: data.count > count ? 'block' : 'hide',
|
||||
users: data.users,
|
||||
show_anon: 'hide'
|
||||
};
|
||||
|
||||
res.render('users', userData);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function getUsersAndCount(set, count, callback) {
|
||||
async.parallel({
|
||||
|
||||
@@ -758,11 +758,10 @@ var async = require('async'),
|
||||
});
|
||||
};
|
||||
|
||||
Groups.getLatestMemberPosts = function(groupName, max, uid, callback) {
|
||||
Groups.getLatestMemberPosts = function(groupSlug, max, uid, callback) {
|
||||
async.waterfall([
|
||||
function(next) {
|
||||
Groups.getMembers(groupName, next);
|
||||
},
|
||||
async.apply(Groups.getGroupNameByGroupSlug, groupSlug),
|
||||
Groups.getMembers,
|
||||
function(uids, next) {
|
||||
if (!Array.isArray(uids) || !uids.length) {
|
||||
return callback(null, []);
|
||||
|
||||
@@ -154,11 +154,9 @@ module.exports = function(Topics) {
|
||||
return callback();
|
||||
}
|
||||
tids = tids.filter(Boolean);
|
||||
|
||||
var now = Date.now();
|
||||
var scores = tids.map(function(tid) {
|
||||
return now;
|
||||
});
|
||||
if (!tids.length) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
async.parallel({
|
||||
topicScores: function(next) {
|
||||
@@ -180,6 +178,11 @@ module.exports = function(Topics) {
|
||||
return callback();
|
||||
}
|
||||
|
||||
var now = Date.now();
|
||||
var scores = tids.map(function(tid) {
|
||||
return now;
|
||||
});
|
||||
|
||||
async.parallel({
|
||||
markRead: function(next) {
|
||||
db.sortedSetAdd('uid:' + uid + ':tids_read', scores, tids, next);
|
||||
|
||||
@@ -688,11 +688,22 @@ Upgrade.upgrade = function(callback) {
|
||||
updatesMade = true;
|
||||
winston.info('[2015/01/19] Generating group slugs');
|
||||
|
||||
Groups.list({}, function(err, groups) {
|
||||
async.waterfall([
|
||||
async.apply(db.getSetMembers, 'groups'),
|
||||
function(groups, next) {
|
||||
async.filter(groups, function(groupName, next) {
|
||||
db.getObjectField('group:' + groupName, 'hidden', function(err, hidden) {
|
||||
next((err || parseInt(hidden, 10)) ? false : true);
|
||||
});
|
||||
}, function(groups) {
|
||||
next(null, groups);
|
||||
});
|
||||
}
|
||||
], function(err, groups) {
|
||||
var tasks = [];
|
||||
groups.forEach(function(groupObj) {
|
||||
tasks.push(async.apply(db.setObjectField, 'group:' + groupObj.name, 'slug', Utils.slugify(groupObj.name)));
|
||||
tasks.push(async.apply(db.setObjectField, 'groupslug:groupname', Utils.slugify(groupObj.name), groupObj.name));
|
||||
groups.forEach(function(groupName) {
|
||||
tasks.push(async.apply(db.setObjectField, 'group:' + groupName, 'slug', Utils.slugify(groupName)));
|
||||
tasks.push(async.apply(db.setObjectField, 'groupslug:groupname', Utils.slugify(groupName), groupName));
|
||||
});
|
||||
|
||||
// Administrator group
|
||||
|
||||
@@ -101,6 +101,7 @@ module.exports = function(User) {
|
||||
followTopicsOnCreate: data.followTopicsOnCreate,
|
||||
followTopicsOnReply: data.followTopicsOnReply,
|
||||
sendChatNotifications: data.sendChatNotifications,
|
||||
sendPostNotifications: data.sendPostNotifications,
|
||||
restrictChat: data.restrictChat,
|
||||
topicSearchEnabled: data.topicSearchEnabled
|
||||
}, next);
|
||||
|
||||
Reference in New Issue
Block a user