Simplify return statements
This commit is contained in:
parent
3f35d1062e
commit
86774fa5c1
|
@ -44,8 +44,7 @@ Discourse.UserInvitedController = Ember.ArrayController.extend({
|
|||
@property showSearch
|
||||
**/
|
||||
showSearch: function() {
|
||||
if (Em.isNone(this.get('searchTerm')) && this.get('model.length') === 0) { return false; }
|
||||
return true;
|
||||
return !(Em.isNone(this.get('searchTerm')) && this.get('model.length') === 0);
|
||||
}.property('searchTerm', 'model.length'),
|
||||
|
||||
/**
|
||||
|
|
|
@ -120,10 +120,10 @@ function parseTree(tree, path, insideCounts) {
|
|||
**/
|
||||
function invalidBoundary(args, prev) {
|
||||
|
||||
if (!args.wordBoundary && !args.spaceBoundary) { return; }
|
||||
if (!args.wordBoundary && !args.spaceBoundary) { return false; }
|
||||
|
||||
var last = prev[prev.length - 1];
|
||||
if (typeof last !== "string") { return; }
|
||||
if (typeof last !== "string") { return false; }
|
||||
|
||||
if (args.wordBoundary && (last.match(/(\w|\/)$/))) { return true; }
|
||||
if (args.spaceBoundary && (!last.match(/\s$/))) { return true; }
|
||||
|
@ -149,10 +149,9 @@ Discourse.Dialect = {
|
|||
cook: function(text, opts) {
|
||||
if (!initialized) { initializeDialects(); }
|
||||
dialect.options = opts;
|
||||
var tree = parser.toHTMLTree(text, 'Discourse'),
|
||||
html = parser.renderJsonML(parseTree(tree));
|
||||
var tree = parser.toHTMLTree(text, 'Discourse');
|
||||
|
||||
return html;
|
||||
return parser.renderJsonML(parseTree(tree));
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -237,7 +237,7 @@ relativeAgeMediumSpan = function(distance, leaveAgo) {
|
|||
|
||||
relativeAgeMedium = function(date, options){
|
||||
var displayDate, fiveDaysAgo, oneMinuteAgo, fullReadable, leaveAgo;
|
||||
var wrapInSpan = options.wrapInSpan === false ? false : true;
|
||||
var wrapInSpan = options.wrapInSpan !== false;
|
||||
|
||||
leaveAgo = options.leaveAgo;
|
||||
var distance = Math.round((new Date() - date) / 1000);
|
||||
|
|
|
@ -14,7 +14,7 @@ Discourse.Mobile = {
|
|||
this.mobileView = $html.hasClass('mobile-view');
|
||||
|
||||
if (localStorage && localStorage.mobileView) {
|
||||
var savedValue = (localStorage.mobileView === 'true' ? true : false);
|
||||
var savedValue = (localStorage.mobileView === 'true');
|
||||
if (savedValue !== this.mobileView) {
|
||||
this.reloadPage(savedValue);
|
||||
}
|
||||
|
|
|
@ -54,8 +54,7 @@ Discourse.UserSearch = {
|
|||
users.push(u);
|
||||
results.push(u);
|
||||
}
|
||||
if (results.length > limit) return false;
|
||||
return true;
|
||||
return results.length <= limit;
|
||||
});
|
||||
|
||||
_.each(r.groups,function(g) {
|
||||
|
|
|
@ -126,14 +126,10 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
// reply is always required
|
||||
if (this.get('missingReplyCharacters') > 0) return true;
|
||||
|
||||
if (this.get('canCategorize') &&
|
||||
return this.get('canCategorize') &&
|
||||
!Discourse.SiteSettings.allow_uncategorized_topics &&
|
||||
!this.get('categoryId') &&
|
||||
!Discourse.User.currentProp('staff')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
!Discourse.User.currentProp('staff');
|
||||
}.property('loading', 'canEditTitle', 'titleLength', 'targetUsernames', 'replyLength', 'categoryId', 'missingReplyCharacters'),
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,11 +103,10 @@ Discourse.Post = Discourse.Model.extend({
|
|||
}.property('updated_at'),
|
||||
|
||||
flagsAvailable: function() {
|
||||
var post = this,
|
||||
flags = Discourse.Site.currentProp('flagTypes').filter(function(item) {
|
||||
var post = this;
|
||||
return Discourse.Site.currentProp('flagTypes').filter(function(item) {
|
||||
return post.get("actionByName." + (item.get('name_key')) + ".can_act");
|
||||
});
|
||||
return flags;
|
||||
}.property('actions_summary.@each.can_act'),
|
||||
|
||||
actionsHistory: function() {
|
||||
|
|
|
@ -168,8 +168,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
if (!wordCount) return;
|
||||
|
||||
// Avg for 500 words per minute when you account for skimming
|
||||
var minutes = Math.floor(wordCount / 500.0);
|
||||
return minutes;
|
||||
return Math.floor(wordCount / 500.0);
|
||||
}.property('word_count'),
|
||||
|
||||
toggleStar: function() {
|
||||
|
|
Loading…
Reference in New Issue