Enable JSHINT's `unused` option. It caught a bunch of suspicious stuff which is fixed in this commit.
This commit is contained in:
parent
8685e4079f
commit
a502266c42
|
@ -50,7 +50,7 @@ Discourse.ScreenedIpAddressFormComponent = Ember.Component.extend({
|
|||
}
|
||||
},
|
||||
|
||||
didInsertElement: function(e) {
|
||||
didInsertElement: function() {
|
||||
var self = this;
|
||||
this._super();
|
||||
Em.run.schedule('afterRender', function() {
|
||||
|
|
|
@ -13,9 +13,8 @@ Discourse.AdminApiController = Ember.ArrayController.extend({
|
|||
Generates a master api key
|
||||
|
||||
@method generateMasterKey
|
||||
@param {Discourse.ApiKey} the key to regenerate
|
||||
**/
|
||||
generateMasterKey: function(key) {
|
||||
generateMasterKey: function() {
|
||||
var self = this;
|
||||
Discourse.ApiKey.generateMasterKey().then(function (key) {
|
||||
self.get('model').pushObject(key);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
Handlebars.registerHelper('valueAtTrustLevel', function(property, trustLevel) {
|
||||
var data = Ember.Handlebars.get(this, property);
|
||||
if( data ) {
|
||||
var item = data.find( function(d, i, arr) { return parseInt(d.x,10) === parseInt(trustLevel,10); } );
|
||||
var item = data.find( function(d) { return parseInt(d.x,10) === parseInt(trustLevel,10); } );
|
||||
if( item ) {
|
||||
return item.y;
|
||||
} else {
|
||||
|
|
|
@ -31,7 +31,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
**/
|
||||
revokeApiKey: function() {
|
||||
var self = this;
|
||||
return Discourse.ajax("/admin/users/" + this.get('id') + "/revoke_api_key", {type: 'DELETE'}).then(function (result) {
|
||||
return Discourse.ajax("/admin/users/" + this.get('id') + "/revoke_api_key", {type: 'DELETE'}).then(function () {
|
||||
self.set('api_key', null);
|
||||
});
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
"label": '<i class="fa fa-exclamation-triangle"></i> ' + I18n.t("admin.user.delete_all_posts"),
|
||||
"class": "btn btn-danger",
|
||||
"callback": function() {
|
||||
Discourse.ajax("/admin/users/" + (user.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(result){
|
||||
Discourse.ajax("/admin/users/" + (user.get('id')) + "/delete_all_posts", {type: 'PUT'}).then(function(){
|
||||
user.set('post_count', 0);
|
||||
});
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
user.mergeAttributes(data.user);
|
||||
}
|
||||
}
|
||||
}, function(jqXHR, status, error) {
|
||||
}, function() {
|
||||
Discourse.AdminUser.find( user.get('username') ).then(function(u){ user.mergeAttributes(u); });
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
});
|
||||
|
@ -325,7 +325,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
} else {
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
}
|
||||
}, function(jqXHR, status, error) {
|
||||
}, function() {
|
||||
bootbox.alert(I18n.t("admin.user.delete_failed"));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ Discourse.ApiKey = Discourse.Model.extend({
|
|||
@returns {Promise} a promise that resolves when the key has been revoked
|
||||
**/
|
||||
revoke: function() {
|
||||
var self = this;
|
||||
return Discourse.ajax('/admin/api/key', {type: 'DELETE', data: {id: this.get('id')}});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ Discourse.Group = Discourse.Model.extend({
|
|||
return Discourse.ajax("/admin/groups/" + group.get('id'), {type: "DELETE"})
|
||||
.then(function(){
|
||||
return true;
|
||||
}, function(error) {
|
||||
}, function() {
|
||||
group.set('disableSave', false);
|
||||
bootbox.alert(I18n.t("admin.groups.delete_failed"));
|
||||
return false;
|
||||
|
@ -108,15 +108,5 @@ Discourse.Group.reopenClass({
|
|||
});
|
||||
|
||||
return list;
|
||||
},
|
||||
|
||||
find: function(id) {
|
||||
var promise = new Em.Deferred();
|
||||
|
||||
setTimeout(function(){
|
||||
promise.resolve(Discourse.Group.create({id: 1, name: "all mods", members: ["A","b","c"]}));
|
||||
}, 1000);
|
||||
|
||||
return promise;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ Discourse.Report = Discourse.Model.extend({
|
|||
valueAt: function(numDaysAgo) {
|
||||
if (this.data) {
|
||||
var wantedDate = moment().subtract('days', numDaysAgo).format('YYYY-MM-DD');
|
||||
var item = this.data.find( function(d, i, arr) { return d.x === wantedDate; } );
|
||||
var item = this.data.find( function(d) { return d.x === wantedDate; } );
|
||||
if (item) {
|
||||
return item.y;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ Discourse.ScreenedEmail = Discourse.Model.extend({
|
|||
});
|
||||
|
||||
Discourse.ScreenedEmail.reopenClass({
|
||||
findAll: function(filter) {
|
||||
findAll: function() {
|
||||
return Discourse.ajax("/admin/logs/screened_emails.json").then(function(screened_emails) {
|
||||
return screened_emails.map(function(b) {
|
||||
return Discourse.ScreenedEmail.create(b);
|
||||
|
|
|
@ -45,7 +45,7 @@ Discourse.ScreenedIpAddress = Discourse.Model.extend({
|
|||
});
|
||||
|
||||
Discourse.ScreenedIpAddress.reopenClass({
|
||||
findAll: function(filter) {
|
||||
findAll: function() {
|
||||
return Discourse.ajax("/admin/logs/screened_ip_addresses.json").then(function(screened_ips) {
|
||||
return screened_ips.map(function(b) {
|
||||
return Discourse.ScreenedIpAddress.create(b);
|
||||
|
|
|
@ -13,7 +13,7 @@ Discourse.ScreenedUrl = Discourse.Model.extend({
|
|||
});
|
||||
|
||||
Discourse.ScreenedUrl.reopenClass({
|
||||
findAll: function(filter) {
|
||||
findAll: function() {
|
||||
return Discourse.ajax("/admin/logs/screened_urls.json").then(function(screened_urls) {
|
||||
return screened_urls.map(function(b) {
|
||||
return Discourse.ScreenedUrl.create(b);
|
||||
|
|
|
@ -12,7 +12,7 @@ Discourse.AdminSiteContentsRoute = Discourse.Route.extend({
|
|||
return Discourse.SiteContentType.findAll();
|
||||
},
|
||||
|
||||
renderTemplate: function(controller, model) {
|
||||
renderTemplate: function() {
|
||||
this.render('admin/templates/site_contents', {into: 'admin/templates/admin'});
|
||||
this.render('admin/templates/site_contents_empty', {into: 'admin/templates/site_contents'});
|
||||
},
|
||||
|
|
|
@ -42,7 +42,7 @@ Discourse.AceEditorView = Discourse.View.extend({
|
|||
aceEditorView.editor.setTheme("ace/theme/chrome");
|
||||
aceEditorView.editor.setShowPrintMargin(false);
|
||||
aceEditorView.editor.getSession().setMode("ace/mode/" + (aceEditorView.get('mode')));
|
||||
aceEditorView.editor.on("change", function(e) {
|
||||
aceEditorView.editor.on("change", function() {
|
||||
aceEditorView.skipContentChangeEvent = true;
|
||||
aceEditorView.set('content', aceEditorView.editor.getSession().getValue());
|
||||
aceEditorView.skipContentChangeEvent = false;
|
||||
|
|
|
@ -48,7 +48,7 @@ Discourse.EditTopicAutoCloseController = Discourse.ObjectController.extend(Disco
|
|||
} else {
|
||||
bootbox.alert(I18n.t('composer.auto_close_error'), function() { self.send('showModal'); } );
|
||||
}
|
||||
}, function (error) {
|
||||
}, function () {
|
||||
bootbox.alert(I18n.t('composer.auto_close_error'), function() { self.send('showModal'); } );
|
||||
});
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({
|
|||
},
|
||||
|
||||
// Show newly inserted topics
|
||||
showInserted: function(e) {
|
||||
showInserted: function() {
|
||||
var tracker = Discourse.TopicTrackingState.current();
|
||||
|
||||
// Move inserted into topics
|
||||
|
|
|
@ -61,7 +61,7 @@ Discourse.LoginController = Discourse.Controller.extend(Discourse.ModalFunctiona
|
|||
$hidden_login_form.submit();
|
||||
}
|
||||
|
||||
}, function(result) {
|
||||
}, function() {
|
||||
// Failed to login
|
||||
loginController.flash(I18n.t('login.error'), 'error');
|
||||
loginController.set('loggingIn', false);
|
||||
|
|
|
@ -183,7 +183,7 @@ Discourse.Dialect = {
|
|||
@param {Function} emitter A function that emits the JsonML for the replacement.
|
||||
**/
|
||||
inlineReplace: function(token, emitter) {
|
||||
this.registerInline(token, function(text, match, prev) {
|
||||
this.registerInline(token, function() {
|
||||
return [token.length, emitter.call(this, token)];
|
||||
});
|
||||
},
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
@for Handlebars
|
||||
**/
|
||||
Handlebars.registerHelper('breakUp', function(property, hint, options) {
|
||||
var prop, result, tokens;
|
||||
prop = Ember.Handlebars.get(this, property, options);
|
||||
var prop = Ember.Handlebars.get(this, property, options);
|
||||
if (!prop) return "";
|
||||
hint = Ember.Handlebars.get(this, hint, options);
|
||||
|
||||
|
@ -328,7 +327,7 @@ Handlebars.registerHelper('date', function(property, options) {
|
|||
@method customHTML
|
||||
@for Handlebars
|
||||
**/
|
||||
Handlebars.registerHelper('customHTML', function(property, options) {
|
||||
Handlebars.registerHelper('customHTML', function(property) {
|
||||
var html = PreloadStore.get("customHTML");
|
||||
|
||||
if (html && html[property] && html[property].length) {
|
||||
|
|
|
@ -31,7 +31,7 @@ Discourse.addInitializer(function() {
|
|||
// Observe file changes
|
||||
return Discourse.MessageBus.subscribe("/file-change", function(data) {
|
||||
Ember.TEMPLATES.empty = Handlebars.compile("<div></div>");
|
||||
_.each(data,function(me,idx) {
|
||||
_.each(data,function(me) {
|
||||
|
||||
if (me === "refresh") {
|
||||
// Refresh if necessary
|
||||
|
|
|
@ -141,7 +141,6 @@ $.fn.autocomplete = function(options) {
|
|||
|
||||
if (isInput) {
|
||||
var width = this.width();
|
||||
var height = this.height();
|
||||
wrap = this.wrap("<div class='ac-wrap clearfix" + (disabled ? " disabled": "") + "'/>").parent();
|
||||
wrap.width(width);
|
||||
if(options.single) {
|
||||
|
|
|
@ -32,7 +32,7 @@ $.fn.caretPosition = function(options) {
|
|||
span = $("#pos span");
|
||||
textarea = $(this);
|
||||
|
||||
getStyles = function(el, prop) {
|
||||
getStyles = function(el) {
|
||||
if (el.currentStyle) {
|
||||
return el.currentStyle;
|
||||
} else {
|
||||
|
|
|
@ -19,7 +19,6 @@ Discourse.Eyeline.prototype.update = function() {
|
|||
var docViewTop = $(window).scrollTop(),
|
||||
windowHeight = $(window).height(),
|
||||
docViewBottom = docViewTop + windowHeight,
|
||||
documentHeight = $(document).height(),
|
||||
$elements = $(this.selector),
|
||||
atBottom = false,
|
||||
foundElement = false,
|
||||
|
|
|
@ -151,7 +151,7 @@ Discourse.Formatter = (function(){
|
|||
};
|
||||
|
||||
|
||||
relativeAgeTiny = function(date, options){
|
||||
relativeAgeTiny = function(date){
|
||||
var format = "tiny";
|
||||
var distance = Math.round((new Date() - date) / 1000);
|
||||
var distanceInMinutes = Math.round(distance / 60.0);
|
||||
|
@ -226,7 +226,7 @@ Discourse.Formatter = (function(){
|
|||
};
|
||||
|
||||
relativeAgeMedium = function(date, options){
|
||||
var displayDate, fiveDaysAgo, oneMinuteAgo, fullReadable, leaveAgo, val;
|
||||
var displayDate, fiveDaysAgo, oneMinuteAgo, fullReadable, leaveAgo;
|
||||
var wrapInSpan = options.wrapInSpan === false ? false : true;
|
||||
|
||||
leaveAgo = options.leaveAgo;
|
||||
|
|
|
@ -9,7 +9,7 @@ Discourse.KeyValueStore = {
|
|||
initialized: false,
|
||||
context: "",
|
||||
|
||||
init: function(ctx, messageBus) {
|
||||
init: function(ctx) {
|
||||
this.initialized = true;
|
||||
this.context = ctx;
|
||||
},
|
||||
|
|
|
@ -15,8 +15,7 @@ Discourse.Lightbox = {
|
|||
|
||||
callbacks: {
|
||||
open: function() {
|
||||
var self = this,
|
||||
wrap = this.wrap,
|
||||
var wrap = this.wrap,
|
||||
img = this.currItem.img,
|
||||
maxHeight = img.css("max-height");
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ Discourse.ScreenTrack = Ember.Object.extend({
|
|||
var newTimings = {},
|
||||
totalTimings = this.get('totalTimings');
|
||||
|
||||
_.each(this.get('timings'), function(timing,key) {
|
||||
_.each(this.get('timings'), function(timing) {
|
||||
if (!totalTimings[timing.postNumber])
|
||||
totalTimings[timing.postNumber] = 0;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
**/
|
||||
Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, {
|
||||
|
||||
scrolled: function(e) {
|
||||
scrolled: function() {
|
||||
var eyeline = this.get('eyeline');
|
||||
if (eyeline) { eyeline.update(); }
|
||||
},
|
||||
|
|
|
@ -20,7 +20,7 @@ Discourse.Scrolling = Em.Mixin.create({
|
|||
opts = opts || {debounce: 100};
|
||||
|
||||
var self = this,
|
||||
onScrollMethod = function(e) {
|
||||
onScrollMethod = function() {
|
||||
return Em.run.scheduleOnce('afterRender', self, 'scrolled');
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ Discourse.Category = Discourse.Model.extend({
|
|||
return this.get('topic_count') > Discourse.SiteSettings.category_featured_topics;
|
||||
}.property('topic_count'),
|
||||
|
||||
save: function(args) {
|
||||
save: function() {
|
||||
var url = "/categories";
|
||||
if (this.get('id')) {
|
||||
url = "/categories/" + (this.get('id'));
|
||||
|
@ -81,7 +81,7 @@ Discourse.Category = Discourse.Model.extend({
|
|||
return rval;
|
||||
}.property("permissions"),
|
||||
|
||||
destroy: function(callback) {
|
||||
destroy: function() {
|
||||
return Discourse.ajax("/categories/" + (this.get('slug') || this.get('id')), { type: 'DELETE' });
|
||||
},
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
this.set('composeState', CLOSED);
|
||||
|
||||
return Ember.Deferred.promise(function(promise) {
|
||||
post.save(function(savedPost) {
|
||||
post.save(function() {
|
||||
composer.clearState();
|
||||
}, function(error) {
|
||||
var response = $.parseJSON(error.responseText);
|
||||
|
@ -486,8 +486,7 @@ Discourse.Composer = Discourse.Model.extend({
|
|||
|
||||
composer.set('composeState', SAVING);
|
||||
createdPost.save(function(result) {
|
||||
var addedPost = false,
|
||||
saving = true;
|
||||
var saving = true;
|
||||
|
||||
createdPost.updateFromJson(result);
|
||||
|
||||
|
|
|
@ -91,8 +91,7 @@ Discourse.Post = Discourse.Model.extend({
|
|||
}.property('read', 'topic.last_read_post_number', 'bookmarked'),
|
||||
|
||||
bookmarkedChanged: function() {
|
||||
var post = this;
|
||||
Discourse.ajax("/posts/" + (this.get('id')) + "/bookmark", {
|
||||
Discourse.ajax("/posts/" + this.get('id') + "/bookmark", {
|
||||
type: 'PUT',
|
||||
data: {
|
||||
bookmarked: this.get('bookmarked') ? true : false
|
||||
|
|
|
@ -306,9 +306,7 @@ Discourse.PostStream = Em.Object.extend({
|
|||
fillGapAfter: function(post, gap) {
|
||||
var postId = post.get('id'),
|
||||
stream = this.get('stream'),
|
||||
idx = stream.indexOf(postId),
|
||||
currentPosts = this.get('posts'),
|
||||
self = this;
|
||||
idx = stream.indexOf(postId);
|
||||
|
||||
if (idx !== -1) {
|
||||
stream.pushObjects(gap);
|
||||
|
@ -674,8 +672,7 @@ Discourse.PostStream = Em.Object.extend({
|
|||
|
||||
var url = "/t/" + this.get('topic.id') + "/posts.json",
|
||||
data = { post_ids: postIds },
|
||||
postStream = this,
|
||||
result = Em.A();
|
||||
postStream = this;
|
||||
|
||||
return Discourse.ajax(url, {data: data}).then(function(result) {
|
||||
var posts = Em.get(result, "post_stream.posts");
|
||||
|
|
|
@ -24,7 +24,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
return a !== 'regular' && a !== 'private_message';
|
||||
}.property('archetype'),
|
||||
|
||||
convertArchetype: function(archetype) {
|
||||
convertArchetype: function() {
|
||||
var a = this.get('archetype');
|
||||
if (a !== 'regular' && a !== 'private_message') {
|
||||
this.set('archetype', 'regular');
|
||||
|
@ -233,7 +233,7 @@ Discourse.Topic = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
// Recover this topic if deleted
|
||||
recover: function(deleted_by) {
|
||||
recover: function() {
|
||||
this.setProperties({
|
||||
deleted_at: null,
|
||||
deleted_by: null,
|
||||
|
@ -326,14 +326,13 @@ Discourse.Topic.reopenClass({
|
|||
|
||||
// Load a topic, but accepts a set of filters
|
||||
find: function(topicId, opts) {
|
||||
var data, promise, url;
|
||||
url = Discourse.getURL("/t/") + topicId;
|
||||
var url = Discourse.getURL("/t/") + topicId;
|
||||
|
||||
if (opts.nearPost) {
|
||||
url += "/" + opts.nearPost;
|
||||
}
|
||||
|
||||
data = {};
|
||||
var data = {};
|
||||
if (opts.postsAfter) {
|
||||
data.posts_after = opts.postsAfter;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ Discourse.TopicDetails = Discourse.Model.extend({
|
|||
Discourse.ajax("/t/" + this.get('topic.id') + "/remove-allowed-user", {
|
||||
type: 'PUT',
|
||||
data: { username: username }
|
||||
}).then(function(res) {
|
||||
}).then(function() {
|
||||
users.removeObject(users.findProperty('username', username));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -169,8 +169,7 @@ Discourse.TopicList.reopenClass({
|
|||
topicsFrom: function(result) {
|
||||
// Stitch together our side loaded data
|
||||
var categories = Discourse.Category.list(),
|
||||
users = this.extractByKey(result.users, Discourse.User),
|
||||
topics = Em.A();
|
||||
users = this.extractByKey(result.users, Discourse.User);
|
||||
|
||||
return result.topic_list.topics.map(function (t) {
|
||||
t.category = categories.findBy('id', t.category_id);
|
||||
|
|
|
@ -216,7 +216,7 @@ Ember.DiscourseLocation = Ember.Object.extend({
|
|||
var guid = Ember.guidFor(this),
|
||||
self = this;
|
||||
|
||||
Ember.$(window).on('popstate.ember-location-'+guid, function(e) {
|
||||
Ember.$(window).on('popstate.ember-location-'+guid, function() {
|
||||
// Ignore initial page load popstate event in Chrome
|
||||
if (!popstateFired) {
|
||||
popstateFired = true;
|
||||
|
|
|
@ -16,7 +16,7 @@ Discourse.Route = Em.Route.extend({
|
|||
|
||||
@method activate
|
||||
**/
|
||||
activate: function(router, context) {
|
||||
activate: function() {
|
||||
this._super();
|
||||
|
||||
// Close mini profiler
|
||||
|
|
|
@ -10,7 +10,7 @@ Discourse.UserTopicListRoute = Discourse.Route.extend({
|
|||
}
|
||||
});
|
||||
|
||||
function createPMRoute(viewName, path, type) {
|
||||
function createPMRoute(viewName, path) {
|
||||
return Discourse.UserTopicListRoute.extend({
|
||||
userActionType: Discourse.UserAction.TYPES.messages_received,
|
||||
|
||||
|
@ -18,7 +18,7 @@ function createPMRoute(viewName, path, type) {
|
|||
return Discourse.TopicList.find('topics/' + path + '/' + this.modelFor('user').get('username_lower'));
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
setupController: function() {
|
||||
this._super.apply(this, arguments);
|
||||
this.controllerFor('user').setProperties({
|
||||
pmView: viewName,
|
||||
|
|
|
@ -18,7 +18,7 @@ Discourse.ClearPinButton = Discourse.ButtonView.extend({
|
|||
return this.get('controller.pinned') ? null : 'hidden';
|
||||
}.property('controller.pinned'),
|
||||
|
||||
click: function(buffer) {
|
||||
click: function() {
|
||||
this.get('controller').send('clearPin');
|
||||
},
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ Discourse.DropdownButtonView = Discourse.View.extend({
|
|||
classNameBindings: [':btn-group', 'hidden'],
|
||||
shouldRerender: Discourse.View.renderIfChanged('text', 'longDescription'),
|
||||
|
||||
didInsertElement: function(e) {
|
||||
didInsertElement: function() {
|
||||
// If there's a click handler, call it
|
||||
if (this.clicked) {
|
||||
var dropDownButtonView = this;
|
||||
|
@ -22,7 +22,7 @@ Discourse.DropdownButtonView = Discourse.View.extend({
|
|||
}
|
||||
},
|
||||
|
||||
willDestroyElement: function(e) {
|
||||
willDestroyElement: function() {
|
||||
this.$('ul li').off('click.dropdown-button');
|
||||
},
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, {
|
|||
});
|
||||
}.observes('model.composeState'),
|
||||
|
||||
keyUp: function(e) {
|
||||
keyUp: function() {
|
||||
var controller = this.get('controller');
|
||||
controller.checkReplyLength();
|
||||
|
||||
|
@ -337,7 +337,7 @@ Discourse.ComposerView = Discourse.View.extend(Ember.Evented, {
|
|||
return result;
|
||||
},
|
||||
|
||||
childDidInsertElement: function(e) {
|
||||
childDidInsertElement: function() {
|
||||
return this.initEditor();
|
||||
},
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ Discourse.ListTopicsView = Discourse.View.extend(Discourse.LoadMore, {
|
|||
},
|
||||
|
||||
// When the topic list is scrolled
|
||||
scrolled: function(e) {
|
||||
scrolled: function() {
|
||||
this._super();
|
||||
this.saveScrollPosition();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({
|
|||
});
|
||||
|
||||
// when a file has been selected
|
||||
$upload.on("fileuploadadd", function (e, data) {
|
||||
$upload.on("fileuploadadd", function () {
|
||||
self.setProperties({
|
||||
uploading: true,
|
||||
imageIsNotASquare: false
|
||||
|
@ -81,7 +81,7 @@ Discourse.AvatarSelectorView = Discourse.ModalBodyView.extend({
|
|||
});
|
||||
|
||||
// when the upload is done
|
||||
$upload.on("fileuploadalways", function (e, data) {
|
||||
$upload.on("fileuploadalways", function () {
|
||||
self.setProperties({ uploading: false, uploadProgress: 0 });
|
||||
});
|
||||
},
|
||||
|
|
|
@ -11,7 +11,7 @@ Discourse.CreateAccountView = Discourse.ModalBodyView.extend({
|
|||
title: I18n.t('create_account.title'),
|
||||
classNames: ['create-account'],
|
||||
|
||||
didInsertElement: function(e) {
|
||||
didInsertElement: function() {
|
||||
|
||||
this._super();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
Discourse.HideModalView = Discourse.ModalBodyView.extend({
|
||||
|
||||
// No rendering!
|
||||
render: function(buffer) { },
|
||||
render: function() { },
|
||||
|
||||
didInsertElement: function() {
|
||||
$('#discourse-modal').modal('hide');
|
||||
|
|
|
@ -41,7 +41,7 @@ Discourse.LoginView = Discourse.ModalBodyView.extend({
|
|||
});
|
||||
},
|
||||
|
||||
didInsertElement: function(e) {
|
||||
didInsertElement: function() {
|
||||
|
||||
this._super();
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Discourse.PopupInputTipView = Discourse.View.extend({
|
|||
bouncePixels: 6,
|
||||
bounceDelay: 100,
|
||||
|
||||
click: function(e) {
|
||||
click: function() {
|
||||
this.set('shownAt', false);
|
||||
},
|
||||
|
||||
|
|
|
@ -56,10 +56,10 @@ Discourse.QuoteButtonView = Discourse.View.extend({
|
|||
view.selectText(e.target, controller);
|
||||
view.set('isMouseDown', false);
|
||||
})
|
||||
.on('touchstart.quote-button', function(e){
|
||||
.on('touchstart.quote-button', function(){
|
||||
view.set('isTouchInProgress', true);
|
||||
})
|
||||
.on('touchend.quote-button', function(e){
|
||||
.on('touchend.quote-button', function(){
|
||||
view.set('isTouchInProgress', false);
|
||||
})
|
||||
.on('selectionchange', function() {
|
||||
|
|
|
@ -71,7 +71,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
}
|
||||
}.observes('controller.enteredAt'),
|
||||
|
||||
didInsertElement: function(e) {
|
||||
didInsertElement: function() {
|
||||
this.bindScrolling({name: 'topic-view'});
|
||||
|
||||
var topicView = this;
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/*global Markdown:true*/
|
||||
|
||||
window.PagedownCustom = {
|
||||
insertButtons: [
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ regexp: false # true if . and [^...] should not be allowed in RegExp liter
|
|||
safe: false # true if the safe subset rules are enforced (used by ADsafe)
|
||||
strict: false # true if the ES5 "use strict"; pragma is required
|
||||
undef: true # true if variables must be declared before used
|
||||
unused: true
|
||||
white: false # true if strict whitespace rules apply (see also 'indent' option)
|
||||
eqnull: false
|
||||
onecase: true # allow for one case switches, can be more elegant sometimes
|
||||
|
|
|
@ -92,8 +92,7 @@ test("Select Replies when present", function() {
|
|||
tc = testController(Discourse.TopicController, topic),
|
||||
p1 = Discourse.Post.create({id: 1, post_number: 1, reply_count: 1}),
|
||||
p2 = Discourse.Post.create({id: 2, post_number: 2}),
|
||||
p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1}),
|
||||
postStream = tc.get('postStream');
|
||||
p3 = Discourse.Post.create({id: 2, post_number: 3, reply_to_post_number: 1});
|
||||
|
||||
ok(!tc.postSelected(p3), "replies are not selected by default");
|
||||
tc.send('toggledSelectedPostReplies', p1);
|
||||
|
|
|
@ -150,6 +150,7 @@ var jsHintOpts = {
|
|||
"plusplus": false,
|
||||
"regexp": false,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"sub": true,
|
||||
"strict": false,
|
||||
"white": false,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/*global md5:true */
|
||||
module("Discourse.BBCode");
|
||||
|
||||
var format = function(input, expected, text) {
|
||||
|
|
|
@ -28,10 +28,6 @@ var formatDays = function(days) {
|
|||
return formatHours(days * 24);
|
||||
};
|
||||
|
||||
var formatMonths = function(months) {
|
||||
return formatDays(months * 30);
|
||||
};
|
||||
|
||||
var shortDate = function(days){
|
||||
return moment().subtract('days', days).format('D MMM');
|
||||
};
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module("Discourse.HTML");
|
||||
|
||||
var html = Discourse.HTML;
|
||||
|
||||
test("categoryLink without a category", function() {
|
||||
blank(Discourse.HTML.categoryLink(), "it returns no HTML");
|
||||
});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/*global sanitizeHtml:true */
|
||||
|
||||
module("Discourse.Markdown", {
|
||||
setup: function() {
|
||||
Discourse.SiteSettings.traditional_markdown_linebreaks = false;
|
||||
|
@ -173,7 +171,7 @@ test("Quotes", function() {
|
|||
"handles quotes properly");
|
||||
|
||||
cookedOptions("1[quote=\"bob, post:1\"]my quote[/quote]2",
|
||||
{ topicId: 2, lookupAvatar: function(name) { } },
|
||||
{ topicId: 2, lookupAvatar: function() { } },
|
||||
"<p>1</p>\n\n<p><aside class=\"quote\" data-post=\"1\"><div class=\"title\"><div class=\"quote-controls\"></div>bob said:" +
|
||||
"</div><blockquote><p>my quote</p></blockquote></aside></p>\n\n<p>2</p>",
|
||||
"includes no avatar if none is found");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module("Discourse.SelectedPostsCount");
|
||||
|
||||
var buildTestObj = function(params, topicParams) {
|
||||
var buildTestObj = function(params) {
|
||||
return Ember.Object.createWithMixins(Discourse.SelectedPostsCount, params || {});
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module("Discourse.Composer");
|
||||
|
||||
test('replyLength', function() {
|
||||
var replyLength = function(val, expectedLength, text) {
|
||||
var replyLength = function(val, expectedLength) {
|
||||
var composer = Discourse.Composer.create({ reply: val });
|
||||
equal(composer.get('replyLength'), expectedLength);
|
||||
};
|
||||
|
|
|
@ -227,7 +227,7 @@ test("storePost", function() {
|
|||
test("identity map", function() {
|
||||
var postStream = buildStream(1234);
|
||||
var p1 = postStream.appendPost(Discourse.Post.create({id: 1, post_number: 1}));
|
||||
var p3 = postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4}));
|
||||
postStream.appendPost(Discourse.Post.create({id: 3, post_number: 4}));
|
||||
|
||||
equal(postStream.findLoadedPost(1), p1, "it can return cached posts by id");
|
||||
blank(postStream.findLoadedPost(4), "it can't find uncached posts");
|
||||
|
@ -403,7 +403,7 @@ test("comitting and triggerNewPostInStream race condition", function() {
|
|||
var user = Discourse.User.create({username: 'eviltrout', name: 'eviltrout', id: 321});
|
||||
var stagedPost = Discourse.Post.create({ raw: 'hello world this is my new post' });
|
||||
|
||||
var result = postStream.stagePost(stagedPost, user);
|
||||
postStream.stagePost(stagedPost, user);
|
||||
equal(postStream.get('filteredPostsCount'), 0, "it has no filteredPostsCount yet");
|
||||
stagedPost.set('id', 123);
|
||||
|
||||
|
|
Loading…
Reference in New Issue