From 02a968bd27c32a7413fdb63f696abfcecd6e018e Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 11 Aug 2015 12:27:07 -0400 Subject: [PATCH] Remove ObjectController, Discouse Controllers + Presence --- .jshintrc | 2 -- .../admin/controllers/admin-backups.js.es6 | 2 +- .../controllers/admin-badges-show.js.es6 | 2 +- .../controllers/admin-email-index.js.es6 | 4 +-- .../admin-email-preview-digest.js.es6 | 4 +-- .../admin/controllers/admin-email-sent.js.es6 | 3 +-- .../controllers/admin-email-skipped.js.es6 | 3 +-- .../admin/controllers/admin-group.js.es6 | 2 +- .../admin-log-screened-ip-address.js.es6 | 2 +- .../admin/controllers/admin-reports.js.es6 | 2 +- .../admin-site-settings-category.js.es6 | 2 +- .../controllers/admin-site-settings.js.es6 | 5 ++-- .../admin/controllers/admin-user-index.js.es6 | 3 +-- .../admin/controllers/admin-user.js.es6 | 4 +-- .../admin/controllers/admin.js.es6 | 4 +-- .../modals/admin-agree-flag.js.es6 | 3 +-- .../modals/admin-delete-flag.js.es6 | 4 +-- .../admin-staff-action-log-details.js.es6 | 4 +-- .../modals/admin-start-backup.js.es6 | 3 +-- .../modals/admin-suspend-user.js.es6 | 3 +-- .../change-site-customization-details.js.es6 | 3 +-- .../javascripts/admin/models/flagged_post.js | 2 +- .../admin/views/admin-backups-logs.js.es6 | 2 +- .../admin/views/admin-backups.js.es6 | 2 +- .../admin/views/admin-flags-list.js.es6 | 2 +- .../javascripts/admin/views/admin.js.es6 | 2 +- .../views/admin_customize_colors_view.js | 10 +------ .../admin/views/admin_user_view.js | 11 +------- app/assets/javascripts/discourse.js | 6 +++++ .../controllers/avatar-selector.js.es6 | 3 +-- .../discourse/controllers/badges/show.js.es6 | 4 +-- .../discourse/controllers/change-owner.js.es6 | 5 ++-- .../discourse/controllers/composer.js.es6 | 5 ++-- .../discourse/controllers/controller.js.es6 | 3 --- .../controllers/create-account.js.es6 | 23 ++++++++-------- .../controllers/discovery-sortable.js.es6 | 4 +-- .../discourse/controllers/discovery.js.es6 | 2 +- .../controllers/edit-category.js.es6 | 5 ++-- .../controllers/edit-topic-auto-close.js.es6 | 3 +-- .../discourse/controllers/exception.js.es6 | 4 +-- .../controllers/feature-topic.js.es6 | 3 +-- .../controllers/flag-action-type.js.es6 | 3 +-- .../discourse/controllers/flag.js.es6 | 3 +-- .../controllers/forgot-password.js.es6 | 5 ++-- .../controllers/full-page-search.js.es6 | 3 +-- .../discourse/controllers/header.js.es6 | 4 +-- .../discourse/controllers/history.js.es6 | 3 +-- .../discourse/controllers/invite.js.es6 | 10 +++---- .../keyboard-shortcuts-help.js.es6 | 3 +-- .../discourse/controllers/login.js.es6 | 9 +++---- .../discourse/controllers/merge-topic.js.es6 | 5 ++-- .../discourse/controllers/modal.js.es6 | 4 +-- .../controllers/navigation/default.js.es6 | 4 +-- .../controllers/not-activated.js.es6 | 3 +-- .../discourse/controllers/object.js.es6 | 3 --- .../discourse/controllers/preferences.js.es6 | 3 +-- .../controllers/preferences/about.js.es6 | 4 +-- .../controllers/preferences/email.js.es6 | 3 +-- .../controllers/preferences/username.js.es6 | 6 ++--- .../discourse/controllers/quote-button.js.es6 | 5 ++-- .../discourse/controllers/raw-email.js.es6 | 3 +-- .../discourse/controllers/search-help.js.es6 | 3 +-- .../discourse/controllers/search.js.es6 | 5 ++-- .../discourse/controllers/split-topic.js.es6 | 5 ++-- .../controllers/topic-admin-menu.js.es6 | 4 +-- .../controllers/topic-progress.js.es6 | 2 +- .../discourse/controllers/topic.js.es6 | 3 +-- .../controllers/upload-selector.js.es6 | 3 +-- .../controllers/user-activity.js.es6 | 2 +- .../controllers/user-invited-show.js.es6 | 2 +- .../controllers/user-topics-list.js.es6 | 4 +-- .../discourse/controllers/user.js.es6 | 3 +-- .../initializers/es6-deprecations.js.es6 | 27 ------------------- .../discourse/mixins/presence.js.es6 | 20 -------------- .../javascripts/discourse/models/model.js.es6 | 4 +-- .../javascripts/discourse/models/post.js.es6 | 4 +-- .../javascripts/discourse/models/rest.js.es6 | 4 +-- .../discourse/models/topic-details.js.es6 | 2 +- .../javascripts/discourse/models/user.js.es6 | 6 ++--- .../discourse/routes/topic-from-params.js.es6 | 2 +- .../discourse/views/badges-show.js.es6 | 2 +- .../javascripts/discourse/views/button.js.es6 | 2 +- .../discourse/views/choose-topic.js.es6 | 2 +- .../discourse/views/composer-messages.js.es6 | 2 +- .../discourse/views/composer.js.es6 | 4 +-- .../discourse/views/container.js.es6 | 4 +-- .../views/discovery-categories.js.es6 | 2 +- .../discourse/views/discovery-top.js.es6 | 2 +- .../discourse/views/discovery-topics.js.es6 | 2 +- .../discourse/views/group-index.js.es6 | 2 +- .../discourse/views/group-members.js.es6 | 2 +- .../discourse/views/grouped.js.es6 | 4 +-- .../javascripts/discourse/views/header.js.es6 | 2 +- .../discourse/views/modal-body.js.es6 | 2 +- .../discourse/views/quote-button.js.es6 | 2 +- .../javascripts/discourse/views/search.js.es6 | 2 +- .../discourse/views/selected-posts.js.es6 | 2 +- .../javascripts/discourse/views/share.js.es6 | 6 ++--- .../discourse/views/topic-admin-menu.js.es6 | 4 +-- .../discourse/views/topic-closing.js.es6 | 4 +-- .../discourse/views/topic-list-item.js.es6 | 2 +- .../javascripts/discourse/views/topic.js.es6 | 2 +- .../discourse/views/user-card.js.es6 | 2 +- .../discourse/views/user-topics-list.js.es6 | 2 +- .../javascripts/discourse/views/users.js.es6 | 2 +- .../javascripts/discourse/views/view.js.es6 | 3 --- app/assets/javascripts/main_include.js | 3 --- .../admin/models/admin-user-test.js.es6 | 3 ++- .../admin/models/api-key-test.js.es6 | 2 ++ .../controllers/discourse-test.js.es6 | 8 ------ .../javascripts/controllers/topic-test.js.es6 | 2 ++ test/javascripts/helpers/assertions.js | 8 ------ .../helpers/custom-html-test.js.es6 | 1 + test/javascripts/helpers/qunit-helpers.js.es6 | 19 +++++++++++-- .../lib/category-badge-test.js.es6 | 2 ++ test/javascripts/lib/click-track-test.js.es6 | 1 + .../javascripts/lib/preload-store-test.js.es6 | 2 ++ test/javascripts/lib/utilities-test.js.es6 | 6 +++-- test/javascripts/mixins/presence-test.js.es6 | 27 ------------------- test/javascripts/mixins/singleton-test.js.es6 | 1 + test/javascripts/models/composer-test.js.es6 | 1 + test/javascripts/models/model-test.js.es6 | 7 +---- .../models/post-stream-test.js.es6 | 1 + test/javascripts/models/post-test.js.es6 | 2 ++ test/javascripts/models/report-test.js.es6 | 2 ++ test/javascripts/models/site-test.js.es6 | 2 ++ .../models/topic-details-test.js.es6 | 1 + test/javascripts/models/topic-test.js.es6 | 1 + .../models/user-stream-test.js.es6 | 4 ++- .../views/container-view-test.js.es6 | 7 ----- 130 files changed, 187 insertions(+), 349 deletions(-) delete mode 100644 app/assets/javascripts/discourse/controllers/controller.js.es6 delete mode 100644 app/assets/javascripts/discourse/controllers/object.js.es6 delete mode 100644 app/assets/javascripts/discourse/initializers/es6-deprecations.js.es6 delete mode 100644 app/assets/javascripts/discourse/mixins/presence.js.es6 delete mode 100644 app/assets/javascripts/discourse/views/view.js.es6 delete mode 100644 test/javascripts/controllers/discourse-test.js.es6 delete mode 100644 test/javascripts/mixins/presence-test.js.es6 diff --git a/.jshintrc b/.jshintrc index 6be05281b..cbe6bffe5 100644 --- a/.jshintrc +++ b/.jshintrc @@ -20,8 +20,6 @@ "not", "expect", "equal", - "blank", - "present", "visit", "andThen", "click", diff --git a/app/assets/javascripts/admin/controllers/admin-backups.js.es6 b/app/assets/javascripts/admin/controllers/admin-backups.js.es6 index 05aa97415..a42988337 100644 --- a/app/assets/javascripts/admin/controllers/admin-backups.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-backups.js.es6 @@ -1,4 +1,4 @@ -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ noOperationIsRunning: Ember.computed.not("model.isOperationRunning"), rollbackEnabled: Ember.computed.and("model.canRollback", "model.restoreEnabled", "noOperationIsRunning"), rollbackDisabled: Ember.computed.not("rollbackEnabled") diff --git a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 index 15ba6bc01..a44b6a0b7 100644 --- a/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-badges-show.js.es6 @@ -2,7 +2,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error'; import BufferedContent from 'discourse/mixins/buffered-content'; import { propertyNotEqual } from 'discourse/lib/computed'; -export default Ember.ObjectController.extend(BufferedContent, { +export default Ember.Controller.extend(BufferedContent, { needs: ['admin-badges'], saving: false, savingStatus: '', diff --git a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 index 341ca4f65..b4006391b 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-index.js.es6 @@ -1,6 +1,4 @@ -import DiscourseController from 'discourse/controllers/controller'; - -export default DiscourseController.extend({ +export default Ember.Controller.extend({ /** Is the "send test email" button disabled? diff --git a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 index 84d1f3e4b..108cb74f3 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-preview-digest.js.es6 @@ -1,6 +1,4 @@ -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend({ +export default Ember.Controller.extend({ actions: { refresh: function() { diff --git a/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 index e00bfba61..a03bd8212 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-sent.js.es6 @@ -1,7 +1,6 @@ -import DiscourseController from 'discourse/controllers/controller'; import debounce from 'discourse/lib/debounce'; -export default DiscourseController.extend({ +export default Ember.Controller.extend({ filterEmailLogs: debounce(function() { var self = this; diff --git a/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 b/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 index 06cedc6dd..1d83f14c6 100644 --- a/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-email-skipped.js.es6 @@ -1,7 +1,6 @@ import debounce from 'discourse/lib/debounce'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend({ +export default Ember.Controller.extend({ filterEmailLogs: debounce(function() { var self = this; Discourse.EmailLog.findAll(this.get("filter")).then(function(logs) { diff --git a/app/assets/javascripts/admin/controllers/admin-group.js.es6 b/app/assets/javascripts/admin/controllers/admin-group.js.es6 index 93213e2c6..dee7c45bb 100644 --- a/app/assets/javascripts/admin/controllers/admin-group.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-group.js.es6 @@ -1,7 +1,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error'; import { propertyEqual } from 'discourse/lib/computed'; -export default Em.ObjectController.extend({ +export default Ember.Controller.extend({ needs: ['adminGroupsType'], disableSave: false, diff --git a/app/assets/javascripts/admin/controllers/admin-log-screened-ip-address.js.es6 b/app/assets/javascripts/admin/controllers/admin-log-screened-ip-address.js.es6 index 81486978a..199296d82 100644 --- a/app/assets/javascripts/admin/controllers/admin-log-screened-ip-address.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-log-screened-ip-address.js.es6 @@ -1,4 +1,4 @@ -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ editing: false, savedIpAddress: null, diff --git a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 index 1bf93fef7..e964d17a2 100644 --- a/app/assets/javascripts/admin/controllers/admin-reports.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-reports.js.es6 @@ -1,4 +1,4 @@ -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ viewMode: 'table', viewingTable: Em.computed.equal('viewMode', 'table'), viewingBarChart: Em.computed.equal('viewMode', 'barChart'), diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 index 37bc9b376..b16db34e3 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings-category.js.es6 @@ -1,4 +1,4 @@ -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ categoryNameKey: null, needs: ['adminSiteSettings'], diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 index d89e55c99..648a0e549 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 @@ -1,14 +1,13 @@ import debounce from 'discourse/lib/debounce'; -import Presence from 'discourse/mixins/presence'; -export default Ember.ArrayController.extend(Presence, { +export default Ember.ArrayController.extend({ filter: null, onlyOverridden: false, filtered: Ember.computed.notEmpty('filter'), filterContentNow: function(category) { // If we have no content, don't bother filtering anything - if (!this.present('allSiteSettings')) return; + if (!!Ember.isEmpty(this.get('allSiteSettings'))) return; let filter; if (this.get('filter')) { diff --git a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 index 339f34e24..0ad12bfcc 100644 --- a/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user-index.js.es6 @@ -1,8 +1,7 @@ -import ObjectController from 'discourse/controllers/object'; import CanCheckEmails from 'discourse/mixins/can-check-emails'; import { propertyNotEqual, setting } from 'discourse/lib/computed'; -export default ObjectController.extend(CanCheckEmails, { +export default Ember.Controller.extend(CanCheckEmails, { editingTitle: false, originalPrimaryGroupId: null, availableGroups: null, diff --git a/app/assets/javascripts/admin/controllers/admin-user.js.es6 b/app/assets/javascripts/admin/controllers/admin-user.js.es6 index 33f6459f8..77c79b724 100644 --- a/app/assets/javascripts/admin/controllers/admin-user.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-user.js.es6 @@ -1,3 +1 @@ -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend(); +export default Ember.Controller.extend(); diff --git a/app/assets/javascripts/admin/controllers/admin.js.es6 b/app/assets/javascripts/admin/controllers/admin.js.es6 index ae2b81f08..3bdfbe6b5 100644 --- a/app/assets/javascripts/admin/controllers/admin.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin.js.es6 @@ -1,6 +1,4 @@ -import DiscourseController from 'discourse/controllers/controller'; - -export default DiscourseController.extend({ +export default Ember.Controller.extend({ showBadges: function() { return this.get('currentUser.admin') && this.siteSettings.enable_badges; }.property() diff --git a/app/assets/javascripts/admin/controllers/modals/admin-agree-flag.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-agree-flag.js.es6 index 635b8c87f..2924eb669 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-agree-flag.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-agree-flag.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ["admin-flags-list"], _agreeFlag: function (actionOnPost) { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-delete-flag.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-delete-flag.js.es6 index de26828ec..284b8bfd0 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-delete-flag.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-delete-flag.js.es6 @@ -1,8 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ["admin-flags-list"], actions: { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-staff-action-log-details.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-staff-action-log-details.js.es6 index 9d525e982..1e2ae5adc 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-staff-action-log-details.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-staff-action-log-details.js.es6 @@ -1,5 +1,3 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend(ModalFunctionality); +export default Ember.Controller.extend(ModalFunctionality); diff --git a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 index 1af962e41..682b1ba25 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-start-backup.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import Controller from 'discourse/controllers/controller'; -export default Controller.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ["adminBackupsLogs"], _startBackup: function (withUploads) { diff --git a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 index 49999aa09..d3e19de56 100644 --- a/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/admin-suspend-user.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { submitDisabled: function() { return (!this.get('reason') || this.get('reason').length < 1); diff --git a/app/assets/javascripts/admin/controllers/modals/change-site-customization-details.js.es6 b/app/assets/javascripts/admin/controllers/modals/change-site-customization-details.js.es6 index 1ef3e217d..ca6ac31db 100644 --- a/app/assets/javascripts/admin/controllers/modals/change-site-customization-details.js.es6 +++ b/app/assets/javascripts/admin/controllers/modals/change-site-customization-details.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { previousSelected: Ember.computed.equal('selectedTab', 'previous'), newSelected: Ember.computed.equal('selectedTab', 'new'), diff --git a/app/assets/javascripts/admin/models/flagged_post.js b/app/assets/javascripts/admin/models/flagged_post.js index 069606780..e3a01948c 100644 --- a/app/assets/javascripts/admin/models/flagged_post.js +++ b/app/assets/javascripts/admin/models/flagged_post.js @@ -47,7 +47,7 @@ Discourse.FlaggedPost = Discourse.Post.extend({ }, wasEdited: function () { - if (this.blank("last_revised_at")) { return false; } + if (Ember.isEmpty(this.get("last_revised_at"))) { return false; } var lastRevisedAt = Date.parse(this.get("last_revised_at")); return _.some(this.get("post_actions"), function (postAction) { return Date.parse(postAction.created_at) < lastRevisedAt; diff --git a/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 index 98f7c3dfe..9d164142a 100644 --- a/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 +++ b/app/assets/javascripts/admin/views/admin-backups-logs.js.es6 @@ -1,7 +1,7 @@ import debounce from 'discourse/lib/debounce'; import { renderSpinner } from 'discourse/helpers/loading-spinner'; -export default Discourse.View.extend({ +export default Ember.View.extend({ classNames: ["admin-backups-logs"], _initialize: function() { this._reset(); }.on("init"), diff --git a/app/assets/javascripts/admin/views/admin-backups.js.es6 b/app/assets/javascripts/admin/views/admin-backups.js.es6 index f0adae194..a779f4971 100644 --- a/app/assets/javascripts/admin/views/admin-backups.js.es6 +++ b/app/assets/javascripts/admin/views/admin-backups.js.es6 @@ -1,6 +1,6 @@ import DiscourseURL from 'discourse/lib/url'; -export default Discourse.View.extend({ +export default Ember.View.extend({ classNames: ["admin-backups"], _hijackDownloads: function() { diff --git a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 b/app/assets/javascripts/admin/views/admin-flags-list.js.es6 index 0f720b1e5..bcf3867a2 100644 --- a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 +++ b/app/assets/javascripts/admin/views/admin-flags-list.js.es6 @@ -1,6 +1,6 @@ import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(LoadMore, { +export default Ember.View.extend(LoadMore, { loading: false, eyelineSelector: '.admin-flags tbody tr', diff --git a/app/assets/javascripts/admin/views/admin.js.es6 b/app/assets/javascripts/admin/views/admin.js.es6 index f503a3406..fc4a611fe 100644 --- a/app/assets/javascripts/admin/views/admin.js.es6 +++ b/app/assets/javascripts/admin/views/admin.js.es6 @@ -1,4 +1,4 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ _disableCustomStylesheets: function() { if (this.session.get("disableCustomCSS")) { $("link.custom-css").attr("rel", ""); diff --git a/app/assets/javascripts/admin/views/admin_customize_colors_view.js b/app/assets/javascripts/admin/views/admin_customize_colors_view.js index e503a6f6d..b03e8eb76 100644 --- a/app/assets/javascripts/admin/views/admin_customize_colors_view.js +++ b/app/assets/javascripts/admin/views/admin_customize_colors_view.js @@ -1,11 +1,3 @@ -/** - A view to handle color selections within a site customization - - @class AdminCustomizeColorsView - @extends Discourse.View - @namespace Discourse - @module Discourse -**/ -Discourse.AdminCustomizeColorsView = Discourse.View.extend({ +Discourse.AdminCustomizeColorsView = Ember.View.extend({ templateName: 'admin/templates/customize_colors' }); diff --git a/app/assets/javascripts/admin/views/admin_user_view.js b/app/assets/javascripts/admin/views/admin_user_view.js index 0d430af4f..997eaf3b2 100644 --- a/app/assets/javascripts/admin/views/admin_user_view.js +++ b/app/assets/javascripts/admin/views/admin_user_view.js @@ -1,10 +1 @@ -/** - The view class for an Admin User - - @class AdminUserView - @extends Discourse.View - @namespace Discourse - @module Discourse -**/ -Discourse.AdminUserView = Discourse.View.extend(Discourse.ScrollTop); - +Discourse.AdminUserView = Ember.View.extend(Discourse.ScrollTop); diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 70a5af9e4..3d548b5fa 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -155,3 +155,9 @@ function proxyDep(propName, moduleFunc, msg) { proxyDep('computed', function() { return require('discourse/lib/computed') }); proxyDep('Formatter', function() { return require('discourse/lib/formatter') }); proxyDep('PageTracker', function() { return require('discourse/lib/page-tracker').default }); +proxyDep('URL', function() { return require('discourse/lib/url').default }); +proxyDep('Quote', function() { return require('discourse/lib/quote').default }); +proxyDep('debounce', function() { return require('discourse/lib/debounce').default }); +proxyDep('View', function() { return Ember.View }, "Use `Ember.View` instead"); +proxyDep('Controller', function() { return Ember.Controller }, "Use `Ember.Controller` instead"); +proxyDep('ObjectController', function() { return Ember.ObjectController }, "Use `Ember.Controller` instead"); diff --git a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 index 6cdab98db..f0bb9fcb3 100644 --- a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { uploadedAvatarTemplate: null, saveDisabled: Em.computed.alias("uploading"), hasUploadedAvatar: Em.computed.or('uploadedAvatarTemplate', 'custom_avatar_upload_id'), diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index 77bfa341b..1083fd37f 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -1,6 +1,4 @@ -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend({ +export default Ember.Controller.extend({ noMoreBadges: false, userBadges: null, needs: ["application"], diff --git a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 index 611498268..39ae9cddc 100644 --- a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 +++ b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 @@ -1,10 +1,9 @@ -import Presence from 'discourse/mixins/presence'; import SelectedPostsCount from 'discourse/mixins/selected-posts-count'; import ModalFunctionality from 'discourse/mixins/modal-functionality'; import DiscourseURL from 'discourse/lib/url'; // Modal related to changing the ownership of posts -export default Ember.Controller.extend(Presence, SelectedPostsCount, ModalFunctionality, { +export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, { needs: ['topic'], topicController: Em.computed.alias('controllers.topic'), @@ -14,7 +13,7 @@ export default Ember.Controller.extend(Presence, SelectedPostsCount, ModalFuncti buttonDisabled: function() { if (this.get('saving')) return true; - return this.blank('new_user'); + return Ember.isEmpty(this.get('new_user')); }.property('saving', 'new_user'), buttonTitle: function() { diff --git a/app/assets/javascripts/discourse/controllers/composer.js.es6 b/app/assets/javascripts/discourse/controllers/composer.js.es6 index c3a8a6827..77ecedadd 100644 --- a/app/assets/javascripts/discourse/controllers/composer.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer.js.es6 @@ -1,10 +1,9 @@ import { setting } from 'discourse/lib/computed'; -import Presence from 'discourse/mixins/presence'; import DiscourseURL from 'discourse/lib/url'; import Quote from 'discourse/lib/quote'; import Draft from 'discourse/models/draft'; -export default Ember.ObjectController.extend(Presence, { +export default Ember.Controller.extend({ needs: ['modal', 'topic', 'composer-messages', 'application'], replyAsNewTopicDraft: Em.computed.equal('model.draftKey', Discourse.Composer.REPLY_AS_NEW_TOPIC_KEY), @@ -152,7 +151,7 @@ export default Ember.ObjectController.extend(Presence, { this.closeAutocomplete(); switch (this.get('model.composeState')) { case Discourse.Composer.OPEN: - if (this.blank('model.reply') && this.blank('model.title')) { + if (Ember.isEmpty(this.get('model.reply')) && Ember.isEmpty(this.get('model.title'))) { this.close(); } else { this.shrink(); diff --git a/app/assets/javascripts/discourse/controllers/controller.js.es6 b/app/assets/javascripts/discourse/controllers/controller.js.es6 deleted file mode 100644 index 0be72a02a..000000000 --- a/app/assets/javascripts/discourse/controllers/controller.js.es6 +++ /dev/null @@ -1,3 +0,0 @@ -import Presence from 'discourse/mixins/presence'; - -export default Ember.Controller.extend(Presence); diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index 052a8bd4e..b93363cb3 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -1,9 +1,8 @@ import debounce from 'discourse/lib/debounce'; import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; import { setting } from 'discourse/lib/computed'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ['login'], uniqueUsernameValidation: null, @@ -66,7 +65,7 @@ export default DiscourseController.extend(ModalFunctionality, { usernameRequired: Ember.computed.not('authOptions.omit_username'), passwordRequired: function() { - return this.blank('authOptions.auth_provider'); + return Ember.isEmpty(this.get('authOptions.auth_provider')); }.property('authOptions.auth_provider'), passwordInstructions: function() { @@ -83,7 +82,7 @@ export default DiscourseController.extend(ModalFunctionality, { this.fetchConfirmationValue(); } - if (Discourse.SiteSettings.full_name_required && this.blank('accountName')) { + if (Discourse.SiteSettings.full_name_required && Ember.isEmpty(this.get('accountName'))) { return Discourse.InputValidation.create({ failed: true }); } @@ -94,7 +93,7 @@ export default DiscourseController.extend(ModalFunctionality, { emailValidation: function() { // If blank, fail without a reason let email; - if (this.blank('accountEmail')) { + if (Ember.isEmpty(this.get('accountEmail'))) { return Discourse.InputValidation.create({ failed: true }); @@ -144,7 +143,7 @@ export default DiscourseController.extend(ModalFunctionality, { } this.set('prefilledUsername', null); } - if (this.get('emailValidation.ok') && (this.blank('accountUsername') || this.get('authOptions.email'))) { + if (this.get('emailValidation.ok') && (Ember.isEmpty(this.get('accountUsername')) || this.get('authOptions.email'))) { // If email is valid and username has not been entered yet, // or email and username were filled automatically by 3rd parth auth, // then look for a registered username that matches the email. @@ -155,7 +154,7 @@ export default DiscourseController.extend(ModalFunctionality, { fetchExistingUsername: debounce(function() { const self = this; Discourse.User.checkUsername(null, this.get('accountEmail')).then(function(result) { - if (result.suggestion && (self.blank('accountUsername') || self.get('accountUsername') === self.get('authOptions.username'))) { + if (result.suggestion && (Ember.isEmpty(self.get('accountUsername')) || self.get('accountUsername') === self.get('authOptions.username'))) { self.set('accountUsername', result.suggestion); self.set('prefilledUsername', result.suggestion); } @@ -194,7 +193,7 @@ export default DiscourseController.extend(ModalFunctionality, { } // If blank, fail without a reason - if (this.blank('accountUsername')) { + if (Ember.isEmpty(this.get('accountUsername'))) { return Discourse.InputValidation.create({ failed: true }); @@ -225,7 +224,7 @@ export default DiscourseController.extend(ModalFunctionality, { }.property('accountUsername'), shouldCheckUsernameMatch: function() { - return !this.blank('accountUsername') && this.get('accountUsername').length >= this.get('minUsernameLength'); + return !Ember.isEmpty(this.get('accountUsername')) && this.get('accountUsername').length >= this.get('minUsernameLength'); }, checkUsernameAvailability: debounce(function() { @@ -296,7 +295,7 @@ export default DiscourseController.extend(ModalFunctionality, { // If blank, fail without a reason const password = this.get("accountPassword"); - if (this.blank('accountPassword')) { + if (Ember.isEmpty(this.get('accountPassword'))) { return Discourse.InputValidation.create({ failed: true }); } @@ -315,14 +314,14 @@ export default DiscourseController.extend(ModalFunctionality, { }); } - if (!this.blank('accountUsername') && this.get('accountPassword') === this.get('accountUsername')) { + if (!Ember.isEmpty(this.get('accountUsername')) && this.get('accountPassword') === this.get('accountUsername')) { return Discourse.InputValidation.create({ failed: true, reason: I18n.t('user.password.same_as_username') }); } - if (!this.blank('accountEmail') && this.get('accountPassword') === this.get('accountEmail')) { + if (!Ember.isEmpty(this.get('accountEmail')) && this.get('accountPassword') === this.get('accountEmail')) { return Discourse.InputValidation.create({ failed: true, reason: I18n.t('user.password.same_as_email') diff --git a/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 b/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 index 56d4d3a90..3e7c2e52a 100644 --- a/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery-sortable.js.es6 @@ -1,5 +1,3 @@ -import DiscourseController from 'discourse/controllers/controller'; - // Just add query params here to have them automatically passed to topic list filters. export var queryParams = { order: { replace: true, refreshModel: true }, @@ -22,4 +20,4 @@ controllerOpts.queryParams.forEach(function(p) { controllerOpts[p] = Em.computed.alias('controllers.discovery/topics.' + p); }); -export default DiscourseController.extend(controllerOpts); +export default Ember.Controller.extend(controllerOpts); diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6 index 69e51d55d..2be7bfd20 100644 --- a/app/assets/javascripts/discourse/controllers/discovery.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6 @@ -1,6 +1,6 @@ import DiscourseURL from 'discourse/lib/url'; -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ needs: ['navigation/category', 'discovery/topics', 'application'], loading: false, diff --git a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 index 9e7c637d6..bfda086b6 100644 --- a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 @@ -1,9 +1,8 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; import DiscourseURL from 'discourse/lib/url'; // Modal for editing / creating a category -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { selectedTab: null, saving: false, deleting: false, @@ -19,7 +18,7 @@ export default ObjectController.extend(ModalFunctionality, { }, changeSize: function() { - if (this.present('model.description')) { + if (!Ember.isEmpty(this.get('model.description'))) { this.set('controllers.modal.modalClass', 'edit-category-modal full'); } else { this.set('controllers.modal.modalClass', 'edit-category-modal small'); 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 7fa4458b4..6958ff446 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 @@ -1,8 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; // Modal related to auto closing of topics -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { auto_close_valid: true, auto_close_invalid: Em.computed.not('auto_close_valid'), diff --git a/app/assets/javascripts/discourse/controllers/exception.js.es6 b/app/assets/javascripts/discourse/controllers/exception.js.es6 index ccaf907c1..b2ff890ee 100644 --- a/app/assets/javascripts/discourse/controllers/exception.js.es6 +++ b/app/assets/javascripts/discourse/controllers/exception.js.es6 @@ -1,5 +1,3 @@ -import ObjectController from 'discourse/controllers/object'; - var ButtonBackBright = { classes: "btn-primary", action: "back", @@ -22,7 +20,7 @@ var ButtonBackBright = { }; // The controller for the nice error page -export default ObjectController.extend({ +export default Ember.Controller.extend({ thrown: null, lastTransition: null, diff --git a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 index 990d2b83a..03bcebfca 100644 --- a/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/feature-topic.js.es6 @@ -1,8 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; import { categoryLinkHTML } from 'discourse/helpers/category-link'; -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ["topic"], loading: true, diff --git a/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 b/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 index a5eba0df8..25912e7a2 100644 --- a/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 @@ -1,8 +1,7 @@ -import ObjectController from 'discourse/controllers/object'; import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type'; // Supports logic for flags in the modal -export default ObjectController.extend({ +export default Ember.Controller.extend({ needs: ['flag'], message: Em.computed.alias('controllers.flag.message'), diff --git a/app/assets/javascripts/discourse/controllers/flag.js.es6 b/app/assets/javascripts/discourse/controllers/flag.js.es6 index 6a80da273..956cbe235 100644 --- a/app/assets/javascripts/discourse/controllers/flag.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag.js.es6 @@ -1,8 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; import { MAX_MESSAGE_LENGTH } from 'discourse/models/post-action-type'; -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { userDetails: null, selected: null, flagTopic: null, diff --git a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 index 6d38365bd..64da750cf 100644 --- a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 +++ b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 @@ -1,11 +1,10 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { // You need a value in the field to submit it. submitDisabled: function() { - return this.blank('accountEmailOrUsername') || this.get('disabled'); + return Ember.isEmpty(this.get('accountEmailOrUsername')) || this.get('disabled'); }.property('accountEmailOrUsername', 'disabled'), actions: { diff --git a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 index 4f3c38b62..86e240feb 100644 --- a/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/full-page-search.js.es6 @@ -1,7 +1,6 @@ -import DiscourseController from "discourse/controllers/controller"; import { translateResults } from "discourse/lib/search-for-term"; -export default DiscourseController.extend({ +export default Ember.Controller.extend({ needs: ["application"], loading: Em.computed.not("model"), diff --git a/app/assets/javascripts/discourse/controllers/header.js.es6 b/app/assets/javascripts/discourse/controllers/header.js.es6 index c414227b6..d2bc11218 100644 --- a/app/assets/javascripts/discourse/controllers/header.js.es6 +++ b/app/assets/javascripts/discourse/controllers/header.js.es6 @@ -1,6 +1,4 @@ -import DiscourseController from 'discourse/controllers/controller'; - -const HeaderController = DiscourseController.extend({ +const HeaderController = Ember.Controller.extend({ topic: null, showExtraInfo: null, notifications: null, diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6 index e3603089e..bef9a4c96 100644 --- a/app/assets/javascripts/discourse/controllers/history.js.es6 +++ b/app/assets/javascripts/discourse/controllers/history.js.es6 @@ -1,9 +1,8 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; import { categoryBadgeHTML } from 'discourse/helpers/category-link'; // This controller handles displaying of history -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { loading: true, viewMode: "side_by_side", revisionsTextKey: "post.revisions.controls.comparing_previous_to_current_out_of_total", diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index 660bcdc89..b9173b875 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -1,9 +1,7 @@ -import Presence from 'discourse/mixins/presence'; import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; import Invite from 'discourse/models/invite'; -export default ObjectController.extend(Presence, ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ['user-invited-show'], // If this isn't defined, it will proxy to the user model on the preferences @@ -16,14 +14,14 @@ export default ObjectController.extend(Presence, ModalFunctionality, { disabled: function() { if (this.get('model.saving')) return true; - if (this.blank('emailOrUsername')) return true; + if (Ember.isEmpty(this.get('emailOrUsername'))) return true; const emailOrUsername = this.get('emailOrUsername').trim(); // when inviting to forum, email must be valid if (!this.get('invitingToTopic') && !Discourse.Utilities.emailValid(emailOrUsername)) return true; // normal users (not admin) can't invite users to private topic via email if (!this.get('isAdmin') && this.get('isPrivateTopic') && Discourse.Utilities.emailValid(emailOrUsername)) return true; // when invting to private topic via email, group name must be specified - if (this.get('isPrivateTopic') && this.blank('model.groupNames') && Discourse.Utilities.emailValid(emailOrUsername)) return true; + if (this.get('isPrivateTopic') && Ember.isEmpty(this.get('model.groupNames')) && Discourse.Utilities.emailValid(emailOrUsername)) return true; if (this.get('model.details.can_invite_to')) return false; return false; }.property('isAdmin', 'emailOrUsername', 'invitingToTopic', 'isPrivateTopic', 'model.groupNames', 'model.saving'), @@ -71,7 +69,7 @@ export default ObjectController.extend(Presence, ModalFunctionality, { return I18n.t('topic.invite_reply.to_username'); } else { // when inviting to a topic, display instructions based on provided entity - if (this.blank('emailOrUsername')) { + if (Ember.isEmpty(this.get('emailOrUsername'))) { return I18n.t('topic.invite_reply.to_topic_blank'); } else if (Discourse.Utilities.emailValid(this.get('emailOrUsername'))) { return I18n.t('topic.invite_reply.to_topic_email'); diff --git a/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 b/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 index 30d4a0066..5e0414bcd 100644 --- a/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 +++ b/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ['modal'], onShow: function() { diff --git a/app/assets/javascripts/discourse/controllers/login.js.es6 b/app/assets/javascripts/discourse/controllers/login.js.es6 index 6d39640e5..824c3110f 100644 --- a/app/assets/javascripts/discourse/controllers/login.js.es6 +++ b/app/assets/javascripts/discourse/controllers/login.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; import showModal from 'discourse/lib/show-modal'; import { setting } from 'discourse/lib/computed'; @@ -8,7 +7,7 @@ const AuthErrors = ['requires_invite', 'awaiting_approval', 'awaiting_confirmation', 'admin_not_allowed_from_ip_address', 'not_allowed_from_ip_address']; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ['modal', 'createAccount', 'forgotPassword', 'application'], authenticate: null, loggingIn: false, @@ -39,7 +38,7 @@ export default DiscourseController.extend(ModalFunctionality, { showSignupLink: function() { return this.get('controllers.application.canSignUp') && !this.get('loggingIn') && - this.blank('authenticate'); + Ember.isEmpty(this.get('authenticate')); }.property('loggingIn', 'authenticate'), showSpinner: function() { @@ -50,7 +49,7 @@ export default DiscourseController.extend(ModalFunctionality, { login: function() { const self = this; - if(this.blank('loginName') || this.blank('loginPassword')){ + if(Ember.isEmpty(this.get('loginName')) || Ember.isEmpty(this.get('loginPassword'))){ self.flash(I18n.t('login.blank_username_or_password'), 'error'); return; } @@ -154,7 +153,7 @@ export default DiscourseController.extend(ModalFunctionality, { }, authMessage: (function() { - if (this.blank('authenticate')) return ""; + if (Ember.isEmpty(this.get('authenticate'))) return ""; const method = Discourse.get('LoginMethod.all').findProperty("name", this.get("authenticate")); if(method){ return method.get('message'); diff --git a/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 b/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 index f81e0de67..197c9fcb3 100644 --- a/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 @@ -1,11 +1,10 @@ -import Presence from 'discourse/mixins/presence'; import SelectedPostsCount from 'discourse/mixins/selected-posts-count'; import ModalFunctionality from 'discourse/mixins/modal-functionality'; import { movePosts, mergeTopic } from 'discourse/models/topic'; import DiscourseURL from 'discourse/lib/url'; // Modal related to merging of topics -export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, Presence, { +export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, { needs: ['topic'], saving: false, @@ -18,7 +17,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, P buttonDisabled: function() { if (this.get('saving')) return true; - return this.blank('selectedTopicId'); + return Ember.isEmpty(this.get('selectedTopicId')); }.property('selectedTopicId', 'saving'), buttonTitle: function() { diff --git a/app/assets/javascripts/discourse/controllers/modal.js.es6 b/app/assets/javascripts/discourse/controllers/modal.js.es6 index c744bdfc3..77c79b724 100644 --- a/app/assets/javascripts/discourse/controllers/modal.js.es6 +++ b/app/assets/javascripts/discourse/controllers/modal.js.es6 @@ -1,3 +1 @@ -import DiscourseController from 'discourse/controllers/controller'; - -export default DiscourseController.extend({}); +export default Ember.Controller.extend(); diff --git a/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 b/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 index 7832d4ab5..c2a48c4b7 100644 --- a/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 +++ b/app/assets/javascripts/discourse/controllers/navigation/default.js.es6 @@ -1,6 +1,4 @@ -import DiscourseController from 'discourse/controllers/controller'; - -export default DiscourseController.extend({ +export default Ember.Controller.extend({ needs: ['discovery', 'discovery/topics'], categories: function() { diff --git a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 index dd5332076..2c2e2b075 100644 --- a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 +++ b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { emailSent: false, onShow() { diff --git a/app/assets/javascripts/discourse/controllers/object.js.es6 b/app/assets/javascripts/discourse/controllers/object.js.es6 deleted file mode 100644 index 7351a0a17..000000000 --- a/app/assets/javascripts/discourse/controllers/object.js.es6 +++ /dev/null @@ -1,3 +0,0 @@ -import Presence from 'discourse/mixins/presence'; - -export default Ember.ObjectController.extend(Presence); diff --git a/app/assets/javascripts/discourse/controllers/preferences.js.es6 b/app/assets/javascripts/discourse/controllers/preferences.js.es6 index cacbd4b9e..3a0bd90fe 100644 --- a/app/assets/javascripts/discourse/controllers/preferences.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences.js.es6 @@ -1,9 +1,8 @@ import { setting } from 'discourse/lib/computed'; -import ObjectController from 'discourse/controllers/object'; import CanCheckEmails from 'discourse/mixins/can-check-emails'; import { popupAjaxError } from 'discourse/lib/ajax-error'; -export default ObjectController.extend(CanCheckEmails, { +export default Ember.Controller.extend(CanCheckEmails, { allowAvatarUpload: setting('allow_uploaded_avatars'), allowUserLocale: setting('allow_user_locale'), diff --git a/app/assets/javascripts/discourse/controllers/preferences/about.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/about.js.es6 index 742666333..8d46eca00 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/about.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/about.js.es6 @@ -1,6 +1,4 @@ -import ObjectController from 'discourse/controllers/object'; - -export default ObjectController.extend({ +export default Ember.Controller.extend({ saving: false, newBio: null, diff --git a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 index 547a9adbd..83262902d 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/email.js.es6 @@ -1,7 +1,6 @@ import { propertyEqual } from 'discourse/lib/computed'; -import ObjectController from 'discourse/controllers/object'; -export default ObjectController.extend({ +export default Ember.Controller.extend({ taken: false, saving: false, error: false, diff --git a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 index 410fabe4d..c1976a91f 100644 --- a/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 +++ b/app/assets/javascripts/discourse/controllers/preferences/username.js.es6 @@ -1,9 +1,7 @@ import { setting, propertyEqual } from 'discourse/lib/computed'; -import Presence from 'discourse/mixins/presence'; -import ObjectController from 'discourse/controllers/object'; import DiscourseURL from 'discourse/lib/url'; -export default ObjectController.extend(Presence, { +export default Ember.Controller.extend({ taken: false, saving: false, error: false, @@ -23,7 +21,7 @@ export default ObjectController.extend(Presence, { var self = this; this.set('taken', false); this.set('errorMessage', null); - if (this.blank('newUsername')) return; + if (Ember.isEmpty(this.get('newUsername'))) return; if (this.get('unchanged')) return; Discourse.User.checkUsername(this.get('newUsername'), undefined, this.get('content.id')).then(function(result) { if (result.errors) { diff --git a/app/assets/javascripts/discourse/controllers/quote-button.js.es6 b/app/assets/javascripts/discourse/controllers/quote-button.js.es6 index bb255f8d2..cfdd30b52 100644 --- a/app/assets/javascripts/discourse/controllers/quote-button.js.es6 +++ b/app/assets/javascripts/discourse/controllers/quote-button.js.es6 @@ -1,8 +1,7 @@ -import DiscourseController from 'discourse/controllers/controller'; import loadScript from 'discourse/lib/load-script'; import Quote from 'discourse/lib/quote'; -export default DiscourseController.extend({ +export default Ember.Controller.extend({ needs: ['topic', 'composer'], _loadSanitizer: function() { @@ -11,7 +10,7 @@ export default DiscourseController.extend({ // If the buffer is cleared, clear out other state (post) bufferChanged: function() { - if (this.blank('buffer')) this.set('post', null); + if (Ember.isEmpty(this.get('buffer'))) this.set('post', null); }.observes('buffer'), // Save the currently selected text and displays the diff --git a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 index 8c74ce111..caf410fd5 100644 --- a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 @@ -1,8 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import ObjectController from 'discourse/controllers/object'; // This controller handles displaying of raw email -export default ObjectController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { rawEmail: "", loadRawEmail: function(postId) { diff --git a/app/assets/javascripts/discourse/controllers/search-help.js.es6 b/app/assets/javascripts/discourse/controllers/search-help.js.es6 index 2630424ff..7f5958ae4 100644 --- a/app/assets/javascripts/discourse/controllers/search-help.js.es6 +++ b/app/assets/javascripts/discourse/controllers/search-help.js.es6 @@ -1,7 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { needs: ['modal'], showGoogleSearch: function() { diff --git a/app/assets/javascripts/discourse/controllers/search.js.es6 b/app/assets/javascripts/discourse/controllers/search.js.es6 index 71d650726..eff99ec98 100644 --- a/app/assets/javascripts/discourse/controllers/search.js.es6 +++ b/app/assets/javascripts/discourse/controllers/search.js.es6 @@ -1,10 +1,9 @@ -import Presence from 'discourse/mixins/presence'; import searchForTerm from 'discourse/lib/search-for-term'; import DiscourseURL from 'discourse/lib/url'; let _dontSearch = false; -export default Em.Controller.extend(Presence, { +export default Em.Controller.extend({ typeFilter: null, contextType: function(key, value){ @@ -115,7 +114,7 @@ export default Em.Controller.extend(Presence, { showCancelFilter: function() { if (this.get('loading')) return false; - return this.present('typeFilter'); + return !Ember.isEmpty(this.get('typeFilter')); }.property('typeFilter', 'loading'), termChanged: function() { diff --git a/app/assets/javascripts/discourse/controllers/split-topic.js.es6 b/app/assets/javascripts/discourse/controllers/split-topic.js.es6 index dc391497c..b8a1a7250 100644 --- a/app/assets/javascripts/discourse/controllers/split-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/split-topic.js.es6 @@ -1,4 +1,3 @@ -import Presence from 'discourse/mixins/presence'; import SelectedPostsCount from 'discourse/mixins/selected-posts-count'; import ModalFunctionality from 'discourse/mixins/modal-functionality'; import { extractError } from 'discourse/lib/ajax-error'; @@ -6,7 +5,7 @@ import { movePosts } from 'discourse/models/topic'; import DiscourseURL from 'discourse/lib/url'; // Modal related to auto closing of topics -export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, Presence, { +export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, { needs: ['topic'], topicName: null, saving: false, @@ -19,7 +18,7 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, P buttonDisabled: function() { if (this.get('saving')) return true; - return this.blank('topicName'); + return Ember.isEmpty(this.get('topicName')); }.property('saving', 'topicName'), buttonTitle: function() { 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 20bb123a0..4e454b852 100644 --- a/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 @@ -1,7 +1,5 @@ -import ObjectController from 'discourse/controllers/object'; - // This controller supports the admin menu on topics -export default ObjectController.extend({ +export default Ember.Controller.extend({ menuVisible: false, showRecover: Em.computed.and('model.deleted', 'model.details.can_recover'), isFeatured: Em.computed.or("model.pinned_at", "model.isBanner"), diff --git a/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 b/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 index 92f483df7..39e9ff2b7 100644 --- a/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-progress.js.es6 @@ -1,6 +1,6 @@ import DiscourseURL from 'discourse/lib/url'; -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ needs: ['topic'], progressPosition: null, expanded: false, diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index 545549ffc..736ad9415 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -1,4 +1,3 @@ -import ObjectController from 'discourse/controllers/object'; import BufferedContent from 'discourse/mixins/buffered-content'; import SelectedPostsCount from 'discourse/mixins/selected-posts-count'; import { spinnerHTML } from 'discourse/helpers/loading-spinner'; @@ -6,7 +5,7 @@ import Topic from 'discourse/models/topic'; import Quote from 'discourse/lib/quote'; import { setting } from 'discourse/lib/computed'; -export default ObjectController.extend(SelectedPostsCount, BufferedContent, { +export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, { multiSelect: false, needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress', 'application'], allPostsSelected: false, diff --git a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 index be9d21daf..2857b2a5c 100644 --- a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 @@ -1,8 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -import DiscourseController from 'discourse/controllers/controller'; import { setting } from 'discourse/lib/computed'; -export default DiscourseController.extend(ModalFunctionality, { +export default Ember.Controller.extend(ModalFunctionality, { remote: Em.computed.not("local"), local: false, showMore: false, diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index 7e4ec2db9..9e6a6530d 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -1,4 +1,4 @@ -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ userActionType: null, needs: ["application"], diff --git a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 index 79131dbf1..781d9be9a 100644 --- a/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-invited-show.js.es6 @@ -2,7 +2,7 @@ import Invite from 'discourse/models/invite'; import debounce from 'discourse/lib/debounce'; // This controller handles actions related to a user's invitations -export default Ember.ObjectController.extend({ +export default Ember.Controller.extend({ user: null, model: null, filter: null, diff --git a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 index 88b8b98c8..a0073b7c0 100644 --- a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 @@ -1,7 +1,5 @@ -import ObjectController from 'discourse/controllers/object'; - // Lists of topics on a user's page. -export default ObjectController.extend({ +export default Ember.Controller.extend({ needs: ["application", "user"], hideCategory: false, showParticipants: false, diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index 419e6f8a2..7159c146c 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -1,8 +1,7 @@ import { exportUserArchive } from 'discourse/lib/export-csv'; -import ObjectController from 'discourse/controllers/object'; import CanCheckEmails from 'discourse/mixins/can-check-emails'; -export default ObjectController.extend(CanCheckEmails, { +export default Ember.Controller.extend(CanCheckEmails, { indexStream: false, pmView: false, userActionType: null, diff --git a/app/assets/javascripts/discourse/initializers/es6-deprecations.js.es6 b/app/assets/javascripts/discourse/initializers/es6-deprecations.js.es6 deleted file mode 100644 index 93b6d61b6..000000000 --- a/app/assets/javascripts/discourse/initializers/es6-deprecations.js.es6 +++ /dev/null @@ -1,27 +0,0 @@ -import DiscourseURL from 'discourse/lib/url'; -import Quote from 'discourse/lib/quote'; -import debounce from 'discourse/lib/debounce'; - -function proxyDep(propName, module) { - if (Discourse.hasOwnProperty(propName)) { return; } - Object.defineProperty(Discourse, propName, { - get: function() { - Ember.warn(`DEPRECATION: \`Discourse.${propName}\` is deprecated, import the module.`); - return module; - } - }); -} - -export default { - name: 'es6-deprecations', - before: 'inject-objects', - - initialize: function() { - // TODO: Once things have migrated remove these - proxyDep('computed', require('discourse/lib/computed')); - proxyDep('Formatter', require('discourse/lib/formatter')); - proxyDep('URL', DiscourseURL); - proxyDep('Quote', Quote); - proxyDep('debounce', debounce); - } -}; diff --git a/app/assets/javascripts/discourse/mixins/presence.js.es6 b/app/assets/javascripts/discourse/mixins/presence.js.es6 deleted file mode 100644 index 742f50f40..000000000 --- a/app/assets/javascripts/discourse/mixins/presence.js.es6 +++ /dev/null @@ -1,20 +0,0 @@ -/** - This mixin provides `blank` and `present` to determine whether properties are - there, accounting for more cases than just null and undefined. -**/ -export default Ember.Mixin.create({ - - /** - Returns whether a property is blank. It considers empty arrays, string, objects, undefined and null - to be blank, otherwise true. - */ - blank(name) { - return Ember.isEmpty(this[name] || this.get(name)); - }, - - // Returns whether a property is present. A present property is the opposite of a `blank` one. - present(name) { - return !this.blank(name); - } - -}); diff --git a/app/assets/javascripts/discourse/models/model.js.es6 b/app/assets/javascripts/discourse/models/model.js.es6 index 4a5209bee..d7e3e650b 100644 --- a/app/assets/javascripts/discourse/models/model.js.es6 +++ b/app/assets/javascripts/discourse/models/model.js.es6 @@ -1,6 +1,4 @@ -import Presence from 'discourse/mixins/presence'; - -const Model = Ember.Object.extend(Presence); +const Model = Ember.Object.extend(); Model.reopenClass({ extractByKey: function(collection, klass) { diff --git a/app/assets/javascripts/discourse/models/post.js.es6 b/app/assets/javascripts/discourse/models/post.js.es6 index 17ac32b05..878ce21c0 100644 --- a/app/assets/javascripts/discourse/models/post.js.es6 +++ b/app/assets/javascripts/discourse/models/post.js.es6 @@ -97,7 +97,7 @@ const Post = RestModel.extend({ }, internalLinks: function() { - if (this.blank('link_counts')) return null; + if (Ember.isEmpty(this.get('link_counts'))) return null; return this.get('link_counts').filterProperty('internal').filterProperty('title'); }.property('link_counts.@each.internal'), @@ -112,7 +112,7 @@ const Post = RestModel.extend({ }.property('actions_summary.@each.can_act'), actionsWithoutLikes: function() { - if (!this.present('actions_summary')) return null; + if (!!Ember.isEmpty(this.get('actions_summary'))) return null; return this.get('actions_summary').filter(function(i) { if (i.get('count') === 0) return false; diff --git a/app/assets/javascripts/discourse/models/rest.js.es6 b/app/assets/javascripts/discourse/models/rest.js.es6 index 6396f8e54..0c595bb73 100644 --- a/app/assets/javascripts/discourse/models/rest.js.es6 +++ b/app/assets/javascripts/discourse/models/rest.js.es6 @@ -1,6 +1,4 @@ -import Presence from 'discourse/mixins/presence'; - -const RestModel = Ember.Object.extend(Presence, { +const RestModel = Ember.Object.extend({ isNew: Ember.computed.equal('__state', 'new'), isCreated: Ember.computed.equal('__state', 'created'), isSaving: false, diff --git a/app/assets/javascripts/discourse/models/topic-details.js.es6 b/app/assets/javascripts/discourse/models/topic-details.js.es6 index 9c8ca30e2..c40213a72 100644 --- a/app/assets/javascripts/discourse/models/topic-details.js.es6 +++ b/app/assets/javascripts/discourse/models/topic-details.js.es6 @@ -35,7 +35,7 @@ const TopicDetails = RestModel.extend({ }, fewParticipants: function() { - if (!this.present('participants')) return null; + if (!!Ember.isEmpty(this.get('participants'))) return null; return this.get('participants').slice(0, 3); }.property('participants'), diff --git a/app/assets/javascripts/discourse/models/user.js.es6 b/app/assets/javascripts/discourse/models/user.js.es6 index 279073957..669a3853b 100644 --- a/app/assets/javascripts/discourse/models/user.js.es6 +++ b/app/assets/javascripts/discourse/models/user.js.es6 @@ -47,7 +47,7 @@ const User = RestModel.extend({ @type {String} **/ displayName: function() { - if (Discourse.SiteSettings.enable_names && !this.blank('name')) { + if (Discourse.SiteSettings.enable_names && !Ember.isEmpty(this.get('name'))) { return this.get('name'); } return this.get('username'); @@ -263,7 +263,7 @@ const User = RestModel.extend({ statsCountNonPM: function() { var self = this; - if (this.blank('statsExcludingPms')) return 0; + if (Ember.isEmpty(this.get('statsExcludingPms'))) return 0; var count = 0; _.each(this.get('statsExcludingPms'), function(val) { if (self.inAllStream(val)){ @@ -275,7 +275,7 @@ const User = RestModel.extend({ // The user's stats, excluding PMs. statsExcludingPms: function() { - if (this.blank('stats')) return []; + if (Ember.isEmpty(this.get('stats'))) return []; return this.get('stats').rejectProperty('isPM'); }.property('stats.@each.isPM'), 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 3c1c843b1..f6d7216f6 100644 --- a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 +++ b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 @@ -48,7 +48,7 @@ export default Discourse.Route.extend({ }); DiscourseURL.jumpToPost(closest); - if (topic.present('draft')) { + if (!Ember.isEmpty(topic.get('draft'))) { composerController.open({ draft: Draft.getLocal(topic.get('draft_key'), topic.get('draft')), draftKey: topic.get('draft_key'), diff --git a/app/assets/javascripts/discourse/views/badges-show.js.es6 b/app/assets/javascripts/discourse/views/badges-show.js.es6 index 9b74c3e3f..9f94ae6a3 100644 --- a/app/assets/javascripts/discourse/views/badges-show.js.es6 +++ b/app/assets/javascripts/discourse/views/badges-show.js.es6 @@ -1,6 +1,6 @@ import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(LoadMore, { +export default Ember.View.extend(LoadMore, { eyelineSelector: '.badge-user', tickOrX: function(field){ var icon = this.get('controller.model.' + field) ? "fa-check" : "fa-times"; diff --git a/app/assets/javascripts/discourse/views/button.js.es6 b/app/assets/javascripts/discourse/views/button.js.es6 index a791db4a6..9811e7195 100644 --- a/app/assets/javascripts/discourse/views/button.js.es6 +++ b/app/assets/javascripts/discourse/views/button.js.es6 @@ -1,6 +1,6 @@ import StringBuffer from 'discourse/mixins/string-buffer'; -export default Discourse.View.extend(StringBuffer, { +export default Ember.View.extend(StringBuffer, { tagName: 'button', classNameBindings: [':btn', ':standard', 'dropDownToggle'], attributeBindings: ['title', 'data-toggle', 'data-share-url'], diff --git a/app/assets/javascripts/discourse/views/choose-topic.js.es6 b/app/assets/javascripts/discourse/views/choose-topic.js.es6 index b9733a5f2..7dbd8e424 100644 --- a/app/assets/javascripts/discourse/views/choose-topic.js.es6 +++ b/app/assets/javascripts/discourse/views/choose-topic.js.es6 @@ -1,7 +1,7 @@ import debounce from 'discourse/lib/debounce'; import searchForTerm from 'discourse/lib/search-for-term'; -export default Discourse.View.extend({ +export default Ember.View.extend({ templateName: 'choose_topic', topicTitleChanged: function() { diff --git a/app/assets/javascripts/discourse/views/composer-messages.js.es6 b/app/assets/javascripts/discourse/views/composer-messages.js.es6 index 39f911ec7..4541ff90c 100644 --- a/app/assets/javascripts/discourse/views/composer-messages.js.es6 +++ b/app/assets/javascripts/discourse/views/composer-messages.js.es6 @@ -4,7 +4,7 @@ export default Ember.CollectionView.extend({ hidden: Em.computed.not('controller.controllers.composer.model.viewOpen'), - itemViewClass: Discourse.View.extend({ + itemViewClass: Ember.View.extend({ classNames: ['composer-popup', 'hidden'], templateName: Em.computed.alias('content.templateName'), diff --git a/app/assets/javascripts/discourse/views/composer.js.es6 b/app/assets/javascripts/discourse/views/composer.js.es6 index b57a1a394..b48964e27 100644 --- a/app/assets/javascripts/discourse/views/composer.js.es6 +++ b/app/assets/javascripts/discourse/views/composer.js.es6 @@ -6,7 +6,7 @@ import positioningWorkaround from 'discourse/lib/safari-hacks'; import debounce from 'discourse/lib/debounce'; import { linkSeenMentions, fetchUnseenMentions } from 'discourse/lib/link-mentions'; -const ComposerView = Discourse.View.extend(Ember.Evented, { +const ComposerView = Ember.View.extend(Ember.Evented, { _lastKeyTimeout: null, templateName: 'composer', elementId: 'reply-control', @@ -38,7 +38,7 @@ const ComposerView = Discourse.View.extend(Ember.Evented, { }.observes('loading'), postMade: function() { - return this.present('model.createdPost') ? 'created-post' : null; + return !Ember.isEmpty(this.get('model.createdPost')) ? 'created-post' : null; }.property('model.createdPost'), refreshPreview: debounce(function() { diff --git a/app/assets/javascripts/discourse/views/container.js.es6 b/app/assets/javascripts/discourse/views/container.js.es6 index 68c653353..39d623c84 100644 --- a/app/assets/javascripts/discourse/views/container.js.es6 +++ b/app/assets/javascripts/discourse/views/container.js.es6 @@ -1,6 +1,4 @@ -import Presence from 'discourse/mixins/presence'; - -export default Ember.ContainerView.extend(Presence, { +export default Ember.ContainerView.extend({ attachViewWithArgs(viewArgs, viewClass) { if (!viewClass) { viewClass = Ember.View.extend(); } diff --git a/app/assets/javascripts/discourse/views/discovery-categories.js.es6 b/app/assets/javascripts/discourse/views/discovery-categories.js.es6 index 4d111d66c..59721af08 100644 --- a/app/assets/javascripts/discourse/views/discovery-categories.js.es6 +++ b/app/assets/javascripts/discourse/views/discovery-categories.js.es6 @@ -1,6 +1,6 @@ import UrlRefresh from 'discourse/mixins/url-refresh'; -export default Discourse.View.extend(UrlRefresh, { +export default Ember.View.extend(UrlRefresh, { _addBodyClass: function() { $('body').addClass('categories-list'); }.on('didInsertElement'), diff --git a/app/assets/javascripts/discourse/views/discovery-top.js.es6 b/app/assets/javascripts/discourse/views/discovery-top.js.es6 index 62950838e..72d1e7167 100644 --- a/app/assets/javascripts/discourse/views/discovery-top.js.es6 +++ b/app/assets/javascripts/discourse/views/discovery-top.js.es6 @@ -1,4 +1,4 @@ import UrlRefresh from 'discourse/mixins/url-refresh'; import ScrollTop from 'discourse/mixins/scroll-top'; -export default Discourse.View.extend(ScrollTop, UrlRefresh); +export default Ember.View.extend(ScrollTop, UrlRefresh); diff --git a/app/assets/javascripts/discourse/views/discovery-topics.js.es6 b/app/assets/javascripts/discourse/views/discovery-topics.js.es6 index 25b66239b..448db126e 100644 --- a/app/assets/javascripts/discourse/views/discovery-topics.js.es6 +++ b/app/assets/javascripts/discourse/views/discovery-topics.js.es6 @@ -1,7 +1,7 @@ import UrlRefresh from 'discourse/mixins/url-refresh'; import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(LoadMore, UrlRefresh, { +export default Ember.View.extend(LoadMore, UrlRefresh, { eyelineSelector: '.topic-list-item', actions: { diff --git a/app/assets/javascripts/discourse/views/group-index.js.es6 b/app/assets/javascripts/discourse/views/group-index.js.es6 index f16ebf262..4e2517339 100644 --- a/app/assets/javascripts/discourse/views/group-index.js.es6 +++ b/app/assets/javascripts/discourse/views/group-index.js.es6 @@ -1,6 +1,6 @@ import ScrollTop from 'discourse/mixins/scroll-top'; import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(ScrollTop, LoadMore, { +export default Ember.View.extend(ScrollTop, LoadMore, { eyelineSelector: '.user-stream .item', }); diff --git a/app/assets/javascripts/discourse/views/group-members.js.es6 b/app/assets/javascripts/discourse/views/group-members.js.es6 index e3715a47e..cae92ca87 100644 --- a/app/assets/javascripts/discourse/views/group-members.js.es6 +++ b/app/assets/javascripts/discourse/views/group-members.js.es6 @@ -1,6 +1,6 @@ import ScrollTop from 'discourse/mixins/scroll-top'; import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(ScrollTop, LoadMore, { +export default Ember.View.extend(ScrollTop, LoadMore, { eyelineSelector: '.group-members tr', }); diff --git a/app/assets/javascripts/discourse/views/grouped.js.es6 b/app/assets/javascripts/discourse/views/grouped.js.es6 index ed06f49b5..988c16612 100644 --- a/app/assets/javascripts/discourse/views/grouped.js.es6 +++ b/app/assets/javascripts/discourse/views/grouped.js.es6 @@ -1,6 +1,4 @@ -import Presence from 'discourse/mixins/presence'; - -export default Ember.View.extend(Presence, { +export default Ember.View.extend({ _groupInit: function() { this.set('context', this.get('content')); diff --git a/app/assets/javascripts/discourse/views/header.js.es6 b/app/assets/javascripts/discourse/views/header.js.es6 index 906c479fe..281f6bd86 100644 --- a/app/assets/javascripts/discourse/views/header.js.es6 +++ b/app/assets/javascripts/discourse/views/header.js.es6 @@ -1,6 +1,6 @@ let originalZIndex; -export default Discourse.View.extend({ +export default Ember.View.extend({ tagName: 'header', classNames: ['d-header', 'clearfix'], classNameBindings: ['editingTopic'], diff --git a/app/assets/javascripts/discourse/views/modal-body.js.es6 b/app/assets/javascripts/discourse/views/modal-body.js.es6 index ee621d5e3..c5807ea32 100644 --- a/app/assets/javascripts/discourse/views/modal-body.js.es6 +++ b/app/assets/javascripts/discourse/views/modal-body.js.es6 @@ -1,4 +1,4 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ focusInput: true, _setupModal: function() { diff --git a/app/assets/javascripts/discourse/views/quote-button.js.es6 b/app/assets/javascripts/discourse/views/quote-button.js.es6 index e8e1dac4a..1d4f7b760 100644 --- a/app/assets/javascripts/discourse/views/quote-button.js.es6 +++ b/app/assets/javascripts/discourse/views/quote-button.js.es6 @@ -1,4 +1,4 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ classNames: ['quote-button'], classNameBindings: ['visible'], isMouseDown: false, diff --git a/app/assets/javascripts/discourse/views/search.js.es6 b/app/assets/javascripts/discourse/views/search.js.es6 index a240a0dec..a9ec93319 100644 --- a/app/assets/javascripts/discourse/views/search.js.es6 +++ b/app/assets/javascripts/discourse/views/search.js.es6 @@ -1,4 +1,4 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ tagName: 'div', classNames: ['d-dropdown'], elementId: 'search-dropdown', diff --git a/app/assets/javascripts/discourse/views/selected-posts.js.es6 b/app/assets/javascripts/discourse/views/selected-posts.js.es6 index d173337d7..f54618bab 100644 --- a/app/assets/javascripts/discourse/views/selected-posts.js.es6 +++ b/app/assets/javascripts/discourse/views/selected-posts.js.es6 @@ -1,4 +1,4 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ elementId: 'selected-posts', classNameBindings: ['customVisibility'], templateName: "selected-posts", diff --git a/app/assets/javascripts/discourse/views/share.js.es6 b/app/assets/javascripts/discourse/views/share.js.es6 index 4bc44acd9..dc0925d7a 100644 --- a/app/assets/javascripts/discourse/views/share.js.es6 +++ b/app/assets/javascripts/discourse/views/share.js.es6 @@ -1,5 +1,5 @@ -export default Discourse.View.extend({ +export default Ember.View.extend({ templateName: 'share', elementId: 'share-link', classNameBindings: ['hasLink'], @@ -15,13 +15,13 @@ export default Discourse.View.extend({ }.property('controller.type', 'controller.postNumber'), hasLink: function() { - if (this.present('controller.link')) return 'visible'; + if (!Ember.isEmpty(this.get('controller.link'))) return 'visible'; return null; }.property('controller.link'), linkChanged: function() { const self = this; - if (this.present('controller.link')) { + if (!Ember.isEmpty(this.get('controller.link'))) { Em.run.next(function() { if (!self.capabilities.touch) { var $linkInput = $('#share-link input'); diff --git a/app/assets/javascripts/discourse/views/topic-admin-menu.js.es6 b/app/assets/javascripts/discourse/views/topic-admin-menu.js.es6 index d19b33d97..05321a454 100644 --- a/app/assets/javascripts/discourse/views/topic-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/views/topic-admin-menu.js.es6 @@ -2,11 +2,11 @@ This view is used for rendering the topic admin menu @class TopicAdminMenuView - @extends Discourse.View + @extends Ember.View @namespace Discourse @module Discourse **/ -export default Discourse.View.extend({ +export default Ember.View.extend({ classNameBindings: ["controller.menuVisible::hidden", ":topic-admin-menu"], _setup: function() { diff --git a/app/assets/javascripts/discourse/views/topic-closing.js.es6 b/app/assets/javascripts/discourse/views/topic-closing.js.es6 index c5f22d503..52c97c9db 100644 --- a/app/assets/javascripts/discourse/views/topic-closing.js.es6 +++ b/app/assets/javascripts/discourse/views/topic-closing.js.es6 @@ -1,6 +1,6 @@ import StringBuffer from 'discourse/mixins/string-buffer'; -export default Discourse.View.extend(StringBuffer, { +export default Ember.View.extend(StringBuffer, { elementId: 'topic-closing-info', delayedRerender: null, @@ -10,7 +10,7 @@ export default Discourse.View.extend(StringBuffer, { 'topic.details.auto_close_hours'], renderString: function(buffer) { - if (!this.present('topic.details.auto_close_at')) return; + if (!!Ember.isEmpty(this.get('topic.details.auto_close_at'))) return; if (this.get("topic.closed")) return; var autoCloseAt = moment(this.get('topic.details.auto_close_at')); diff --git a/app/assets/javascripts/discourse/views/topic-list-item.js.es6 b/app/assets/javascripts/discourse/views/topic-list-item.js.es6 index d1d0ca7e6..cf550a204 100644 --- a/app/assets/javascripts/discourse/views/topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/views/topic-list-item.js.es6 @@ -1,6 +1,6 @@ import StringBuffer from 'discourse/mixins/string-buffer'; -export default Discourse.View.extend(StringBuffer, { +export default Ember.View.extend(StringBuffer, { topic: Em.computed.alias("content"), rerenderTriggers: ['controller.bulkSelectEnabled', 'topic.pinned'], tagName: 'tr', diff --git a/app/assets/javascripts/discourse/views/topic.js.es6 b/app/assets/javascripts/discourse/views/topic.js.es6 index f31911ae0..bd6265ace 100644 --- a/app/assets/javascripts/discourse/views/topic.js.es6 +++ b/app/assets/javascripts/discourse/views/topic.js.es6 @@ -5,7 +5,7 @@ import { listenForViewEvent } from 'discourse/lib/app-events'; import { categoryBadgeHTML } from 'discourse/helpers/category-link'; import Scrolling from 'discourse/mixins/scrolling'; -const TopicView = Discourse.View.extend(AddCategoryClass, AddArchetypeClass, Scrolling, { +const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolling, { templateName: 'topic', topicBinding: 'controller.model', diff --git a/app/assets/javascripts/discourse/views/user-card.js.es6 b/app/assets/javascripts/discourse/views/user-card.js.es6 index 2aa1b4759..6e1b42d22 100644 --- a/app/assets/javascripts/discourse/views/user-card.js.es6 +++ b/app/assets/javascripts/discourse/views/user-card.js.es6 @@ -6,7 +6,7 @@ const clickOutsideEventName = "mousedown.outside-user-card", clickDataExpand = "click.discourse-user-card", clickMention = "click.discourse-user-mention"; -export default Discourse.View.extend(CleansUp, { +export default Ember.View.extend(CleansUp, { elementId: 'user-card', classNameBindings: ['controller.visible:show', 'controller.showBadges', 'controller.hasCardBadgeImage'], allowBackgrounds: setting('allow_profile_backgrounds'), diff --git a/app/assets/javascripts/discourse/views/user-topics-list.js.es6 b/app/assets/javascripts/discourse/views/user-topics-list.js.es6 index 3f21ea245..b60d90761 100644 --- a/app/assets/javascripts/discourse/views/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/views/user-topics-list.js.es6 @@ -1,6 +1,6 @@ import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(LoadMore, { +export default Ember.View.extend(LoadMore, { classNames: ['paginated-topics-list'], eyelineSelector: '.paginated-topics-list .topic-list tr', }); diff --git a/app/assets/javascripts/discourse/views/users.js.es6 b/app/assets/javascripts/discourse/views/users.js.es6 index 9fdb9eb2d..1af01b748 100644 --- a/app/assets/javascripts/discourse/views/users.js.es6 +++ b/app/assets/javascripts/discourse/views/users.js.es6 @@ -1,5 +1,5 @@ import LoadMore from 'discourse/mixins/load-more'; -export default Discourse.View.extend(LoadMore, { +export default Ember.View.extend(LoadMore, { eyelineSelector: '.directory tbody tr' }); diff --git a/app/assets/javascripts/discourse/views/view.js.es6 b/app/assets/javascripts/discourse/views/view.js.es6 deleted file mode 100644 index 03f49906f..000000000 --- a/app/assets/javascripts/discourse/views/view.js.es6 +++ /dev/null @@ -1,3 +0,0 @@ -import Presence from 'discourse/mixins/presence'; - -export default Ember.View.extend(Presence); diff --git a/app/assets/javascripts/main_include.js b/app/assets/javascripts/main_include.js index aff3ff2e4..403271d5f 100644 --- a/app/assets/javascripts/main_include.js +++ b/app/assets/javascripts/main_include.js @@ -47,11 +47,8 @@ //= require ./discourse/models/draft //= require ./discourse/models/composer //= require ./discourse/models/invite -//= require ./discourse/controllers/controller //= require ./discourse/controllers/discovery-sortable -//= require ./discourse/controllers/object //= require ./discourse/controllers/navigation/default -//= require ./discourse/views/view //= require ./discourse/views/grouped //= require ./discourse/views/container //= require ./discourse/views/modal-body diff --git a/test/javascripts/admin/models/admin-user-test.js.es6 b/test/javascripts/admin/models/admin-user-test.js.es6 index 0ea725f36..5d0b23185 100644 --- a/test/javascripts/admin/models/admin-user-test.js.es6 +++ b/test/javascripts/admin/models/admin-user-test.js.es6 @@ -1,5 +1,6 @@ -module("Discourse.AdminUser"); +import { blank, present } from 'helpers/qunit-helpers'; +module("Discourse.AdminUser"); asyncTestDiscourse('generate key', function() { sandbox.stub(Discourse, 'ajax').returns(Ember.RSVP.resolve({api_key: {id: 1234, key: 'asdfasdf'}})); diff --git a/test/javascripts/admin/models/api-key-test.js.es6 b/test/javascripts/admin/models/api-key-test.js.es6 index 44da70908..07121c9e1 100644 --- a/test/javascripts/admin/models/api-key-test.js.es6 +++ b/test/javascripts/admin/models/api-key-test.js.es6 @@ -1,3 +1,5 @@ +import { present } from 'helpers/qunit-helpers'; + module("Discourse.ApiKey"); test('create', function() { diff --git a/test/javascripts/controllers/discourse-test.js.es6 b/test/javascripts/controllers/discourse-test.js.es6 deleted file mode 100644 index ab8239f85..000000000 --- a/test/javascripts/controllers/discourse-test.js.es6 +++ /dev/null @@ -1,8 +0,0 @@ -import DiscourseController from 'discourse/controllers/controller'; -import Presence from 'discourse/mixins/presence'; - -module("DiscourseController"); - -test("includes mixins", function() { - ok(Presence.detect(DiscourseController.create()), "has Presence"); -}); diff --git a/test/javascripts/controllers/topic-test.js.es6 b/test/javascripts/controllers/topic-test.js.es6 index 7edb95f5b..afef0d4f0 100644 --- a/test/javascripts/controllers/topic-test.js.es6 +++ b/test/javascripts/controllers/topic-test.js.es6 @@ -1,3 +1,5 @@ +import { blank, present } from 'helpers/qunit-helpers'; + moduleFor('controller:topic', 'controller:topic', { needs: ['controller:header', 'controller:modal', 'controller:composer', 'controller:quote-button', 'controller:search', 'controller:topic-progress', 'controller:application'] diff --git a/test/javascripts/helpers/assertions.js b/test/javascripts/helpers/assertions.js index 6fcea3269..b5fa2a0f4 100644 --- a/test/javascripts/helpers/assertions.js +++ b/test/javascripts/helpers/assertions.js @@ -8,14 +8,6 @@ function count(selector) { return find(selector).length; } -function present(obj, text) { - ok(!Ember.isEmpty(obj), text); -} - -function blank(obj, text) { - ok(Ember.isEmpty(obj), text); -} - function containsInstance(collection, klass, text) { ok(klass.detectInstance(_.first(collection)), text); } diff --git a/test/javascripts/helpers/custom-html-test.js.es6 b/test/javascripts/helpers/custom-html-test.js.es6 index 7510aede5..1f2526d54 100644 --- a/test/javascripts/helpers/custom-html-test.js.es6 +++ b/test/javascripts/helpers/custom-html-test.js.es6 @@ -1,3 +1,4 @@ +import { blank } from 'helpers/qunit-helpers'; module("helper:custom-html"); import { getCustomHTML, setCustomHTML } from 'discourse/helpers/custom-html'; diff --git a/test/javascripts/helpers/qunit-helpers.js.es6 b/test/javascripts/helpers/qunit-helpers.js.es6 index 64547080b..153bdb4b8 100644 --- a/test/javascripts/helpers/qunit-helpers.js.es6 +++ b/test/javascripts/helpers/qunit-helpers.js.es6 @@ -1,4 +1,4 @@ -/* global asyncTest */ +/* global asyncTest, fixtures */ import sessionFixtures from 'fixtures/session-fixtures'; import siteFixtures from 'fixtures/site_fixtures'; @@ -101,4 +101,19 @@ function fixture(selector) { return $("#qunit-fixture"); } -export { acceptance, controllerFor, asyncTestDiscourse, fixture, logIn, currentUser }; +function present(obj, text) { + ok(!Ember.isEmpty(obj), text); +} + +function blank(obj, text) { + ok(Ember.isEmpty(obj), text); +} + +export { acceptance, + controllerFor, + asyncTestDiscourse, + fixture, + logIn, + currentUser, + blank, + present }; diff --git a/test/javascripts/lib/category-badge-test.js.es6 b/test/javascripts/lib/category-badge-test.js.es6 index 95f5d897b..55e2da586 100644 --- a/test/javascripts/lib/category-badge-test.js.es6 +++ b/test/javascripts/lib/category-badge-test.js.es6 @@ -1,3 +1,5 @@ +import { blank, present } from 'helpers/qunit-helpers'; + module("lib:category-link"); import parseHTML from 'helpers/parse-html'; diff --git a/test/javascripts/lib/click-track-test.js.es6 b/test/javascripts/lib/click-track-test.js.es6 index 0cbd0c09a..b01d8b423 100644 --- a/test/javascripts/lib/click-track-test.js.es6 +++ b/test/javascripts/lib/click-track-test.js.es6 @@ -1,3 +1,4 @@ +import { blank } from 'helpers/qunit-helpers'; import DiscourseURL from "discourse/lib/url"; import ClickTrack from "discourse/lib/click-track"; diff --git a/test/javascripts/lib/preload-store-test.js.es6 b/test/javascripts/lib/preload-store-test.js.es6 index 0266d84bf..0b296618f 100644 --- a/test/javascripts/lib/preload-store-test.js.es6 +++ b/test/javascripts/lib/preload-store-test.js.es6 @@ -1,3 +1,5 @@ +import { blank } from 'helpers/qunit-helpers'; + module("Discourse.PreloadStore", { setup: function() { PreloadStore.store('bane', 'evil'); diff --git a/test/javascripts/lib/utilities-test.js.es6 b/test/javascripts/lib/utilities-test.js.es6 index 8a10c7fbe..2f94980b3 100644 --- a/test/javascripts/lib/utilities-test.js.es6 +++ b/test/javascripts/lib/utilities-test.js.es6 @@ -1,3 +1,5 @@ +import { blank } from 'helpers/qunit-helpers'; + module("Discourse.Utilities"); var utils = Discourse.Utilities; @@ -123,8 +125,8 @@ test("avatarUrl", function() { }); var setDevicePixelRatio = function(value) { - if(Object.defineProperty) { - Object.defineProperty(window, "devicePixelRatio", { value: 2 }) + if (Object.defineProperty && !window.hasOwnProperty('devicePixelRatio')) { + Object.defineProperty(window, "devicePixelRatio", { value: 2 }); } else { window.devicePixelRatio = value; } diff --git a/test/javascripts/mixins/presence-test.js.es6 b/test/javascripts/mixins/presence-test.js.es6 deleted file mode 100644 index f11a94588..000000000 --- a/test/javascripts/mixins/presence-test.js.es6 +++ /dev/null @@ -1,27 +0,0 @@ -import Presence from 'discourse/mixins/presence'; - -module("mixin:presence"); - -var testObj = Em.Object.createWithMixins(Presence, { - emptyString: "", - nonEmptyString: "Evil Trout", - emptyArray: [], - nonEmptyArray: [1, 2, 3], - age: 34 -}); - -test("present", function() { - ok(testObj.present('nonEmptyString'), "Non empty strings are present"); - ok(!testObj.present('emptyString'), "Empty strings are not present"); - ok(testObj.present('nonEmptyArray'), "Non Empty Arrays are present"); - ok(!testObj.present('emptyArray'), "Empty arrays are not present"); - ok(testObj.present('age'), "integers are present"); -}); - -test("blank", function() { - ok(testObj.blank('emptyString'), "Empty strings are blank"); - ok(!testObj.blank('nonEmptyString'), "Non empty strings are not blank"); - ok(testObj.blank('emptyArray'), "Empty arrays are blank"); - ok(!testObj.blank('nonEmptyArray'), "Non empty arrays are not blank"); - ok(testObj.blank('missing'), "Missing properties are blank"); -}); diff --git a/test/javascripts/mixins/singleton-test.js.es6 b/test/javascripts/mixins/singleton-test.js.es6 index 80f0846da..eeca3caa5 100644 --- a/test/javascripts/mixins/singleton-test.js.es6 +++ b/test/javascripts/mixins/singleton-test.js.es6 @@ -1,3 +1,4 @@ +import { blank, present } from 'helpers/qunit-helpers'; import Singleton from 'discourse/mixins/singleton'; module("mixin:singleton"); diff --git a/test/javascripts/models/composer-test.js.es6 b/test/javascripts/models/composer-test.js.es6 index 1727d2893..e6bb0d74d 100644 --- a/test/javascripts/models/composer-test.js.es6 +++ b/test/javascripts/models/composer-test.js.es6 @@ -1,3 +1,4 @@ +import { blank } from 'helpers/qunit-helpers'; import { currentUser } from 'helpers/qunit-helpers'; module("model:composer"); diff --git a/test/javascripts/models/model-test.js.es6 b/test/javascripts/models/model-test.js.es6 index b8d92921e..3270af8a5 100644 --- a/test/javascripts/models/model-test.js.es6 +++ b/test/javascripts/models/model-test.js.es6 @@ -1,11 +1,6 @@ -import Presence from 'discourse/mixins/presence'; import Model from 'discourse/models/model'; -module("Discourse.Model"); - -test("mixes in Presence", function() { - ok(Presence.detect(Model.create())); -}); +module("model:discourse"); test("extractByKey: converts a list of hashes into a hash of instances of specified class, indexed by their ids", function() { var firstObject = {id: "id_1", foo: "foo_1"}; diff --git a/test/javascripts/models/post-stream-test.js.es6 b/test/javascripts/models/post-stream-test.js.es6 index 5a85360e5..f7795de68 100644 --- a/test/javascripts/models/post-stream-test.js.es6 +++ b/test/javascripts/models/post-stream-test.js.es6 @@ -1,3 +1,4 @@ +import { blank, present } from 'helpers/qunit-helpers'; module("model:post-stream"); import createStore from 'helpers/create-store'; diff --git a/test/javascripts/models/post-test.js.es6 b/test/javascripts/models/post-test.js.es6 index 4b5359f9d..773657750 100644 --- a/test/javascripts/models/post-test.js.es6 +++ b/test/javascripts/models/post-test.js.es6 @@ -1,3 +1,5 @@ +import { present, blank } from 'helpers/qunit-helpers'; + module("Discourse.Post"); var buildPost = function(args) { diff --git a/test/javascripts/models/report-test.js.es6 b/test/javascripts/models/report-test.js.es6 index f66a84bfa..9ae550d15 100644 --- a/test/javascripts/models/report-test.js.es6 +++ b/test/javascripts/models/report-test.js.es6 @@ -1,3 +1,5 @@ +import { blank } from 'helpers/qunit-helpers'; + module("Discourse.Report"); function reportWithData(data) { diff --git a/test/javascripts/models/site-test.js.es6 b/test/javascripts/models/site-test.js.es6 index fa38736ae..65804504d 100644 --- a/test/javascripts/models/site-test.js.es6 +++ b/test/javascripts/models/site-test.js.es6 @@ -1,3 +1,5 @@ +import { blank, present } from 'helpers/qunit-helpers'; + module("Discourse.Site"); test('create', function() { diff --git a/test/javascripts/models/topic-details-test.js.es6 b/test/javascripts/models/topic-details-test.js.es6 index 7fb7fc2f2..75719ad3e 100644 --- a/test/javascripts/models/topic-details-test.js.es6 +++ b/test/javascripts/models/topic-details-test.js.es6 @@ -1,3 +1,4 @@ +import { present } from 'helpers/qunit-helpers'; module("model:topic-details"); import Topic from 'discourse/models/topic'; diff --git a/test/javascripts/models/topic-test.js.es6 b/test/javascripts/models/topic-test.js.es6 index c5a2e578f..a1f7d159e 100644 --- a/test/javascripts/models/topic-test.js.es6 +++ b/test/javascripts/models/topic-test.js.es6 @@ -1,3 +1,4 @@ +import { blank, present } from 'helpers/qunit-helpers'; module("model:topic"); import Topic from 'discourse/models/topic'; diff --git a/test/javascripts/models/user-stream-test.js.es6 b/test/javascripts/models/user-stream-test.js.es6 index 135ee6f22..c5b35985e 100644 --- a/test/javascripts/models/user-stream-test.js.es6 +++ b/test/javascripts/models/user-stream-test.js.es6 @@ -1,4 +1,6 @@ -module("Discourse.User"); +import { blank, present } from 'helpers/qunit-helpers'; + +module("Discourse.UserStream"); test('basics', function(){ var user = Discourse.User.create({id: 1, username: 'eviltrout'}); diff --git a/test/javascripts/views/container-view-test.js.es6 b/test/javascripts/views/container-view-test.js.es6 index e8f3b2a8a..0ebd5808d 100644 --- a/test/javascripts/views/container-view-test.js.es6 +++ b/test/javascripts/views/container-view-test.js.es6 @@ -1,5 +1,3 @@ -import Presence from 'discourse/mixins/presence'; - var SomeViewClass = Ember.View.extend(); function containerHasOnlyOneChild(containerView, klass) { @@ -19,11 +17,6 @@ function childHasProperty(containerView, name) { moduleFor("view:container"); -test("mixes in Presence", function() { - var containerView = this.subject(); - ok(Presence.detect(containerView)); -}); - test("attachViewWithArgs: creates a view of a given class with given properties and appends it to the container", function() { var containerView = this.subject(); containerView.attachViewWithArgs({foo: "foo"}, SomeViewClass);