mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 13:09:18 +08:00
Upgrade Ember.js, fix swallowing of template errors, report unresolved promises in development mode.
This commit is contained in:
parent
79f1055164
commit
48bfcfadd9
4
Gemfile
4
Gemfile
|
@ -64,8 +64,8 @@ gem 'html_truncator'
|
|||
# we had issues with latest, stick to the rev till we figure this out
|
||||
# PR that makes it all hang together welcome
|
||||
gem 'ember-rails'
|
||||
gem 'ember-source', '1.0.0.rc6.2'
|
||||
gem 'handlebars-source', '1.0.12'
|
||||
gem 'ember-source', '~> 1.2.0.1'
|
||||
gem 'handlebars-source', '~> 1.1.2'
|
||||
gem 'barber'
|
||||
|
||||
gem 'vestal_versions', git: 'https://github.com/SamSaffron/vestal_versions'
|
||||
|
|
|
@ -160,16 +160,17 @@ GEM
|
|||
diffy (3.0.1)
|
||||
ember-data-source (0.14)
|
||||
ember-source
|
||||
ember-rails (0.13.0)
|
||||
ember-rails (0.14.1)
|
||||
active_model_serializers
|
||||
barber (>= 0.4.1)
|
||||
ember-data-source
|
||||
ember-source
|
||||
execjs (>= 1.2)
|
||||
handlebars-source
|
||||
jquery-rails (>= 1.0.17)
|
||||
railties (>= 3.1)
|
||||
ember-source (1.0.0.rc6.2)
|
||||
handlebars-source (= 1.0.12)
|
||||
ember-source (1.2.0.1)
|
||||
handlebars-source (~> 1.1.2)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.3)
|
||||
excon (0.28.0)
|
||||
|
@ -202,7 +203,7 @@ GEM
|
|||
fspath (2.0.5)
|
||||
given_core (3.1.1)
|
||||
sorcerer (>= 0.3.7)
|
||||
handlebars-source (1.0.12)
|
||||
handlebars-source (1.1.2)
|
||||
hashie (2.0.5)
|
||||
highline (1.6.20)
|
||||
hike (1.2.3)
|
||||
|
@ -221,6 +222,9 @@ GEM
|
|||
image_size (1.1.3)
|
||||
image_sorcery (1.1.0)
|
||||
in_threads (1.2.0)
|
||||
jquery-rails (3.0.4)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.1)
|
||||
jwt (0.1.8)
|
||||
multi_json (>= 1.5)
|
||||
|
@ -471,7 +475,7 @@ DEPENDENCIES
|
|||
discourse_plugin!
|
||||
email_reply_parser!
|
||||
ember-rails
|
||||
ember-source (= 1.0.0.rc6.2)
|
||||
ember-source (~> 1.2.0.1)
|
||||
eventmachine
|
||||
fabrication
|
||||
fakeweb (~> 1.3.0)
|
||||
|
@ -481,7 +485,7 @@ DEPENDENCIES
|
|||
fastimage
|
||||
flamegraph!
|
||||
fog (= 1.18.0)
|
||||
handlebars-source (= 1.0.12)
|
||||
handlebars-source (~> 1.1.2)
|
||||
highline
|
||||
hiredis
|
||||
html_truncator
|
||||
|
|
|
@ -283,8 +283,7 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
|||
} else {
|
||||
opts.tested = true;
|
||||
if (!opts.ignoreIfChanged) {
|
||||
this.cancelComposer().then(function() { self.open(opts); },
|
||||
function() { return promise.reject(); });
|
||||
this.cancelComposer().then(function() { self.open(opts); }).fail(function() { return promise.reject(); });
|
||||
}
|
||||
return promise;
|
||||
}
|
||||
|
@ -341,10 +340,8 @@ Discourse.ComposerController = Discourse.Controller.extend({
|
|||
self.destroyDraft();
|
||||
self.get('model').clearState();
|
||||
self.close();
|
||||
promise.resolve();
|
||||
} else {
|
||||
promise.reject();
|
||||
}
|
||||
promise.resolve();
|
||||
});
|
||||
} else {
|
||||
// it is possible there is some sort of crazy draft with no body ... just give up on it
|
||||
|
|
|
@ -284,10 +284,10 @@ Discourse.PostStream = Em.Object.extend({
|
|||
var self = this;
|
||||
|
||||
// Make sure we can append more posts
|
||||
if (!self.get('canAppendMore')) { return Ember.RSVP.reject(); }
|
||||
if (!self.get('canAppendMore')) { return Ember.RSVP.resolve(); }
|
||||
|
||||
var postIds = self.get('nextWindow');
|
||||
if (Ember.isEmpty(postIds)) { return Ember.RSVP.reject(); }
|
||||
if (Ember.isEmpty(postIds)) { return Ember.RSVP.resolve(); }
|
||||
|
||||
self.set('loadingBelow', true);
|
||||
|
||||
|
@ -310,14 +310,13 @@ Discourse.PostStream = Em.Object.extend({
|
|||
@returns {Ember.Deferred} a promise that's resolved when the posts have been added.
|
||||
**/
|
||||
prependMore: function() {
|
||||
var postStream = this,
|
||||
rejectedPromise = Ember.RSVP.reject();
|
||||
var postStream = this;
|
||||
|
||||
// Make sure we can append more posts
|
||||
if (!postStream.get('canPrependMore')) { return rejectedPromise; }
|
||||
if (!postStream.get('canPrependMore')) { return Ember.RSVP.resolve(); }
|
||||
|
||||
var postIds = postStream.get('previousWindow');
|
||||
if (Ember.isEmpty(postIds)) { return rejectedPromise; }
|
||||
if (Ember.isEmpty(postIds)) { return Ember.RSVP.resolve(); }
|
||||
|
||||
postStream.set('loadingAbove', true);
|
||||
return postStream.findPostsByIds(postIds.reverse()).then(function(posts) {
|
||||
|
|
|
@ -355,7 +355,7 @@ Discourse.Topic.reopenClass({
|
|||
data: {destination_topic_id: destinationTopicId}
|
||||
}).then(function (result) {
|
||||
if (result.success) return result;
|
||||
promise.reject();
|
||||
promise.reject(new Error("error merging topic"));
|
||||
});
|
||||
return promise;
|
||||
},
|
||||
|
@ -366,7 +366,7 @@ Discourse.Topic.reopenClass({
|
|||
data: opts
|
||||
}).then(function (result) {
|
||||
if (result.success) return result;
|
||||
promise.reject();
|
||||
promise.reject(new Error("error moving posts topic"));
|
||||
});
|
||||
return promise;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.TopicFromParamsRoute = Discourse.Route.extend({
|
||||
abc: 'asdfasdf',
|
||||
|
||||
setupController: function(controller, params) {
|
||||
params = params || {};
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
@module Discourse
|
||||
**/
|
||||
Discourse.TopicRoute = Discourse.Route.extend({
|
||||
abc: 'def',
|
||||
|
||||
redirect: function() { Discourse.redirectIfLoginRequired(this); },
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -11,6 +11,24 @@
|
|||
})();
|
||||
</script>
|
||||
|
||||
<% if Rails.env.development? %>
|
||||
<script>
|
||||
// Don't swallow promises in development mode. Let's fix those.
|
||||
Ember.RSVP.configure('onerror', function(e) {
|
||||
if (e) {
|
||||
if (e.message || e.stack) {
|
||||
console.log(e.message);
|
||||
console.log(e.stack);
|
||||
} else {
|
||||
console.log("Uncaught promise: " + e.toString());
|
||||
}
|
||||
} else {
|
||||
console.log("A promise failed but was not caught.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
Discourse.CDN = '<%= Rails.configuration.action_controller.asset_host %>';
|
||||
Discourse.BaseUrl = '<%= RailsMultisite::ConnectionManagement.current_hostname %>';
|
||||
|
|
|
@ -1,52 +1,49 @@
|
|||
var view, oldMobileView;
|
||||
|
||||
var View = Ember.View.extend({
|
||||
template: Ember.Handlebars.compile("{{home-logo minimized=view.minimized}}")
|
||||
});
|
||||
var smallLogoUrl = "/assets/logo-single.png",
|
||||
bigLogoUrl = "/assets/logo.png",
|
||||
smallLogoSelector = "img.logo-small",
|
||||
bigLogoSelector = "img#site-logo.logo-big",
|
||||
homeIconSelector = "i.icon-home",
|
||||
headerSelector = "h2#site-text-logo.text-logo";
|
||||
|
||||
|
||||
var setSmallLogoUrl = function(url) {
|
||||
function setSmallLogoUrl(url) {
|
||||
Discourse.SiteSettings.logo_small_url = url;
|
||||
};
|
||||
}
|
||||
|
||||
var setBigLogoUrl = function(url) {
|
||||
function setBigLogoUrl(url) {
|
||||
Discourse.SiteSettings.logo_url = url;
|
||||
};
|
||||
}
|
||||
|
||||
var setTitle = function(title) {
|
||||
function setTitle(title) {
|
||||
Discourse.SiteSettings.title = title;
|
||||
};
|
||||
}
|
||||
|
||||
var setMobileView = function(value) {
|
||||
function setMobileView(value) {
|
||||
Discourse.Mobile.mobileView = value;
|
||||
};
|
||||
}
|
||||
|
||||
var setMinimized = function(value) {
|
||||
var view;
|
||||
function setMinimized(value) {
|
||||
Ember.run(function() {
|
||||
view.set("minimized", value);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var smallLogoUrl = "/assets/logo-single.png";
|
||||
var bigLogoUrl = "/assets/logo.png";
|
||||
var smallLogoSelector = "img.logo-small";
|
||||
var bigLogoSelector = "img#site-logo.logo-big";
|
||||
var homeIconSelector = "i.icon-home";
|
||||
var headerSelector = "h2#site-text-logo.text-logo";
|
||||
|
||||
|
||||
var appendView = function() {
|
||||
function appendView() {
|
||||
Ember.run(function() {
|
||||
view.appendTo(fixture());
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var oldMobileView;
|
||||
module("Discourse.HomeLogoComponent", {
|
||||
setup: function() {
|
||||
oldMobileView = Discourse.Mobile.mobileView;
|
||||
view = View.create();
|
||||
|
||||
view = Ember.View.create({
|
||||
container: Discourse.__container__,
|
||||
template: Ember.Handlebars.compile("{{home-logo minimized=view.minimized}}")
|
||||
});
|
||||
},
|
||||
|
||||
teardown: function() {
|
7077
vendor/assets/javascripts/development/ember.js
vendored
7077
vendor/assets/javascripts/development/ember.js
vendored
File diff suppressed because it is too large
Load Diff
|
@ -77,6 +77,10 @@ if ((typeof console !== 'undefined') && console.groupCollapsed && !window.QUnit)
|
|||
|
||||
after: function(name, timestamp, payload, profileNode) {
|
||||
|
||||
if (payload.exception) {
|
||||
throw payload.exception;
|
||||
}
|
||||
|
||||
var parent = profileNode.parent;
|
||||
profileNode.time = (timestamp - profileNode.start);
|
||||
this.depth = profileNode.parent;
|
||||
|
|
4593
vendor/assets/javascripts/handlebars.js
vendored
4593
vendor/assets/javascripts/handlebars.js
vendored
File diff suppressed because it is too large
Load Diff
6689
vendor/assets/javascripts/production/ember.js
vendored
6689
vendor/assets/javascripts/production/ember.js
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user