From aee12fd6ef63b23ce67f1bbc0ca129645fdda9f7 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 30 Apr 2015 12:25:38 -0400 Subject: [PATCH] Ember Deprecations for Topics --- .../components/auto-close-form.js.es6 | 2 +- .../components/toggle-deleted.js.es6 | 8 -- .../controllers/edit-topic-auto-close.js.es6 | 22 ++--- .../controllers/feature-topic.js.es6 | 10 +-- .../controllers/topic-admin-menu.js.es6 | 4 +- .../controllers/topic-progress.js.es6 | 34 ++++---- .../discourse/controllers/topic.js.es6 | 81 ++++++++++--------- .../discourse/controllers/user-card.js.es6 | 4 +- .../discourse/lib/keyboard_shortcuts.js | 2 +- app/assets/javascripts/discourse/lib/url.js | 2 +- .../mixins/modal-functionality.js.es6 | 2 + .../discourse/mixins/string-buffer.js.es6 | 3 +- .../discourse/routes/discourse_location.js | 2 +- .../discourse/routes/topic-from-params.js.es6 | 2 +- .../javascripts/discourse/routes/topic.js.es6 | 2 +- .../templates/modal/edit-topic-auto-close.hbs | 6 +- .../templates/modal/feature-topic.hbs | 8 +- .../javascripts/discourse/templates/post.hbs | 16 ++-- ...{selected_posts.hbs => selected-posts.hbs} | 8 +- .../javascripts/discourse/templates/share.hbs | 2 +- .../discourse/templates/topic-admin-menu.hbs | 12 +-- .../discourse/templates/topic-progress.hbs | 2 +- .../javascripts/discourse/templates/topic.hbs | 48 +++++------ .../discourse/views/bookmark-button.js.es6 | 16 ++-- .../discourse/views/composer.js.es6 | 2 +- .../views/invite-reply-button.js.es6 | 2 +- .../discourse/views/selected-posts.js.es6 | 9 +++ .../discourse/views/selected_posts_view.js | 21 ----- .../javascripts/discourse/views/share.js.es6 | 14 ++-- .../discourse/views/topic-progress.js.es6 | 2 +- .../javascripts/discourse/views/topic.js.es6 | 5 +- .../tilt/es6_module_transpiler_template.rb | 2 +- .../initializers/extend-for-poll.js.es6 | 7 +- 33 files changed, 170 insertions(+), 192 deletions(-) rename app/assets/javascripts/discourse/templates/{selected_posts.hbs => selected-posts.hbs} (64%) create mode 100644 app/assets/javascripts/discourse/views/selected-posts.js.es6 delete mode 100644 app/assets/javascripts/discourse/views/selected_posts_view.js diff --git a/app/assets/javascripts/discourse/components/auto-close-form.js.es6 b/app/assets/javascripts/discourse/components/auto-close-form.js.es6 index f203799b22e..fdad14df537 100644 --- a/app/assets/javascripts/discourse/components/auto-close-form.js.es6 +++ b/app/assets/javascripts/discourse/components/auto-close-form.js.es6 @@ -20,7 +20,7 @@ export default Ember.Component.extend({ }.observes("autoCloseTime", "limited"), _isAutoCloseValid: function(autoCloseTime, limited) { - var t = (autoCloseTime || "").trim(); + var t = (autoCloseTime || "").toString().trim(); if (t.length === 0) { // "empty" is always valid return true; diff --git a/app/assets/javascripts/discourse/components/toggle-deleted.js.es6 b/app/assets/javascripts/discourse/components/toggle-deleted.js.es6 index a672696f780..72ad47d0045 100644 --- a/app/assets/javascripts/discourse/components/toggle-deleted.js.es6 +++ b/app/assets/javascripts/discourse/components/toggle-deleted.js.es6 @@ -1,11 +1,3 @@ -/** - The controls for toggling the supression of deleted posts - - @class ToggleDeletedComponent - @extends Ember.Component - @namespace Discourse - @module Discourse -**/ export default Ember.Component.extend({ layoutName: 'components/toggle-deleted', tagName: 'section', diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 index 559bb80e069..24319137dce 100644 --- a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 @@ -9,20 +9,20 @@ export default ObjectController.extend(ModalFunctionality, { setAutoCloseTime: function() { var autoCloseTime = null; - if (this.get("details.auto_close_based_on_last_post")) { - autoCloseTime = this.get("details.auto_close_hours"); - } else if (this.get("details.auto_close_at")) { - var closeTime = new Date(this.get("details.auto_close_at")); + if (this.get("model.details.auto_close_based_on_last_post")) { + autoCloseTime = this.get("model.details.auto_close_hours"); + } else if (this.get("model.details.auto_close_at")) { + var closeTime = new Date(this.get("model.details.auto_close_at")); if (closeTime > new Date()) { autoCloseTime = moment(closeTime).format("YYYY-MM-DD HH:mm"); } } - this.set("auto_close_time", autoCloseTime); - }.observes("details.{auto_close_at,auto_close_hours}"), + this.set("model.auto_close_time", autoCloseTime); + }.observes("model.details.{auto_close_at,auto_close_hours}"), actions: { - saveAutoClose: function() { this.setAutoClose(this.get("auto_close_time")); }, + saveAutoClose: function() { this.setAutoClose(this.get("model.auto_close_time")); }, removeAutoClose: function() { this.setAutoClose(null); } }, @@ -30,18 +30,18 @@ export default ObjectController.extend(ModalFunctionality, { var self = this; this.send('hideModal'); Discourse.ajax({ - url: '/t/' + this.get('id') + '/autoclose', + url: '/t/' + this.get('model.id') + '/autoclose', type: 'PUT', dataType: 'json', data: { auto_close_time: time, - auto_close_based_on_last_post: this.get("details.auto_close_based_on_last_post"), + auto_close_based_on_last_post: this.get("model.details.auto_close_based_on_last_post"), } }).then(function(result){ if (result.success) { self.send('closeModal'); - self.set('details.auto_close_at', result.auto_close_at); - self.set('details.auto_close_hours', result.auto_close_hours); + self.set('model.details.auto_close_at', result.auto_close_at); + self.set('model.details.auto_close_hours', result.auto_close_hours); } else { bootbox.alert(I18n.t('composer.auto_close.error'), function() { self.send('reopenModal'); } ); } diff --git a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 index a3eb9d56d19..a00c79a5b32 100644 --- a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 @@ -11,14 +11,14 @@ export default ObjectController.extend(ModalFunctionality, { bannerCount: 0, categoryLink: function() { - return categoryLinkHTML(this.get("category"), { allowUncategorized: true }); - }.property("category"), + return categoryLinkHTML(this.get("model.category"), { allowUncategorized: true }); + }.property("model.category"), unPinMessage: function() { - return this.get("pinned_globally") ? + return this.get("model.pinned_globally") ? I18n.t("topic.feature_topic.unpin_globally") : I18n.t("topic.feature_topic.unpin", { categoryLink: this.get("categoryLink") }); - }.property("categoryLink", "pinned_globally"), + }.property("categoryLink", "model.pinned_globally"), pinMessage: function() { return I18n.t("topic.feature_topic.pin", { categoryLink: this.get("categoryLink") }); @@ -32,7 +32,7 @@ export default ObjectController.extend(ModalFunctionality, { this.set("loading", true); return Discourse.ajax("/topics/feature_stats.json", { - data: { category_id: this.get("category.id") } + data: { category_id: this.get("model.category.id") } }).then(result => { if (result) { this.setProperties({ diff --git a/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 b/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 index c89caf04c1e..20bb123a0cc 100644 --- a/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 @@ -3,8 +3,8 @@ import ObjectController from 'discourse/controllers/object'; // This controller supports the admin menu on topics export default ObjectController.extend({ menuVisible: false, - showRecover: Em.computed.and('deleted', 'details.can_recover'), - isFeatured: Em.computed.or("pinned_at", "isBanner"), + showRecover: Em.computed.and('model.deleted', 'model.details.can_recover'), + isFeatured: Em.computed.or("model.pinned_at", "model.isBanner"), actions: { show: function() { this.set('menuVisible', true); }, diff --git a/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 b/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 index 1eef23fce36..ee844f4c6de 100644 --- a/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 @@ -24,11 +24,11 @@ export default Ember.ObjectController.extend({ if (isNaN(postIndex) || postIndex < 1) { postIndex = 1; } - if (postIndex > this.get('postStream.filteredPostsCount')) { - postIndex = this.get('postStream.filteredPostsCount'); + if (postIndex > this.get('model.postStream.filteredPostsCount')) { + postIndex = this.get('model.postStream.filteredPostsCount'); } this.set('toPostIndex', postIndex); - var stream = this.get('postStream'), + var stream = this.get('model.postStream'), postId = stream.findPostIdForPostNumber(postIndex); if (!postId) { @@ -65,36 +65,36 @@ export default Ember.ObjectController.extend({ }, streamPercentage: function() { - if (!this.get('postStream.loaded')) { return 0; } - if (this.get('postStream.highest_post_number') === 0) { return 0; } - var perc = this.get('progressPosition') / this.get('postStream.filteredPostsCount'); + if (!this.get('model.postStream.loaded')) { return 0; } + if (this.get('model.postStream.highest_post_number') === 0) { return 0; } + var perc = this.get('progressPosition') / this.get('model.postStream.filteredPostsCount'); return (perc > 1.0) ? 1.0 : perc; - }.property('postStream.loaded', 'progressPosition', 'postStream.filteredPostsCount'), + }.property('model.postStream.loaded', 'progressPosition', 'model.postStream.filteredPostsCount'), jumpTopDisabled: function() { return this.get('progressPosition') <= 3; }.property('progressPosition'), filteredPostCountChanged: function(){ - if(this.get('postStream.filteredPostsCount') < this.get('progressPosition')){ - this.set('progressPosition', this.get('postStream.filteredPostsCount')); + if(this.get('model.postStream.filteredPostsCount') < this.get('progressPosition')){ + this.set('progressPosition', this.get('model.postStream.filteredPostsCount')); } - }.observes('postStream.filteredPostsCount'), + }.observes('model.postStream.filteredPostsCount'), jumpBottomDisabled: function() { - return this.get('progressPosition') >= this.get('postStream.filteredPostsCount') || + return this.get('progressPosition') >= this.get('model.postStream.filteredPostsCount') || this.get('progressPosition') >= this.get('highest_post_number'); - }.property('postStream.filteredPostsCount', 'highest_post_number', 'progressPosition'), + }.property('model.postStream.filteredPostsCount', 'highest_post_number', 'progressPosition'), hideProgress: function() { - if (!this.get('postStream.loaded')) return true; - if (!this.get('currentPost')) return true; - if (this.get('postStream.filteredPostsCount') < 2) return true; + if (!this.get('model.postStream.loaded')) return true; + if (!this.get('model.currentPost')) return true; + if (this.get('model.postStream.filteredPostsCount') < 2) return true; return false; - }.property('postStream.loaded', 'currentPost', 'postStream.filteredPostsCount'), + }.property('model.postStream.loaded', 'model.currentPost', 'model.postStream.filteredPostsCount'), hugeNumberOfPosts: function() { - return (this.get('postStream.filteredPostsCount') >= Discourse.SiteSettings.short_progress_text_threshold); + return (this.get('model.postStream.filteredPostsCount') >= Discourse.SiteSettings.short_progress_text_threshold); }.property('highest_post_number'), jumpToBottomTitle: function() { diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 205c750075d..245b5d99730 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -12,6 +12,9 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon selectedReplies: null, queryParams: ['filter', 'username_filters', 'show_deleted'], searchHighlight: null, + loadedAllPosts: false, + enteredAt: null, + firstPostExpanded: false, maxTitleLength: Discourse.computed.setting('max_topic_title_length'), @@ -20,14 +23,14 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }.observes('topic'), _titleChanged: function() { - const title = this.get('title'); + const title = this.get('model.title'); if (!Ember.isEmpty(title)) { // Note normally you don't have to trigger this, but topic titles can be updated // and are sometimes lazily loaded. this.send('refreshTitle'); } - }.observes('title', 'category'), + }.observes('model.title', 'category'), termChanged: function() { const dropdown = this.get('controllers.header.visibleDropdown'); @@ -47,47 +50,47 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon // semantics of loaded all posts are slightly diff at topic level, // it just means that we "once" loaded all posts, this means we don't // keep re-rendering the suggested topics when new posts zoom in - let loaded = this.get('postStream.loadedAllPosts'); + let loaded = this.get('model.postStream.loadedAllPosts'); if (loaded) { - this.set('loadedTopicId', this.get('model.id')); + this.set('model.loadedTopicId', this.get('model.id')); } else { - loaded = this.get('loadedTopicId') === this.get('model.id'); + loaded = this.get('model.loadedTopicId') === this.get('model.id'); } this.set('loadedAllPosts', loaded); - }.observes('postStream', 'postStream.loadedAllPosts'), + }.observes('model.postStream', 'model.postStream.loadedAllPosts'), show_deleted: function(key, value) { - const postStream = this.get('postStream'); + const postStream = this.get('model.postStream'); if (!postStream) { return; } if (arguments.length > 1) { postStream.set('show_deleted', value); } return postStream.get('show_deleted') ? true : undefined; - }.property('postStream.summary'), + }.property('model.postStream.summary'), filter: function(key, value) { - const postStream = this.get('postStream'); + const postStream = this.get('model.postStream'); if (!postStream) { return; } if (arguments.length > 1) { postStream.set('summary', value === "summary"); } return postStream.get('summary') ? "summary" : undefined; - }.property('postStream.summary'), + }.property('model.postStream.summary'), username_filters: function(key, value) { - const postStream = this.get('postStream'); + const postStream = this.get('model.postStream'); if (!postStream) { return; } if (arguments.length > 1) { postStream.set('streamFilters.username_filters', value); } return postStream.get('streamFilters.username_filters'); - }.property('postStream.streamFilters.username_filters'), + }.property('model.postStream.streamFilters.username_filters'), _clearSelected: function() { this.set('selectedPosts', []); @@ -95,7 +98,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }.on('init'), _togglePinnedStates(property) { - const value = this.get('pinned_at') ? false : true, + const value = this.get('model.pinned_at') ? false : true, topic = this.get('content'); // optimistic update @@ -189,7 +192,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon 'class': 'btn-primary', callback() { Discourse.Post.deleteMany([post], [post]); - self.get('postStream.posts').forEach(function (p) { + self.get('model.postStream.posts').forEach(function (p) { if (p === post || p.get('reply_to_post_number') === post.get('post_number')) { p.setDeletedState(user); } @@ -246,7 +249,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }, selectAll() { - const posts = this.get('postStream.posts'), + const posts = this.get('model.postStream.posts'), selectedPosts = this.get('selectedPosts'); if (posts) { selectedPosts.addObjects(posts); @@ -261,11 +264,11 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }, toggleParticipant(user) { - this.get('postStream').toggleParticipant(Em.get(user, 'username')); + this.get('model.postStream').toggleParticipant(Em.get(user, 'username')); }, editTopic() { - if (!this.get('details.can_edit')) return false; + if (!this.get('model.details.can_edit')) return false; this.set('editingTopic', true); return false; @@ -326,7 +329,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon const selectedPosts = self.get('selectedPosts'), selectedReplies = self.get('selectedReplies'), - postStream = self.get('postStream'), + postStream = self.get('model.postStream'), toRemove = []; Discourse.Post.deleteMany(selectedPosts, selectedReplies); @@ -365,7 +368,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }, togglePinned() { - const value = this.get('pinned_at') ? false : true, + const value = this.get('model.pinned_at') ? false : true, topic = this.get('content'); // optimistic update @@ -403,7 +406,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }, togglePinnedForUser() { - if (this.get('pinned_at')) { + if (this.get('model.pinned_at')) { if (this.get('pinned')) { this.get('content').clearPin(); } else { @@ -428,7 +431,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon return Em.isEmpty(quotedText) ? Discourse.Post.loadQuote(post.get('id')) : quotedText; }).then(function(q) { const postUrl = "" + location.protocol + "//" + location.host + post.get('url'), - postLink = "[" + Handlebars.escapeExpression(self.get('title')) + "](" + postUrl + ")"; + postLink = "[" + Handlebars.escapeExpression(self.get('model.title')) + "](" + postUrl + ")"; composerController.appendText(I18n.t("post.continue_discussion", { postLink: postLink }) + "\n\n" + q); }); }, @@ -448,7 +451,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon retryLoading() { const self = this; self.set('retrying', true); - this.get('postStream').refresh().then(function() { + this.get('model.postStream').refresh().then(function() { self.set('retrying', false); }, function() { self.set('retrying', false); @@ -491,12 +494,12 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }.property(), canMergeTopic: function() { - if (!this.get('details.can_move_posts')) return false; + if (!this.get('model.details.can_move_posts')) return false; return (this.get('selectedPostsCount') > 0); }.property('selectedPostsCount'), canSplitTopic: function() { - if (!this.get('details.can_move_posts')) return false; + if (!this.get('model.details.can_move_posts')) return false; if (this.get('allPostsSelected')) return false; return (this.get('selectedPostsCount') > 0); }.property('selectedPostsCount'), @@ -586,16 +589,16 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon this.unsubscribe(); const self = this; - this.messageBus.subscribe("/topic/" + this.get('id'), function(data) { + this.messageBus.subscribe("/topic/" + this.get('model.id'), function(data) { const topic = self.get('model'); if (data.notification_level_change) { - topic.set('details.notification_level', data.notification_level_change); - topic.set('details.notifications_reason_id', data.notifications_reason_id); + topic.set('model.details.notification_level', data.notification_level_change); + topic.set('model.details.notifications_reason_id', data.notifications_reason_id); return; } - const postStream = self.get('postStream'); + const postStream = self.get('model.postStream'); switch (data.type) { case "revised": case "acted": @@ -654,16 +657,16 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon // If our current post is changed, notify the router _currentPostChanged: function() { - const currentPost = this.get('currentPost'); + const currentPost = this.get('model.currentPost'); if (currentPost) { this.send('postChangedRoute', currentPost); } - }.observes('currentPost'), + }.observes('model.currentPost'), readPosts(topicId, postNumbers) { - const postStream = this.get('postStream'); + const postStream = this.get('model.postStream'); - if(this.get('postStream.topic.id') === topicId){ + if(this.get('model.postStream.topic.id') === topicId){ _.each(postStream.get('posts'), function(post){ // optimise heavy loop // TODO identity map for postNumber @@ -673,8 +676,8 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }); const max = _.max(postNumbers); - if(max > this.get('last_read_post_number')){ - this.set('last_read_post_number', max); + if(max > this.get('model.last_read_post_number')){ + this.set('model.sast_read_post_number', max); } } }, @@ -683,10 +686,10 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon topVisibleChanged(post) { if (!post) { return; } - const postStream = this.get('postStream'), + const postStream = this.get('model.postStream'), firstLoadedPost = postStream.get('firstLoadedPost'); - this.set('currentPost', post.get('post_number')); + this.set('model.currentPost', post.get('post_number')); if (post.get('post_number') === 1) { return; } @@ -721,7 +724,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon bottomVisibleChanged(post) { if (!post) { return; } - const postStream = this.get('postStream'), + const postStream = this.get('model.postStream'), lastLoadedPost = postStream.get('lastLoadedPost'); this.set('controllers.topic-progress.progressPosition', postStream.progressIndexOfPost(post)); @@ -732,7 +735,7 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, BufferedCon }, _showFooter: function() { - this.set("controllers.application.showFooter", this.get("postStream.loadedAllPosts")); - }.observes("postStream.loadedAllPosts") + this.set("controllers.application.showFooter", this.get("model.postStream.loadedAllPosts")); + }.observes("model.postStream.loadedAllPosts") }); diff --git a/app/assets/javascripts/discourse/controllers/user-card.js.es6 b/app/assets/javascripts/discourse/controllers/user-card.js.es6 index 74fcda0630b..8534bfdd3b8 100644 --- a/app/assets/javascripts/discourse/controllers/user-card.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-card.js.es6 @@ -11,7 +11,7 @@ export default Ember.Controller.extend({ // If inside a topic topicPostCount: null, - postStream: Em.computed.alias('controllers.topic.postStream'), + postStream: Em.computed.alias('controllers.topic.model.postStream'), enoughPostsForFiltering: Em.computed.gte('topicPostCount', 2), viewingTopic: Em.computed.match('controllers.application.currentPath', /^topic\./), viewingAdmin: Em.computed.match('controllers.application.currentPath', /^admin\./), @@ -45,7 +45,7 @@ export default Ember.Controller.extend({ const currentUsername = this.get('username'), wasVisible = this.get('visible'), - post = this.get('viewingTopic') && postId ? this.get('controllers.topic.postStream').findLoadedPost(postId) : null; + post = this.get('viewingTopic') && postId ? this.get('postStream').findLoadedPost(postId) : null; this.setProperties({ avatar: null, post: post, username: username }); diff --git a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js index 893f34b98c3..16ce57a554e 100644 --- a/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js +++ b/app/assets/javascripts/discourse/lib/keyboard_shortcuts.js @@ -196,7 +196,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({ var selectedPostId = parseInt($('.topic-post.selected article.boxed').data('post-id'), 10); if (selectedPostId) { var topicController = container.lookup('controller:topic'), - post = topicController.get('postStream.posts').findBy('id', selectedPostId); + post = topicController.get('model.postStream.posts').findBy('id', selectedPostId); if (post) { topicController.send(action, post); } diff --git a/app/assets/javascripts/discourse/lib/url.js b/app/assets/javascripts/discourse/lib/url.js index 7c58c1be803..70a04a71159 100644 --- a/app/assets/javascripts/discourse/lib/url.js +++ b/app/assets/javascripts/discourse/lib/url.js @@ -221,7 +221,7 @@ Discourse.URL = Ember.Object.createWithMixins({ var container = Discourse.__container__, topicController = container.lookup('controller:topic'), opts = {}, - postStream = topicController.get('postStream'); + postStream = topicController.get('model.postStream'); if (newMatches[3]) opts.nearPost = newMatches[3]; if (path.match(/last$/)) { opts.nearPost = topicController.get('highest_post_number'); } diff --git a/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 b/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 index 83b0bce41c3..e73b685d4e4 100644 --- a/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 +++ b/app/assets/javascripts/discourse/mixins/modal-functionality.js.es6 @@ -1,4 +1,6 @@ export default Em.Mixin.create({ + flashMessage: null, + needs: ['modal'], flash: function(message, messageClass) { diff --git a/app/assets/javascripts/discourse/mixins/string-buffer.js.es6 b/app/assets/javascripts/discourse/mixins/string-buffer.js.es6 index ebc293fa9e9..ee40bf5ec06 100644 --- a/app/assets/javascripts/discourse/mixins/string-buffer.js.es6 +++ b/app/assets/javascripts/discourse/mixins/string-buffer.js.es6 @@ -20,10 +20,11 @@ export default Ember.Mixin.create({ _rerenderString() { const $sel = this.$(); - if ($sel) { return; } + if (!$sel) { return; } const buffer = []; this.renderString(buffer); + $sel.html(buffer.join('')); }, diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js index 22fcc3c80cf..40377a5d0ed 100644 --- a/app/assets/javascripts/discourse/routes/discourse_location.js +++ b/app/assets/javascripts/discourse/routes/discourse_location.js @@ -241,7 +241,7 @@ Ember.CloakedCollectionView.reopen({ // topic_route deactivate $('.posts,#topic-title').hide(); self.cleanUp(); - self.set('controller.postStream.loaded', false); + self.set('controller.model.postStream.loaded', false); }; this.set('_callback', cb); popstateCallbacks.addObject(cb); diff --git a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 index b8f43a433d4..040b4bb5f02 100644 --- a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 @@ -30,7 +30,7 @@ export default Discourse.Route.extend({ progress = postStream.progressIndexOfPost(closestPost); topicController.setProperties({ - currentPost: closest, + 'model.currentPost': closest, enteredAt: new Date().getTime().toString(), }); diff --git a/app/assets/javascripts/discourse/routes/topic.js.es6 b/app/assets/javascripts/discourse/routes/topic.js.es6 index 381692afea1..61f660991a7 100644 --- a/app/assets/javascripts/discourse/routes/topic.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic.js.es6 @@ -182,7 +182,7 @@ const TopicRoute = Discourse.Route.extend(ShowFooter, { this.controllerFor('user-card').set('visible', false); const topicController = this.controllerFor('topic'), - postStream = topicController.get('postStream'); + postStream = topicController.get('model.postStream'); postStream.cancelFilter(); topicController.set('multiSelect', false); diff --git a/app/assets/javascripts/discourse/templates/modal/edit-topic-auto-close.hbs b/app/assets/javascripts/discourse/templates/modal/edit-topic-auto-close.hbs index 8c0cd9e64e2..4ad1e97e4b5 100644 --- a/app/assets/javascripts/discourse/templates/modal/edit-topic-auto-close.hbs +++ b/app/assets/javascripts/discourse/templates/modal/edit-topic-auto-close.hbs @@ -1,9 +1,9 @@