Skip to content
Permalink
Browse files

DEV: Ember 3.8.0

Co-Authored-By: majakomel <maja.komel@gmail.com>
  • Loading branch information...
majakomel authored and jjaffeux committed Apr 26, 2019
1 parent c617e51 commit 4b455e741ee8bb64074eaabeca7ba5fc2b74bdd7
Showing with 571 additions and 436 deletions.
  1. +1 −1 Gemfile
  2. +2 −2 Gemfile.lock
  3. +10 −8 app/assets/javascripts/admin/components/resumable-upload.js.es6
  4. +7 −7 app/assets/javascripts/admin/controllers/admin-badges-show.js.es6
  5. +4 −3 app/assets/javascripts/admin/controllers/admin-customize-email-templates-edit.js.es6
  6. +4 −3 app/assets/javascripts/admin/controllers/admin-logs-staff-action-logs.js.es6
  7. +5 −1 app/assets/javascripts/admin/controllers/admin-plugins.js.es6
  8. +4 −2 app/assets/javascripts/admin/controllers/admin-user-badges.js.es6
  9. +5 −3 app/assets/javascripts/admin/controllers/admin-users-list-show.js.es6
  10. +12 −11 app/assets/javascripts/admin/mixins/setting-object.js.es6
  11. +10 −8 app/assets/javascripts/admin/models/admin-user.js.es6
  12. +12 −10 app/assets/javascripts/admin/models/color-scheme.js.es6
  13. +22 −12 app/assets/javascripts/admin/models/report.js.es6
  14. +6 −3 app/assets/javascripts/admin/models/screened-email.js.es6
  15. +6 −3 app/assets/javascripts/admin/models/screened-url.js.es6
  16. +31 −30 app/assets/javascripts/admin/models/tl3-requirements.js.es6
  17. +8 −3 app/assets/javascripts/discourse/components/badge-button.js.es6
  18. +5 −5 app/assets/javascripts/discourse/components/basic-topic-list.js.es6
  19. +16 −4 app/assets/javascripts/discourse/components/d-button.js.es6
  20. +8 −7 app/assets/javascripts/discourse/components/discourse-banner.js.es6
  21. +10 −6 app/assets/javascripts/discourse/components/discourse-tag-bound.js.es6
  22. +9 −6 app/assets/javascripts/discourse/components/edit-category-tab.js.es6
  23. +6 −3 app/assets/javascripts/discourse/components/preference-checkbox.js.es6
  24. +11 −8 app/assets/javascripts/discourse/components/tag-drop-link.js.es6
  25. +8 −2 app/assets/javascripts/discourse/components/text-field.js.es6
  26. +5 −3 app/assets/javascripts/discourse/components/top-period-buttons.js.es6
  27. +19 −16 app/assets/javascripts/discourse/components/topic-list.js.es6
  28. +5 −3 app/assets/javascripts/discourse/components/topic-status.js.es6
  29. +9 −5 app/assets/javascripts/discourse/components/user-badge.js.es6
  30. +4 −2 app/assets/javascripts/discourse/components/user-field.js.es6
  31. +5 −2 app/assets/javascripts/discourse/controllers/about.js.es6
  32. +6 −3 app/assets/javascripts/discourse/controllers/badges/index.js.es6
  33. +4 −3 app/assets/javascripts/discourse/controllers/badges/show.js.es6
  34. +12 −15 app/assets/javascripts/discourse/controllers/composer.js.es6
  35. +36 −29 app/assets/javascripts/discourse/controllers/create-account.js.es6
  36. +25 −30 app/assets/javascripts/discourse/controllers/discovery/topics.js.es6
  37. +25 −19 app/assets/javascripts/discourse/controllers/edit-category.js.es6
  38. +13 −7 app/assets/javascripts/discourse/controllers/exception.js.es6
  39. +9 −6 app/assets/javascripts/discourse/controllers/flag.js.es6
  40. +5 −4 app/assets/javascripts/discourse/controllers/login.js.es6
  41. +4 −2 app/assets/javascripts/discourse/controllers/navigation/categories.js.es6
  42. +4 −1 app/assets/javascripts/discourse/controllers/navigation/default.js.es6
  43. +6 −3 app/assets/javascripts/discourse/controllers/preferences/about.js.es6
  44. +3 −2 app/assets/javascripts/discourse/controllers/preferences/interface.js.es6
  45. +3 −2 app/assets/javascripts/discourse/controllers/reorder-categories.js.es6
  46. +4 −2 app/assets/javascripts/discourse/controllers/search-help.js.es6
  47. +4 −4 app/assets/javascripts/discourse/controllers/user-private-messages.js.es6
  48. +10 −8 app/assets/javascripts/discourse/lib/computed.js.es6
  49. +12 −13 app/assets/javascripts/discourse/mixins/badge-select-controller.js.es6
  50. +1 −3 app/assets/javascripts/discourse/models/action-summary.js.es6
  51. +8 −5 app/assets/javascripts/discourse/models/badge.js.es6
  52. +32 −30 app/assets/javascripts/discourse/models/composer.js.es6
  53. +6 −3 app/assets/javascripts/discourse/models/permission-type.js.es6
  54. +22 −26 app/assets/javascripts/discourse/models/post.js.es6
  55. +6 −3 app/assets/javascripts/discourse/models/result-set.js.es6
  56. +7 −5 app/assets/javascripts/discourse/models/topic-details.js.es6
  57. +7 −6 app/assets/javascripts/discourse/models/user-action-stat.js.es6
  58. +12 −11 app/assets/javascripts/discourse/models/user-action.js.es6
  59. +3 −1 app/assets/javascripts/discourse/models/user-badge.js.es6
  60. +7 −5 app/assets/javascripts/discourse/models/user-stream.js.es6
  61. +4 −1 app/assets/javascripts/discourse/raw-views/list/visited-line.js.es6
  62. +1 −1 app/assets/javascripts/discourse/templates/components/basic-topic-list.hbs
  63. +1 −1 app/assets/javascripts/discourse/templates/components/topic-list.hbs
@@ -49,7 +49,7 @@ gem 'onebox', '1.8.86'
gem 'http_accept_language', '~>2.0.5', require: false

gem 'ember-rails', '0.18.5'
gem 'discourse-ember-source', '~> 3.7.0'
gem 'discourse-ember-source', '~> 3.8.0'
gem 'ember-handlebars-template', '0.8.0'
gem 'barber'

@@ -108,7 +108,7 @@ GEM
terminal-table (~> 1)
debug_inspector (0.0.3)
diff-lcs (1.3)
discourse-ember-source (3.7.0.2)
discourse-ember-source (3.8.0.1)
discourse_image_optim (0.26.2)
exifr (~> 1.2, >= 1.2.2)
fspath (~> 3.0)
@@ -472,7 +472,7 @@ DEPENDENCIES
colored2
cppjieba_rb
danger
discourse-ember-source (~> 3.7.0)
discourse-ember-source (~> 3.8.0)
discourse_image_optim
email_reply_trimmer (~> 0.1)
ember-handlebars-template (= 0.8.0)
@@ -1,5 +1,6 @@
import { iconHTML } from "discourse-common/lib/icon-library";
import { bufferedRender } from "discourse-common/lib/buffered-render";
import computed from "ember-addons/ember-computed-decorators";

/*global Resumable:true */

@@ -27,18 +28,19 @@ export default Ember.Component.extend(

rerenderTriggers: ["isUploading", "progress"],

translatedTitle: function() {
const title = this.get("title");
return title ? I18n.t(title) : this.get("text");
}.property("title", "text"),
@computed("title", "text")
translatedTitle(title, text) {
return title ? I18n.t(title) : text;
},

text: function() {
if (this.get("isUploading")) {
return this.get("progress") + " %";
@computed("isUploading", "progress")
text(isUploading, progress) {
if (isUploading) {
return progress + " %";
} else {
return this.get("uploadText");
}
}.property("isUploading", "progress"),
},

buildBuffer(buffer) {
const icon = this.get("isUploading") ? "times" : "upload";
@@ -1,6 +1,7 @@
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import { propertyNotEqual } from "discourse/lib/computed";
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend(bufferedProperty("model"), {
adminBadges: Ember.inject.controller(),
@@ -17,14 +18,13 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
readOnly: Ember.computed.alias("buffered.system"),
showDisplayName: propertyNotEqual("name", "displayName"),

hasQuery: function() {
const bQuery = this.get("buffered.query");
if (bQuery) {
return bQuery.trim().length > 0;
@computed("model.query", "buffered.query")
hasQuery(modelQuery, bufferedQuery) {
if (bufferedQuery) {
return bufferedQuery.trim().length > 0;
}
const mQuery = this.get("model.query");
return mQuery && mQuery.trim().length > 0;
}.property("model.query", "buffered.query"),
return modelQuery && modelQuery.trim().length > 0;
},

_resetSaving: function() {
this.set("saving", false);
@@ -1,17 +1,18 @@
import { popupAjaxError } from "discourse/lib/ajax-error";
import { bufferedProperty } from "discourse/mixins/buffered-content";
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend(bufferedProperty("emailTemplate"), {
saved: false,

hasMultipleSubjects: function() {
const buffered = this.get("buffered");
@computed("buffered")
hasMultipleSubjects(buffered) {
if (buffered.getProperties("subject")["subject"]) {
return false;
} else {
return buffered.getProperties("id")["id"];
}
}.property("buffered"),
},

actions: {
saveChanges() {
@@ -1,6 +1,7 @@
import { exportEntity } from "discourse/lib/export-csv";
import { outputExportResult } from "discourse/lib/export-result";
import StaffActionLog from "admin/models/staff-action-log";
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend({
loading: false,
@@ -20,14 +21,14 @@ export default Ember.Controller.extend({
}
}.observes("filterActionId"),

actionFilter: function() {
var name = this.get("filters.action_name");
@computed("filters.action_name")
actionFilter(name) {
if (name) {
return I18n.t("admin.logs.staff_actions.actions." + name);
} else {
return null;
}
}.property("filters.action_name"),
},

showInstructions: Ember.computed.gt("model.length", 0),

@@ -1,4 +1,7 @@
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend({
@computed
adminRoutes: function() {
return this.get("model")
.map(p => {
@@ -7,7 +10,8 @@ export default Ember.Controller.extend({
}
})
.compact();
}.property(),
},

actions: {
clearFilter() {
this.setProperties({ filter: "", onlyOverridden: false });
@@ -1,5 +1,6 @@
import GrantBadgeController from "discourse/mixins/grant-badge-controller";
import { popupAjaxError } from "discourse/lib/ajax-error";
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend(GrantBadgeController, {
adminUser: Ember.inject.controller(),
@@ -10,7 +11,8 @@ export default Ember.Controller.extend(GrantBadgeController, {
sortedBadges: Ember.computed.sort("model", "badgeSortOrder"),
badgeSortOrder: ["granted_at:desc"],

groupedBadges: function() {
@computed("model", "model.[]", "model.expandedBadges.[]")
groupedBadges() {
const allBadges = this.get("model");

var grouped = _.groupBy(allBadges, badge => badge.badge_id);
@@ -46,7 +48,7 @@ export default Ember.Controller.extend(GrantBadgeController, {
.sortBy(group => group.granted_at)
.reverse()
.value();
}.property("model", "model.[]", "model.expandedBadges.[]"),
},

actions: {
expandGroup: function(userBadge) {
@@ -2,6 +2,7 @@ import debounce from "discourse/lib/debounce";
import { i18n } from "discourse/lib/computed";
import AdminUser from "admin/models/admin-user";
import CanCheckEmails from "discourse/mixins/can-check-emails";
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Controller.extend(CanCheckEmails, {
model: null,
@@ -14,9 +15,10 @@ export default Ember.Controller.extend(CanCheckEmails, {
selectAll: false,
searchHint: i18n("search_hint"),

title: function() {
return I18n.t("admin.users.titles." + this.get("query"));
}.property("query"),
@computed("query")
title(query) {
return I18n.t("admin.users.titles." + query);
},

_filterUsers: debounce(function() {
this._refreshUsers();
@@ -1,32 +1,33 @@
export default Ember.Mixin.create({
overridden: function() {
let val = this.get("value"),
defaultVal = this.get("default");
import computed from "ember-addons/ember-computed-decorators";

export default Ember.Mixin.create({
@computed("value", "default")
overridden(val, defaultVal) {
if (val === null) val = "";
if (defaultVal === null) defaultVal = "";

return val.toString() !== defaultVal.toString();
}.property("value", "default"),
},

validValues: function() {
@computed("valid_values")
validValues(validValues) {
const vals = [],
translateNames = this.get("translate_names");

this.get("valid_values").forEach(v => {
validValues.forEach(v => {
if (v.name && v.name.length > 0 && translateNames) {
vals.addObject({ name: I18n.t(v.name), value: v.value });
} else {
vals.addObject(v);
}
});
return vals;
}.property("valid_values"),
},

allowsNone: function() {
const validValues = this.get("valid_values");
@computed("valid_values")
allowsNone(validValues) {
if (validValues && validValues.indexOf("") >= 0) {
return "admin.settings.none";
}
}.property("valid_values")
}
});
@@ -293,17 +293,19 @@ const AdminUser = Discourse.User.extend({
});
},

canLockTrustLevel: function() {
return this.get("trust_level") < 4;
}.property("trust_level"),
@computed("trust_level")
canLockTrustLevel(trustLevel) {
return trustLevel < 4;
},

canSuspend: Ember.computed.not("staff"),

suspendDuration: function() {
const suspended_at = moment(this.suspended_at),
suspended_till = moment(this.suspended_till);
return suspended_at.format("L") + " - " + suspended_till.format("L");
}.property("suspended_till", "suspended_at"),
@computed("suspended_till", "suspended_at")
suspendDuration(suspendedTill, suspendedAt) {
suspendedAt = moment(suspendedAt);
suspendedTill = moment(suspendedTill);
return suspendedAt.format("L") + " - " + suspendedTill.format("L");
},

suspend(data) {
return ajax(`/admin/users/${this.id}/suspend`, {
@@ -1,15 +1,17 @@
import { ajax } from "discourse/lib/ajax";
import ColorSchemeColor from "admin/models/color-scheme-color";
import computed from "ember-addons/ember-computed-decorators";

const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
init: function() {
this._super(...arguments);
this.startTrackingChanges();
},

description: function() {
@computed
description() {
return "" + this.name;
}.property(),
},

startTrackingChanges: function() {
this.set("originals", {
@@ -44,7 +46,8 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
return newScheme;
},

changed: function() {
@computed("name", "colors.@each.changed", "saving")
changed() {
if (!this.originals) return false;
if (this.originals["name"] !== this.get("name")) return true;
if (
@@ -54,24 +57,23 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
)
return true;
return false;
}.property("name", "colors.@each.changed", "saving"),
},

disableSave: function() {
@computed("changed")
disableSave(changed) {
if (this.get("theme_id")) {
return false;
}
return (
!this.get("changed") ||
!changed ||
this.get("saving") ||
_.any(this.get("colors"), function(c) {
return !c.get("valid");
})
);
}.property("changed"),
},

newRecord: function() {
return !this.get("id");
}.property("id"),
newRecord: Ember.computed.not("id"),

save: function(opts) {
if (this.get("is_base") || this.get("disableSave")) return;
@@ -76,25 +76,35 @@ const Report = Discourse.Model.extend({
}
},

todayCount: function() {
@computed("data", "average")
todayCount() {
return this.valueAt(0);
}.property("data", "average"),
yesterdayCount: function() {
},

@computed("data", "average")
yesterdayCount() {
return this.valueAt(1);
}.property("data", "average"),
sevenDaysAgoCount: function() {
},

@computed("data", "average")
sevenDaysAgoCount() {
return this.valueAt(7);
}.property("data", "average"),
thirtyDaysAgoCount: function() {
},

@computed("data", "average")
thirtyDaysAgoCount() {
return this.valueAt(30);
}.property("data", "average"),
},

lastSevenDaysCount: function() {
@computed("data", "average")
lastSevenDaysCount() {
return this.averageCount(7, this.valueFor(1, 7));
}.property("data", "average"),
lastThirtyDaysCount: function() {
},

@computed("data", "average")
lastThirtyDaysCount() {
return this.averageCount(30, this.valueFor(1, 30));
}.property("data", "average"),
},

averageCount(count, value) {
return this.get("average") ? value / count : value;

17 comments on commit 4b455e7

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

@discoursebot

This comment has been minimized.

Copy link

replied Apr 26, 2019

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/topic-list-previews/101646/403

Please sign in to comment.
You can’t perform that action at this time.