Merge remote-tracking branch 'origin/master' into sortable-menu

v1.18.x
psychobunny
commit 40008a9e85

@ -29,6 +29,7 @@
"details.change_icon": "Change Icon",
"details.change_colour": "Change Colour",
"details.badge_text": "Badge Text",
"details.userTitleEnabled": "Show Badge",
"details.private_help": "If enabled, joining of groups requires approval from a group owner",
"details.hidden": "Hidden",
"details.hidden_help": "If enabled, this group will not be found in the groups listing, and users will have to be invited manually",

@ -6,6 +6,7 @@
"year": "Year",
"alltime": "All Time",
"no_recent_topics": "There are no recent topics.",
"no_popular_topics": "There are no popular topics.",
"there-is-a-new-topic": "There is a new topic.",
"there-is-a-new-topic-and-a-new-post": "There is a new topic and a new post.",

@ -88,7 +88,9 @@ define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker',
iconBtn = settingsFormEl.find('[data-action="icon-select"]'),
previewEl = settingsFormEl.find('.label'),
previewIcon = previewEl.find('i'),
previewValueEl = settingsFormEl.find('[name="icon"]');
userTitleEl = settingsFormEl.find('[name="userTitle"]'),
userTitleEnabledEl = settingsFormEl.find('[name="userTitleEnabled"]'),
iconValueEl = settingsFormEl.find('[name="icon"]');
// Add color picker to settings form
colorBtn.ColorPicker({
@ -105,9 +107,29 @@ define('forum/groups/details', ['iconSelect', 'vendor/colorpicker/colorpicker',
// Add icon selection interface
iconBtn.on('click', function() {
iconSelect.init(previewIcon, function() {
previewValueEl.val(previewIcon.val());
iconValueEl.val(previewIcon.val());
});
});
// If the user title changes, update that too
userTitleEl.on('keyup', function() {
var icon = previewIcon.detach();
previewEl.text(' ' + (this.value || settingsFormEl.find('#name').val()));
previewEl.prepend(icon);
});
// Disable user title customisation options if the the user title itself is disabled
userTitleEnabledEl.on('change', function() {
var customOpts = $('.user-title-option input, .user-title-option button');
if (this.checked) {
customOpts.removeAttr('disabled');
previewEl.removeClass('hide');
} else {
customOpts.attr('disabled', 'disabled');
previewEl.addClass('hide');
}
});
};
Details.update = function() {

@ -2,16 +2,12 @@
/* globals define, app, socket*/
define('forum/popular', ['forum/recent', 'forum/infinitescroll'], function(recent, infinitescroll) {
define('forum/popular', ['forum/recent'], function(recent) {
var Popular = {};
Popular.init = function() {
app.enterRoom('recent_posts');
$('#new-topics-alert').on('click', function() {
$(this).addClass('hide');
});
selectActivePill();
};
@ -26,10 +22,10 @@ define('forum/popular', ['forum/recent', 'forum/infinitescroll'], function(recen
return false;
}
});
};
}
function getActiveSection() {
parts = window.location.href.split('/');
var parts = window.location.href.split('/');
return parts[parts.length - 1];
}

@ -25,7 +25,7 @@ define('composer/resize', function() {
}
}
if (env === 'sm' || env === 'xs') {
if (env === 'sm' || env === 'xs' || window.innerHeight < 480) {
app.toggleNavbar(false);
postContainer.css('height', $(window).height());
}

@ -22,7 +22,9 @@ define('notifications', ['sounds'], function(sound) {
return app.alertError(err.message);
}
var notifs = data.unread.concat(data.read);
var notifs = data.unread.concat(data.read).sort(function(a, b) {
return parseInt(a.datetime, 10) > parseInt(b.datetime, 10) ? -1 : 1;
});
translator.toggleTimeagoShorthand();
for(var i=0; i<notifs.length; ++i) {

@ -135,7 +135,19 @@ var async = require('async'),
userObj.isOwner = isOwner;
next(null, userObj);
});
}, next);
}, function(err, users) {
if (err) {
return next();
}
next(null, users.sort(function(a, b) {
if (a.isOwner === b.isOwner) {
return 0;
} else {
return a.isOwner && !b.isOwner ? -1 : 1;
}
}));
});
}
], next);
} else {
@ -216,6 +228,7 @@ var async = require('async'),
results.base.description = validator.escape(results.base.description);
results.base.descriptionParsed = descriptionParsed;
results.base.userTitle = validator.escape(results.base.userTitle);
results.base.userTitleEnabled = results.base.userTitleEnabled ? !!parseInt(results.base.userTitleEnabled, 10) : true;
results.base.createtimeISO = utils.toISOString(results.base.createtime);
results.base.members = results.users.filter(Boolean);
results.base.pending = results.pending.filter(Boolean);
@ -525,6 +538,7 @@ var async = require('async'),
var payload = {
userTitle: values.userTitle || '',
userTitleEnabled: values.userTitleEnabled === true ? '1' : '0',
description: values.description || '',
icon: values.icon || '',
labelColor: values.labelColor || '#000000',
@ -879,6 +893,8 @@ var async = require('async'),
}
groupData = groupData.map(function(group) {
if (group) {
group.userTitle = validator.escape(group.userTitle) || validator.escape(group.name);
group.userTitleEnabled = group.userTitleEnabled ? parseInt(group.userTitleEnabled, 10) === 1 : true;
group.labelColor = group.labelColor || '#000000';
group.createtimeISO = utils.toISOString(group.createtime);
group.hidden = parseInt(group.hidden, 10) === 1;
@ -913,7 +929,7 @@ var async = require('async'),
}
groupData = groupData.filter(function(group) {
return group && parseInt(group.hidden, 10) !== 1 && !!group.userTitle;
return group && parseInt(group.hidden, 10) !== 1;
});
var groupSets = groupData.map(function(group) {

@ -89,20 +89,6 @@ var async = require('async'),
});
}
UserNotifications.getAll = function(uid, count, callback) {
getNotifications(uid, count, function(err, notifs) {
if (err) {
return callback(err);
}
notifs = notifs.unread.concat(notifs.read);
notifs = notifs.filter(Boolean).sort(function(a, b) {
return b.datetime - a.datetime;
});
callback(null, notifs);
});
};
UserNotifications.getNotifications = function(nids, uid, callback) {
notifications.getMultiple(nids, function(err, notifications) {
if (err) {

Loading…
Cancel
Save