Version bump
This commit is contained in:
commit
8d48707d9b
26
.rubocop.yml
26
.rubocop.yml
@ -1,13 +1,16 @@
|
||||
require:
|
||||
- rubocop-discourse
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 2.4
|
||||
DisabledByDefault: true
|
||||
Exclude:
|
||||
- 'db/schema.rb'
|
||||
- 'bundle/**/*'
|
||||
- 'vendor/**/*'
|
||||
- 'node_modules/**/*'
|
||||
- 'public/**/*'
|
||||
- 'plugins/**/gems/**/*'
|
||||
- "db/schema.rb"
|
||||
- "bundle/**/*"
|
||||
- "vendor/**/*"
|
||||
- "node_modules/**/*"
|
||||
- "public/**/*"
|
||||
- "plugins/**/gems/**/*"
|
||||
|
||||
# Prefer &&/|| over and/or.
|
||||
Style/AndOr:
|
||||
@ -57,7 +60,7 @@ Layout/SpaceAroundOperators:
|
||||
Enabled: true
|
||||
|
||||
Layout/SpaceBeforeFirstArg:
|
||||
Enabled: true
|
||||
Enabled: true
|
||||
|
||||
# Defining a method with parameters needs parentheses.
|
||||
Style/MethodDefParentheses:
|
||||
@ -126,6 +129,15 @@ Style/Semicolon:
|
||||
Enabled: true
|
||||
AllowAsExpressionSeparator: true
|
||||
|
||||
Style/RedundantReturn:
|
||||
Enabled: true
|
||||
|
||||
DiscourseCops/NoChdir:
|
||||
Enabled: true
|
||||
Exclude:
|
||||
- 'spec/**/*' # Specs are run sequentially, so chdir can be used
|
||||
- 'plugins/*/spec/**/*'
|
||||
|
||||
Style/GlobalVars:
|
||||
Enabled: true
|
||||
Severity: warning
|
||||
|
||||
17
Gemfile
17
Gemfile
@ -16,13 +16,13 @@ if rails_master?
|
||||
else
|
||||
# until rubygems gives us optional dependencies we are stuck with this
|
||||
# bundle update actionmailer actionpack actionview activemodel activerecord activesupport railties
|
||||
gem 'actionmailer', '6.0.0'
|
||||
gem 'actionpack', '6.0.0'
|
||||
gem 'actionview', '6.0.0'
|
||||
gem 'activemodel', '6.0.0'
|
||||
gem 'activerecord', '6.0.0'
|
||||
gem 'activesupport', '6.0.0'
|
||||
gem 'railties', '6.0.0'
|
||||
gem 'actionmailer', '6.0.1'
|
||||
gem 'actionpack', '6.0.1'
|
||||
gem 'actionview', '6.0.1'
|
||||
gem 'activemodel', '6.0.1'
|
||||
gem 'activerecord', '6.0.1'
|
||||
gem 'activesupport', '6.0.1'
|
||||
gem 'railties', '6.0.1'
|
||||
gem 'sprockets-rails'
|
||||
end
|
||||
|
||||
@ -41,7 +41,7 @@ gem 'redis-namespace'
|
||||
|
||||
gem 'active_model_serializers', '~> 0.8.3'
|
||||
|
||||
gem 'onebox', '1.9.21'
|
||||
gem 'onebox', '1.9.24'
|
||||
|
||||
gem 'http_accept_language', '~>2.0.5', require: false
|
||||
|
||||
@ -143,6 +143,7 @@ group :test, :development do
|
||||
gem 'pry-nav'
|
||||
gem 'byebug', require: ENV['RM_INFO'].nil?
|
||||
gem 'rubocop', require: false
|
||||
gem "rubocop-discourse", require: false
|
||||
gem 'parallel_tests'
|
||||
end
|
||||
|
||||
|
||||
87
Gemfile.lock
87
Gemfile.lock
@ -1,21 +1,21 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
activejob (= 6.0.0)
|
||||
actionmailer (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
activejob (= 6.0.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actionpack (6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actionview (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
actionview (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
@ -24,20 +24,20 @@ GEM
|
||||
actionview (>= 6.0.a)
|
||||
active_model_serializers (0.8.4)
|
||||
activemodel (>= 3.0)
|
||||
activejob (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activejob (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activerecord (6.0.0)
|
||||
activemodel (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activesupport (6.0.0)
|
||||
activemodel (6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
activerecord (6.0.1)
|
||||
activemodel (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
activesupport (6.0.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.1, >= 2.1.8)
|
||||
zeitwerk (~> 2.2)
|
||||
addressable (2.5.2)
|
||||
public_suffix (>= 2.0.2, < 4.0)
|
||||
annotate (2.7.5)
|
||||
@ -72,7 +72,7 @@ GEM
|
||||
rack (>= 0.9.0)
|
||||
binding_of_caller (0.8.0)
|
||||
debug_inspector (>= 0.0.1)
|
||||
bootsnap (1.4.4)
|
||||
bootsnap (1.4.5)
|
||||
msgpack (~> 1.0)
|
||||
builder (3.2.3)
|
||||
bullet (6.0.0)
|
||||
@ -91,7 +91,7 @@ GEM
|
||||
cppjieba_rb (0.3.3)
|
||||
crack (0.4.3)
|
||||
safe_yaml (~> 1.0.0)
|
||||
crass (1.0.4)
|
||||
crass (1.0.5)
|
||||
css_parser (1.7.0)
|
||||
addressable
|
||||
debug_inspector (0.0.3)
|
||||
@ -119,7 +119,7 @@ GEM
|
||||
jquery-rails (>= 1.0.17)
|
||||
railties (>= 3.1)
|
||||
ember-source (2.18.2)
|
||||
erubi (1.8.0)
|
||||
erubi (1.9.0)
|
||||
excon (0.64.0)
|
||||
execjs (2.7.0)
|
||||
exifr (1.3.6)
|
||||
@ -146,7 +146,7 @@ GEM
|
||||
hkdf (0.3.0)
|
||||
htmlentities (4.3.4)
|
||||
http_accept_language (2.0.5)
|
||||
i18n (1.6.0)
|
||||
i18n (1.7.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
image_size (1.5.0)
|
||||
in_threads (1.5.1)
|
||||
@ -173,7 +173,7 @@ GEM
|
||||
logstash-logger (0.26.1)
|
||||
logstash-event (~> 1.2)
|
||||
logster (2.4.1)
|
||||
loofah (2.2.3)
|
||||
loofah (2.3.1)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
lru_redux (1.1.0)
|
||||
@ -188,23 +188,23 @@ GEM
|
||||
method_source (0.9.2)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
mini_racer (0.2.6)
|
||||
mini_racer (0.2.8)
|
||||
libv8 (>= 6.9.411)
|
||||
mini_scheduler (0.12.2)
|
||||
sidekiq
|
||||
mini_sql (0.2.2)
|
||||
mini_suffix (0.3.0)
|
||||
ffi (~> 1.9)
|
||||
minitest (5.11.3)
|
||||
minitest (5.13.0)
|
||||
mocha (1.8.0)
|
||||
metaclass (~> 0.0.1)
|
||||
mock_redis (0.19.0)
|
||||
msgpack (1.2.10)
|
||||
msgpack (1.3.1)
|
||||
multi_json (1.13.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
mustache (1.1.0)
|
||||
nokogiri (1.10.4)
|
||||
nokogiri (1.10.5)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nokogumbo (2.0.1)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
@ -243,7 +243,7 @@ GEM
|
||||
omniauth-twitter (1.4.0)
|
||||
omniauth-oauth (~> 1.1)
|
||||
rack
|
||||
onebox (1.9.21)
|
||||
onebox (1.9.24)
|
||||
htmlentities (~> 4.3)
|
||||
multi_json (~> 1.11)
|
||||
mustache
|
||||
@ -283,14 +283,14 @@ GEM
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.2.0)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rails_multisite (2.0.7)
|
||||
activerecord (> 4.2, < 7)
|
||||
railties (> 4.2, < 7)
|
||||
railties (6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
railties (6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.20.3, < 2.0)
|
||||
@ -348,6 +348,8 @@ GEM
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 1.7)
|
||||
rubocop-discourse (1.0.1)
|
||||
rubocop (>= 0.69.0)
|
||||
ruby-openid (2.7.0)
|
||||
ruby-prof (0.17.0)
|
||||
ruby-progressbar (1.10.0)
|
||||
@ -418,20 +420,20 @@ GEM
|
||||
hkdf (~> 0.2)
|
||||
jwt (~> 2.0)
|
||||
yaml-lint (0.0.10)
|
||||
zeitwerk (2.1.10)
|
||||
zeitwerk (2.2.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
actionmailer (= 6.0.0)
|
||||
actionpack (= 6.0.0)
|
||||
actionview (= 6.0.0)
|
||||
actionmailer (= 6.0.1)
|
||||
actionpack (= 6.0.1)
|
||||
actionview (= 6.0.1)
|
||||
actionview_precompiler
|
||||
active_model_serializers (~> 0.8.3)
|
||||
activemodel (= 6.0.0)
|
||||
activerecord (= 6.0.0)
|
||||
activesupport (= 6.0.0)
|
||||
activemodel (= 6.0.1)
|
||||
activerecord (= 6.0.1)
|
||||
activesupport (= 6.0.1)
|
||||
annotate
|
||||
aws-sdk-s3
|
||||
aws-sdk-sns
|
||||
@ -497,7 +499,7 @@ DEPENDENCIES
|
||||
omniauth-oauth2
|
||||
omniauth-openid
|
||||
omniauth-twitter
|
||||
onebox (= 1.9.21)
|
||||
onebox (= 1.9.24)
|
||||
openid-redis-store
|
||||
parallel_tests
|
||||
pg
|
||||
@ -508,7 +510,7 @@ DEPENDENCIES
|
||||
rack-mini-profiler
|
||||
rack-protection
|
||||
rails_multisite
|
||||
railties (= 6.0.0)
|
||||
railties (= 6.0.1)
|
||||
rake
|
||||
rb-fsevent
|
||||
rb-inotify (~> 0.9)
|
||||
@ -524,6 +526,7 @@ DEPENDENCIES
|
||||
rspec-rails (= 4.0.0.beta2)
|
||||
rtlit
|
||||
rubocop
|
||||
rubocop-discourse
|
||||
ruby-prof
|
||||
ruby-readability
|
||||
rubyzip
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import Component from "@ember/component";
|
||||
import loadScript from "discourse/lib/load-script";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
import { on } from "@ember/object/evented";
|
||||
|
||||
export default Component.extend({
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { renderSpinner } from "discourse/helpers/loading-spinner";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import { observes, on } from "ember-addons/ember-computed-decorators";
|
||||
import { observes, on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend(
|
||||
bufferedRender({
|
||||
@ -35,7 +35,7 @@ export default Component.extend(
|
||||
|
||||
@on("init")
|
||||
@observes("logs.[]")
|
||||
_updateFormattedLogs: debounce(function() {
|
||||
_updateFormattedLogs: discourseDebounce(function() {
|
||||
const logs = this.logs;
|
||||
if (logs.length === 0) return;
|
||||
|
||||
|
||||
@ -1,36 +1,30 @@
|
||||
import Component from "@ember/component";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
||||
export default Component.extend(
|
||||
bufferedRender({
|
||||
tagName: "th",
|
||||
classNames: ["sortable"],
|
||||
rerenderTriggers: ["order", "ascending"],
|
||||
|
||||
buildBuffer(buffer) {
|
||||
const icon = this.icon;
|
||||
|
||||
if (icon) {
|
||||
buffer.push(iconHTML(icon));
|
||||
}
|
||||
|
||||
buffer.push(I18n.t(this.i18nKey));
|
||||
|
||||
if (this.field === this.order) {
|
||||
buffer.push(iconHTML(this.ascending ? "chevron-up" : "chevron-down"));
|
||||
}
|
||||
},
|
||||
|
||||
click() {
|
||||
const currentOrder = this.order;
|
||||
const field = this.field;
|
||||
|
||||
if (currentOrder === field) {
|
||||
this.set("ascending", this.ascending ? null : true);
|
||||
} else {
|
||||
this.setProperties({ order: field, ascending: null });
|
||||
}
|
||||
export default Component.extend({
|
||||
tagName: "th",
|
||||
classNames: ["sortable"],
|
||||
chevronIcon: null,
|
||||
toggleProperties() {
|
||||
if (this.order === this.field) {
|
||||
this.set("ascending", this.ascending ? null : true);
|
||||
} else {
|
||||
this.setProperties({ order: this.field, ascending: null });
|
||||
}
|
||||
})
|
||||
);
|
||||
},
|
||||
toggleChevron() {
|
||||
if (this.order === this.field) {
|
||||
let chevron = iconHTML(this.ascending ? "chevron-up" : "chevron-down");
|
||||
this.set("chevronIcon", `${chevron}`.htmlSafe());
|
||||
} else {
|
||||
this.set("chevronIcon", null);
|
||||
}
|
||||
},
|
||||
click() {
|
||||
this.toggleProperties();
|
||||
},
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
this.toggleChevron();
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["admin-report-storage-stats"],
|
||||
@ -10,32 +10,32 @@ export default Component.extend({
|
||||
backupStats: alias("model.data.backups"),
|
||||
uploadStats: alias("model.data.uploads"),
|
||||
|
||||
@computed("backupStats")
|
||||
@discourseComputed("backupStats")
|
||||
showBackupStats(stats) {
|
||||
return stats && this.currentUser.admin;
|
||||
},
|
||||
|
||||
@computed("backupLocation")
|
||||
@discourseComputed("backupLocation")
|
||||
backupLocationName(backupLocation) {
|
||||
return I18n.t(`admin.backups.location.${backupLocation}`);
|
||||
},
|
||||
|
||||
@computed("backupStats.used_bytes")
|
||||
@discourseComputed("backupStats.used_bytes")
|
||||
usedBackupSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("backupStats.free_bytes")
|
||||
@discourseComputed("backupStats.free_bytes")
|
||||
freeBackupSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("uploadStats.used_bytes")
|
||||
@discourseComputed("uploadStats.used_bytes")
|
||||
usedUploadSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
},
|
||||
|
||||
@computed("uploadStats.free_bytes")
|
||||
@discourseComputed("uploadStats.free_bytes")
|
||||
freeUploadSpace(bytes) {
|
||||
return I18n.toHumanSize(bytes);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "td",
|
||||
@ -8,7 +8,7 @@ export default Component.extend({
|
||||
classNameBindings: ["type", "property"],
|
||||
options: null,
|
||||
|
||||
@computed("label", "data", "options")
|
||||
@discourseComputed("label", "data", "options")
|
||||
computedLabel(label, data, options) {
|
||||
return label.compute(data, options || {});
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "th",
|
||||
@ -7,12 +7,12 @@ export default Component.extend({
|
||||
classNameBindings: ["label.mainProperty", "label.type", "isCurrentSort"],
|
||||
attributeBindings: ["label.title:title"],
|
||||
|
||||
@computed("currentSortLabel.sortProperty", "label.sortProperty")
|
||||
@discourseComputed("currentSortLabel.sortProperty", "label.sortProperty")
|
||||
isCurrentSort(currentSortField, labelSortField) {
|
||||
return currentSortField === labelSortField;
|
||||
},
|
||||
|
||||
@computed("currentSortDirection")
|
||||
@discourseComputed("currentSortDirection")
|
||||
sortIcon(currentSortDirection) {
|
||||
return currentSortDirection === 1 ? "caret-up" : "caret-down";
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const PAGES_LIMIT = 8;
|
||||
|
||||
@ -13,12 +13,16 @@ export default Component.extend({
|
||||
perPage: alias("options.perPage"),
|
||||
page: 0,
|
||||
|
||||
@computed("model.computedLabels.length")
|
||||
@discourseComputed("model.computedLabels.length")
|
||||
twoColumns(labelsLength) {
|
||||
return labelsLength === 2;
|
||||
},
|
||||
|
||||
@computed("totalsForSample", "options.total", "model.dates_filtering")
|
||||
@discourseComputed(
|
||||
"totalsForSample",
|
||||
"options.total",
|
||||
"model.dates_filtering"
|
||||
)
|
||||
showTotalForSample(totalsForSample, total, datesFiltering) {
|
||||
// check if we have at least one cell which contains a value
|
||||
const sum = totalsForSample
|
||||
@ -29,12 +33,16 @@ export default Component.extend({
|
||||
return sum >= 1 && total && datesFiltering;
|
||||
},
|
||||
|
||||
@computed("model.total", "options.total", "twoColumns")
|
||||
@discourseComputed("model.total", "options.total", "twoColumns")
|
||||
showTotal(reportTotal, total, twoColumns) {
|
||||
return reportTotal && total && twoColumns;
|
||||
},
|
||||
|
||||
@computed("model.{average,data}", "totalsForSample.1.value", "twoColumns")
|
||||
@discourseComputed(
|
||||
"model.{average,data}",
|
||||
"totalsForSample.1.value",
|
||||
"twoColumns"
|
||||
)
|
||||
showAverage(model, sampleTotalValue, hasTwoColumns) {
|
||||
return (
|
||||
model.average &&
|
||||
@ -44,17 +52,17 @@ export default Component.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("totalsForSample.1.value", "model.data.length")
|
||||
@discourseComputed("totalsForSample.1.value", "model.data.length")
|
||||
averageForSample(totals, count) {
|
||||
return (totals / count).toFixed(0);
|
||||
},
|
||||
|
||||
@computed("model.data.length")
|
||||
@discourseComputed("model.data.length")
|
||||
showSortingUI(dataLength) {
|
||||
return dataLength >= 5;
|
||||
},
|
||||
|
||||
@computed("totalsForSampleRow", "model.computedLabels")
|
||||
@discourseComputed("totalsForSampleRow", "model.computedLabels")
|
||||
totalsForSample(row, labels) {
|
||||
return labels.map(label => {
|
||||
const computedLabel = label.compute(row);
|
||||
@ -64,7 +72,7 @@ export default Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("model.data", "model.computedLabels")
|
||||
@discourseComputed("model.data", "model.computedLabels")
|
||||
totalsForSampleRow(rows, labels) {
|
||||
if (!rows || !rows.length) return {};
|
||||
|
||||
@ -90,7 +98,7 @@ export default Component.extend({
|
||||
return totalsRow;
|
||||
},
|
||||
|
||||
@computed("sortLabel", "sortDirection", "model.data.[]")
|
||||
@discourseComputed("sortLabel", "sortDirection", "model.data.[]")
|
||||
sortedData(sortLabel, sortDirection, data) {
|
||||
data = makeArray(data);
|
||||
|
||||
@ -110,7 +118,7 @@ export default Component.extend({
|
||||
return data;
|
||||
},
|
||||
|
||||
@computed("sortedData.[]", "perPage", "page")
|
||||
@discourseComputed("sortedData.[]", "perPage", "page")
|
||||
paginatedData(data, perPage, page) {
|
||||
if (perPage < data.length) {
|
||||
const start = perPage * page;
|
||||
@ -120,7 +128,7 @@ export default Component.extend({
|
||||
return data;
|
||||
},
|
||||
|
||||
@computed("model.data", "perPage", "page")
|
||||
@discourseComputed("model.data", "perPage", "page")
|
||||
pages(data, perPage, page) {
|
||||
if (!data || data.length <= perPage) return [];
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { alias, or, and, reads, equal, notEmpty } from "@ember/object/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
@ -8,7 +9,7 @@ import { exportEntity } from "discourse/lib/export-csv";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import { isNumeric } from "discourse/lib/utilities";
|
||||
import { SCHEMA_VERSION, default as Report } from "admin/models/report";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
||||
const TABLE_OPTIONS = {
|
||||
perPage: 8,
|
||||
@ -89,23 +90,23 @@ export default Component.extend({
|
||||
|
||||
hasData: notEmpty("model.data"),
|
||||
|
||||
@computed("dataSourceName", "model.type")
|
||||
@discourseComputed("dataSourceName", "model.type")
|
||||
dasherizedDataSourceName(dataSourceName, type) {
|
||||
return (dataSourceName || type || "undefined").replace(/_/g, "-");
|
||||
},
|
||||
|
||||
@computed("dataSourceName", "model.type")
|
||||
@discourseComputed("dataSourceName", "model.type")
|
||||
dataSource(dataSourceName, type) {
|
||||
dataSourceName = dataSourceName || type;
|
||||
return `/admin/reports/${dataSourceName}`;
|
||||
},
|
||||
|
||||
@computed("displayedModes.length")
|
||||
@discourseComputed("displayedModes.length")
|
||||
showModes(displayedModesLength) {
|
||||
return displayedModesLength > 1;
|
||||
},
|
||||
|
||||
@computed("currentMode", "model.modes", "forcedModes")
|
||||
@discourseComputed("currentMode", "model.modes", "forcedModes")
|
||||
displayedModes(currentMode, reportModes, forcedModes) {
|
||||
const modes = forcedModes ? forcedModes.split(",") : reportModes;
|
||||
|
||||
@ -121,12 +122,12 @@ export default Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("currentMode")
|
||||
@discourseComputed("currentMode")
|
||||
modeComponent(currentMode) {
|
||||
return `admin-report-${currentMode}`;
|
||||
},
|
||||
|
||||
@computed("startDate")
|
||||
@discourseComputed("startDate")
|
||||
normalizedStartDate(startDate) {
|
||||
return startDate && typeof startDate.isValid === "function"
|
||||
? moment
|
||||
@ -138,7 +139,7 @@ export default Component.extend({
|
||||
.format("YYYYMMDD");
|
||||
},
|
||||
|
||||
@computed("endDate")
|
||||
@discourseComputed("endDate")
|
||||
normalizedEndDate(endDate) {
|
||||
return endDate && typeof endDate.isValid === "function"
|
||||
? moment
|
||||
@ -150,7 +151,7 @@ export default Component.extend({
|
||||
.format("YYYYMMDD");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"dataSourceName",
|
||||
"normalizedStartDate",
|
||||
"normalizedEndDate",
|
||||
@ -162,8 +163,8 @@ export default Component.extend({
|
||||
let reportKey = "reports:";
|
||||
reportKey += [
|
||||
dataSourceName,
|
||||
Ember.testing ? "start" : startDate.replace(/-/g, ""),
|
||||
Ember.testing ? "end" : endDate.replace(/-/g, ""),
|
||||
ENV.environment === "test" ? "start" : startDate.replace(/-/g, ""),
|
||||
ENV.environment === "test" ? "end" : endDate.replace(/-/g, ""),
|
||||
"[:prev_period]",
|
||||
this.get("reportOptions.table.limit"),
|
||||
customFilters
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { next } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("theme.targets", "onlyOverridden", "showAdvanced")
|
||||
@discourseComputed("theme.targets", "onlyOverridden", "showAdvanced")
|
||||
visibleTargets(targets, onlyOverridden, showAdvanced) {
|
||||
return targets.filter(target => {
|
||||
if (target.advanced && !showAdvanced) {
|
||||
@ -17,7 +17,7 @@ export default Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "onlyOverridden", "theme.fields")
|
||||
@discourseComputed("currentTargetName", "onlyOverridden", "theme.fields")
|
||||
visibleFields(targetName, onlyOverridden, fields) {
|
||||
fields = fields[targetName];
|
||||
if (onlyOverridden) {
|
||||
@ -26,14 +26,14 @@ export default Component.extend({
|
||||
return fields;
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "fieldName")
|
||||
@discourseComputed("currentTargetName", "fieldName")
|
||||
activeSectionMode(targetName, fieldName) {
|
||||
if (["settings", "translations"].includes(targetName)) return "yaml";
|
||||
if (["extra_scss"].includes(targetName)) return "scss";
|
||||
return fieldName && fieldName.indexOf("scss") > -1 ? "scss" : "html";
|
||||
},
|
||||
|
||||
@computed("fieldName", "currentTargetName", "theme")
|
||||
@discourseComputed("fieldName", "currentTargetName", "theme")
|
||||
activeSection: {
|
||||
get(fieldName, target, model) {
|
||||
return model.getField(target, fieldName);
|
||||
@ -46,17 +46,21 @@ export default Component.extend({
|
||||
|
||||
editorId: fmt("fieldName", "currentTargetName", "%@|%@"),
|
||||
|
||||
@computed("maximized")
|
||||
@discourseComputed("maximized")
|
||||
maximizeIcon(maximized) {
|
||||
return maximized ? "discourse-compress" : "discourse-expand";
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "theme.targets")
|
||||
@discourseComputed("currentTargetName", "theme.targets")
|
||||
showAddField(currentTargetName, targets) {
|
||||
return targets.find(t => t.name === currentTargetName).customNames;
|
||||
},
|
||||
|
||||
@computed("currentTargetName", "fieldName", "theme.theme_fields.@each.error")
|
||||
@discourseComputed(
|
||||
"currentTargetName",
|
||||
"fieldName",
|
||||
"theme.theme_fields.@each.error"
|
||||
)
|
||||
error(target, fieldName) {
|
||||
return this.theme.getError(target, fieldName);
|
||||
},
|
||||
|
||||
@ -8,10 +8,10 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { propertyEqual } from "discourse/lib/computed";
|
||||
import { i18n } from "discourse/lib/computed";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend(bufferedProperty("userField"), {
|
||||
editing: empty("userField.id"),
|
||||
@ -22,7 +22,7 @@ export default Component.extend(bufferedProperty("userField"), {
|
||||
|
||||
userFieldsDescription: i18n("admin.user_fields.description"),
|
||||
|
||||
@computed("buffered.field_type")
|
||||
@discourseComputed("buffered.field_type")
|
||||
bufferedFieldType(fieldType) {
|
||||
return UserField.fieldTypeById(fieldType);
|
||||
},
|
||||
@ -39,12 +39,12 @@ export default Component.extend(bufferedProperty("userField"), {
|
||||
$(".user-field-name").select();
|
||||
},
|
||||
|
||||
@computed("userField.field_type")
|
||||
@discourseComputed("userField.field_type")
|
||||
fieldName(fieldType) {
|
||||
return UserField.fieldTypeById(fieldType).get("name");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"userField.editable",
|
||||
"userField.required",
|
||||
"userField.show_on_profile",
|
||||
|
||||
@ -1,30 +1,28 @@
|
||||
import Component from "@ember/component";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
export default Component.extend(
|
||||
bufferedRender({
|
||||
classNames: ["watched-word"],
|
||||
export default Component.extend({
|
||||
classNames: ["watched-word"],
|
||||
watchedWord: null,
|
||||
xIcon: iconHTML("times").htmlSafe(),
|
||||
|
||||
buildBuffer(buffer) {
|
||||
buffer.push(iconHTML("times"));
|
||||
buffer.push(` ${escapeExpression(this.get("word.word"))}`);
|
||||
},
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.set("watchedWord", this.get("word.word"));
|
||||
},
|
||||
|
||||
click() {
|
||||
this.word
|
||||
.destroy()
|
||||
.then(() => {
|
||||
this.action(this.word);
|
||||
})
|
||||
.catch(e => {
|
||||
bootbox.alert(
|
||||
I18n.t("generic_error_with_reason", {
|
||||
error: `http: ${e.status} - ${e.body}`
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
click() {
|
||||
this.word
|
||||
.destroy()
|
||||
.then(() => {
|
||||
this.action(this.word);
|
||||
})
|
||||
.catch(e => {
|
||||
bootbox.alert(
|
||||
I18n.t("generic_error_with_reason", {
|
||||
error: `http: ${e.status} - ${e.body}`
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,27 +1,27 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["hook-event"],
|
||||
typeName: alias("type.name"),
|
||||
|
||||
@computed("typeName")
|
||||
@discourseComputed("typeName")
|
||||
name(typeName) {
|
||||
return I18n.t(`admin.web_hooks.${typeName}_event.name`);
|
||||
},
|
||||
|
||||
@computed("typeName")
|
||||
@discourseComputed("typeName")
|
||||
details(typeName) {
|
||||
return I18n.t(`admin.web_hooks.${typeName}_event.details`);
|
||||
},
|
||||
|
||||
@computed("model.[]", "typeName")
|
||||
@discourseComputed("model.[]", "typeName")
|
||||
eventTypeExists(eventTypes, typeName) {
|
||||
return eventTypes.any(event => event.name === typeName);
|
||||
},
|
||||
|
||||
@computed("eventTypeExists")
|
||||
@discourseComputed("eventTypeExists")
|
||||
enabled: {
|
||||
get(eventTypeExists) {
|
||||
return eventTypeExists;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { ensureJSON, plainJSON, prettyJSON } from "discourse/lib/formatter";
|
||||
@ -10,7 +10,7 @@ export default Component.extend({
|
||||
expandDetailsRequestKey: "request",
|
||||
expandDetailsResponseKey: "response",
|
||||
|
||||
@computed("model.status")
|
||||
@discourseComputed("model.status")
|
||||
statusColorClasses(status) {
|
||||
if (!status) return "";
|
||||
|
||||
@ -21,25 +21,25 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.created_at")
|
||||
@discourseComputed("model.created_at")
|
||||
createdAt(createdAt) {
|
||||
return moment(createdAt).format("YYYY-MM-DD HH:mm:ss");
|
||||
},
|
||||
|
||||
@computed("model.duration")
|
||||
@discourseComputed("model.duration")
|
||||
completion(duration) {
|
||||
const seconds = Math.floor(duration / 10.0) / 100.0;
|
||||
return I18n.t("admin.web_hooks.events.completed_in", { count: seconds });
|
||||
},
|
||||
|
||||
@computed("expandDetails")
|
||||
@discourseComputed("expandDetails")
|
||||
expandRequestIcon(expandDetails) {
|
||||
return expandDetails === this.expandDetailsRequestKey
|
||||
? "ellipsis-h"
|
||||
: "ellipsis-v";
|
||||
},
|
||||
|
||||
@computed("expandDetails")
|
||||
@discourseComputed("expandDetails")
|
||||
expandResponseIcon(expandDetails) {
|
||||
return expandDetails === this.expandDetailsResponseKey
|
||||
? "ellipsis-h"
|
||||
|
||||
@ -1,33 +1,37 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
|
||||
export default Component.extend(
|
||||
bufferedRender({
|
||||
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
||||
icons: ["far-circle", "times-circle", "circle", "circle"],
|
||||
export default Component.extend({
|
||||
classes: ["text-muted", "text-danger", "text-successful", "text-muted"],
|
||||
icons: ["far-circle", "times-circle", "circle", "circle"],
|
||||
circleIcon: null,
|
||||
deliveryStatus: null,
|
||||
|
||||
@computed("deliveryStatuses", "model.last_delivery_status")
|
||||
status(deliveryStatuses, lastDeliveryStatus) {
|
||||
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
||||
},
|
||||
@discourseComputed("deliveryStatuses", "model.last_delivery_status")
|
||||
status(deliveryStatuses, lastDeliveryStatus) {
|
||||
return deliveryStatuses.find(s => s.id === lastDeliveryStatus);
|
||||
},
|
||||
|
||||
@computed("status.id", "icons")
|
||||
icon(statusId, icons) {
|
||||
return icons[statusId - 1];
|
||||
},
|
||||
@discourseComputed("status.id", "icons")
|
||||
icon(statusId, icons) {
|
||||
return icons[statusId - 1];
|
||||
},
|
||||
|
||||
@computed("status.id", "classes")
|
||||
class(statusId, classes) {
|
||||
return classes[statusId - 1];
|
||||
},
|
||||
@discourseComputed("status.id", "classes")
|
||||
class(statusId, classes) {
|
||||
return classes[statusId - 1];
|
||||
},
|
||||
|
||||
buildBuffer(buffer) {
|
||||
buffer.push(iconHTML(this.icon, { class: this.class }));
|
||||
buffer.push(
|
||||
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
this.set(
|
||||
"circleIcon",
|
||||
iconHTML(this.icon, { class: this.class }).htmlSafe()
|
||||
);
|
||||
this.set(
|
||||
"deliveryStatus",
|
||||
I18n.t(`admin.web_hooks.delivery_status.${this.get("status.name")}`)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { reads } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
editorId: reads("fieldName"),
|
||||
|
||||
@computed("fieldName")
|
||||
@discourseComputed("fieldName")
|
||||
currentEditorMode(fieldName) {
|
||||
return fieldName === "css" ? "scss" : fieldName;
|
||||
},
|
||||
|
||||
@computed("fieldName", "styles.html", "styles.css")
|
||||
@discourseComputed("fieldName", "styles.html", "styles.css")
|
||||
resetDisabled(fieldName) {
|
||||
return (
|
||||
this.get(`styles.${fieldName}`) ===
|
||||
@ -18,7 +18,7 @@ export default Component.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("styles", "fieldName")
|
||||
@discourseComputed("styles", "fieldName")
|
||||
editorContents: {
|
||||
get(styles, fieldName) {
|
||||
return styles[fieldName];
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { or } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Category from "discourse/models/category";
|
||||
|
||||
export default Component.extend(bufferedProperty("host"), {
|
||||
editToggled: false,
|
||||
@ -22,7 +23,7 @@ export default Component.extend(bufferedProperty("host"), {
|
||||
});
|
||||
},
|
||||
|
||||
@computed("buffered.host", "host.isSaving")
|
||||
@discourseComputed("buffered.host", "host.isSaving")
|
||||
cantSave(host, isSaving) {
|
||||
return isSaving || isEmpty(host);
|
||||
},
|
||||
@ -50,7 +51,7 @@ export default Component.extend(bufferedProperty("host"), {
|
||||
host
|
||||
.save(props)
|
||||
.then(() => {
|
||||
host.set("category", Discourse.Category.findById(this.categoryId));
|
||||
host.set("category", Category.findById(this.categoryId));
|
||||
this.set("editToggled", false);
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
|
||||
@ -1,25 +1,25 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["embed-setting"],
|
||||
|
||||
@computed("field")
|
||||
@discourseComputed("field")
|
||||
inputId(field) {
|
||||
return field.dasherize();
|
||||
},
|
||||
|
||||
@computed("field")
|
||||
@discourseComputed("field")
|
||||
translationKey(field) {
|
||||
return `admin.embedding.${field}`;
|
||||
},
|
||||
|
||||
@computed("type")
|
||||
@discourseComputed("type")
|
||||
isCheckbox(type) {
|
||||
return type === "checkbox";
|
||||
},
|
||||
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
checked: {
|
||||
get(value) {
|
||||
return !!value;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Component from "@ember/component";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import highlightSyntax from "discourse/lib/highlight-syntax";
|
||||
|
||||
export default Component.extend({
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["inline-edit"],
|
||||
@ -21,12 +21,12 @@ export default Component.extend({
|
||||
this.set("checkedInternal", this.checked);
|
||||
},
|
||||
|
||||
@computed("labelKey")
|
||||
@discourseComputed("labelKey")
|
||||
label(key) {
|
||||
return I18n.t(key);
|
||||
},
|
||||
|
||||
@computed("checked", "checkedInternal")
|
||||
@discourseComputed("checked", "checkedInternal")
|
||||
changed(checked, checkedInternal) {
|
||||
return !!checked !== !!checkedInternal;
|
||||
},
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import { later } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import copyText from "discourse/lib/copy-text";
|
||||
@ -9,7 +9,7 @@ import copyText from "discourse/lib/copy-text";
|
||||
export default Component.extend({
|
||||
classNames: ["ip-lookup"],
|
||||
|
||||
@computed("other_accounts.length", "totalOthersWithSameIP")
|
||||
@discourseComputed("other_accounts.length", "totalOthersWithSameIP")
|
||||
otherAccountsToDelete(otherAccountsLength, totalOthersWithSameIP) {
|
||||
// can only delete up to 50 accounts at a time
|
||||
const total = Math.min(50, totalOthersWithSameIP || 0);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { equal } from "@ember/object/computed";
|
||||
import { scheduleOnce } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const ACTIONS = ["delete", "delete_replies", "edit", "none"];
|
||||
|
||||
@ -10,7 +10,7 @@ export default Component.extend({
|
||||
postAction: null,
|
||||
postEdit: null,
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
penaltyActions() {
|
||||
return ACTIONS.map(id => {
|
||||
return { id, name: I18n.t(`admin.user.penalty_post_${id}`) };
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
import Permalink from "admin/models/permalink";
|
||||
|
||||
@ -10,7 +10,7 @@ export default Component.extend({
|
||||
permalinkType: "topic_id",
|
||||
permalinkTypePlaceholder: fmt("permalinkType", "admin.permalink.%@"),
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
permalinkTypes() {
|
||||
return [
|
||||
{ id: "topic_id", name: I18n.t("admin.permalink.topic_id") },
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Category from "discourse/models/category";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import FilterComponent from "admin/components/report-filters/filter";
|
||||
|
||||
export default FilterComponent.extend({
|
||||
@ -7,7 +7,7 @@ export default FilterComponent.extend({
|
||||
|
||||
layoutName: "admin/templates/components/report-filters/category",
|
||||
|
||||
@computed("filter.default")
|
||||
@discourseComputed("filter.default")
|
||||
category(categoryId) {
|
||||
return Category.findById(categoryId);
|
||||
},
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import FilterComponent from "admin/components/report-filters/filter";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default FilterComponent.extend({
|
||||
classNames: ["group-filter"],
|
||||
|
||||
layoutName: "admin/templates/components/report-filters/group",
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
groupOptions() {
|
||||
return (this.site.groups || []).map(group => {
|
||||
return { name: group["name"], value: group["id"] };
|
||||
});
|
||||
},
|
||||
|
||||
@computed("filter.default")
|
||||
@discourseComputed("filter.default")
|
||||
groupId(filterDefault) {
|
||||
return filterDefault ? parseInt(filterDefault, 10) : null;
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@ import Component from "@ember/component";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { bufferedRender } from "discourse-common/lib/buffered-render";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
/*global Resumable:true */
|
||||
|
||||
@ -91,12 +91,12 @@ export default Component.extend(
|
||||
}
|
||||
},
|
||||
|
||||
@computed("title", "text")
|
||||
@discourseComputed("title", "text")
|
||||
translatedTitle(title, text) {
|
||||
return title ? I18n.t(title) : text;
|
||||
},
|
||||
|
||||
@computed("isUploading", "progress")
|
||||
@discourseComputed("isUploading", "progress")
|
||||
text(isUploading, progress) {
|
||||
if (isUploading) {
|
||||
return progress + " %";
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { or } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["controls"],
|
||||
|
||||
buttonDisabled: or("model.isSaving", "saveDisabled"),
|
||||
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
savingText(saving) {
|
||||
return saving ? "saving" : "save";
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
/**
|
||||
@ -12,20 +13,19 @@ import Component from "@ember/component";
|
||||
**/
|
||||
|
||||
import ScreenedIpAddress from "admin/models/screened-ip-address";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["screened-ip-address-form"],
|
||||
formSubmitted: false,
|
||||
actionName: "block",
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
adminWhitelistEnabled() {
|
||||
return Discourse.SiteSettings.use_admin_ip_whitelist;
|
||||
},
|
||||
|
||||
@computed("adminWhitelistEnabled")
|
||||
@discourseComputed("adminWhitelistEnabled")
|
||||
actionNames(adminWhitelistEnabled) {
|
||||
if (adminWhitelistEnabled) {
|
||||
return [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
import { set } from "@ember/object";
|
||||
|
||||
export default Component.extend({
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
enabled: {
|
||||
get(value) {
|
||||
if (isEmpty(value)) {
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import Category from "discourse/models/category";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
selectedCategories: {
|
||||
get(value) {
|
||||
return Discourse.Category.findByIds(value.split("|"));
|
||||
return Category.findByIds(value.split("|"));
|
||||
},
|
||||
set(value) {
|
||||
this.set("value", value.mapBy("id").join("|"));
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
groupChoices() {
|
||||
return this.site.get("groups").map(g => {
|
||||
return { name: g.name, id: g.id.toString() };
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Component.extend({
|
||||
@computed("value")
|
||||
@discourseComputed("value")
|
||||
selectedTags: {
|
||||
get(value) {
|
||||
return value.split("|");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["site-text"],
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
import Component from "@ember/component";
|
||||
import BufferedContent from "discourse/mixins/buffered-content";
|
||||
import SettingComponent from "admin/mixins/setting-component";
|
||||
|
||||
export default Component.extend(BufferedContent, SettingComponent, {
|
||||
layoutName: "admin/templates/components/site-setting",
|
||||
|
||||
_save() {
|
||||
return this.model
|
||||
.save({ [this.setting.setting]: this.convertNamesToIds() })
|
||||
.then(() => this.store.findAll("theme"));
|
||||
},
|
||||
|
||||
convertNamesToIds() {
|
||||
return this.get("buffered.value")
|
||||
.split("|")
|
||||
.filter(Boolean)
|
||||
.map(themeName => {
|
||||
if (themeName !== "") {
|
||||
return this.setting.allThemes.find(theme => theme.name === themeName)
|
||||
.id;
|
||||
}
|
||||
return themeName;
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -2,11 +2,12 @@ import { gt, and } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { escape } from "pretty-text/sanitizer";
|
||||
import ENV from "discourse-common/config/environment";
|
||||
|
||||
const MAX_COMPONENTS = 4;
|
||||
|
||||
@ -43,7 +44,7 @@ export default Component.extend({
|
||||
animate(isInitial) {
|
||||
const $container = $(this.element);
|
||||
const $list = $(this.element.querySelector(".components-list"));
|
||||
if ($list.length === 0 || Ember.testing) {
|
||||
if ($list.length === 0 || ENV.environment === "test") {
|
||||
return;
|
||||
}
|
||||
const duration = 300;
|
||||
@ -54,7 +55,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"theme.component",
|
||||
"theme.childThemes.@each.name",
|
||||
"theme.childThemes.length",
|
||||
@ -75,12 +76,12 @@ export default Component.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("children")
|
||||
@discourseComputed("children")
|
||||
childrenString(children) {
|
||||
return children.join(", ");
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"theme.childThemes.length",
|
||||
"theme.component",
|
||||
"childrenExpanded",
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { gt, equal } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { THEMES, COMPONENTS } from "admin/models/theme";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { getOwner } from "@ember/application";
|
||||
|
||||
export default Component.extend({
|
||||
THEMES: THEMES,
|
||||
@ -16,7 +17,7 @@ export default Component.extend({
|
||||
themesTabActive: equal("currentTab", THEMES),
|
||||
componentsTabActive: equal("currentTab", COMPONENTS),
|
||||
|
||||
@computed("themes", "components", "currentTab")
|
||||
@discourseComputed("themes", "components", "currentTab")
|
||||
themesList(themes, components) {
|
||||
if (this.themesTabActive) {
|
||||
return themes;
|
||||
@ -25,7 +26,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"themesList",
|
||||
"currentTab",
|
||||
"themesList.@each.user_selectable",
|
||||
@ -40,7 +41,7 @@ export default Component.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"themesList",
|
||||
"currentTab",
|
||||
"themesList.@each.user_selectable",
|
||||
@ -70,7 +71,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
navigateToTheme(theme) {
|
||||
Ember.getOwner(this)
|
||||
getOwner(this)
|
||||
.lookup("router:main")
|
||||
.transitionTo("adminCustomizeThemes.show", theme);
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { empty, alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import { on } from "ember-addons/ember-computed-decorators";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { on } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNameBindings: [":value-list"],
|
||||
@ -30,7 +30,7 @@ export default Component.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("choices.[]", "collection.[]")
|
||||
@discourseComputed("choices.[]", "collection.[]")
|
||||
filteredChoices(choices, collection) {
|
||||
return makeArray(choices).filter(i => collection.indexOf(i) < 0);
|
||||
},
|
||||
|
||||
@ -3,10 +3,10 @@ import { schedule } from "@ember/runloop";
|
||||
import Component from "@ember/component";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["watched-word-form"],
|
||||
@ -14,7 +14,7 @@ export default Component.extend({
|
||||
actionKey: null,
|
||||
showMessage: false,
|
||||
|
||||
@computed("regularExpressions")
|
||||
@discourseComputed("regularExpressions")
|
||||
placeholderKey(regularExpressions) {
|
||||
return (
|
||||
"admin.watched_words.form.placeholder" +
|
||||
@ -29,7 +29,7 @@ export default Component.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("word")
|
||||
@discourseComputed("word")
|
||||
isUniqueWord(word) {
|
||||
const words = this.filteredContent || [];
|
||||
const filtered = words.filter(content => content.action === this.actionKey);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Component from "@ember/component";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import UploadMixin from "discourse/mixins/upload";
|
||||
|
||||
export default Component.extend(UploadMixin, {
|
||||
@ -13,7 +13,7 @@ export default Component.extend(UploadMixin, {
|
||||
return { skipValidation: true };
|
||||
},
|
||||
|
||||
@computed("actionKey")
|
||||
@discourseComputed("actionKey")
|
||||
data(actionKey) {
|
||||
return { action_key: actionKey };
|
||||
},
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
@ -7,12 +7,12 @@ export default Ember.Controller.extend({
|
||||
{ id: "single", name: I18n.t("admin.api.single_user") }
|
||||
],
|
||||
|
||||
@computed("userMode")
|
||||
@discourseComputed("userMode")
|
||||
showUserSelector(mode) {
|
||||
return mode === "single";
|
||||
},
|
||||
|
||||
@computed("model.description", "model.username", "userMode")
|
||||
@discourseComputed("model.description", "model.username", "userMode")
|
||||
saveDisabled(description, username, userMode) {
|
||||
if (Ember.isBlank(description)) return true;
|
||||
if (userMode === "single" && Ember.isBlank(username)) return true;
|
||||
|
||||
@ -2,7 +2,7 @@ import { alias, equal } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { setting, i18n } from "discourse/lib/computed";
|
||||
|
||||
export default Controller.extend({
|
||||
@ -12,7 +12,7 @@ export default Controller.extend({
|
||||
backupLocation: setting("backup_location"),
|
||||
localBackupStorage: equal("backupLocation", "local"),
|
||||
|
||||
@computed("status.allowRestore", "status.isOperationRunning")
|
||||
@discourseComputed("status.allowRestore", "status.isOperationRunning")
|
||||
restoreTitle(allowRestore, isOperationRunning) {
|
||||
if (!allowRestore) {
|
||||
return "admin.backups.operations.restore.is_disabled";
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
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 Controller.extend(bufferedProperty("model"), {
|
||||
adminBadges: inject(),
|
||||
@ -19,7 +19,7 @@ export default Controller.extend(bufferedProperty("model"), {
|
||||
readOnly: alias("buffered.system"),
|
||||
showDisplayName: propertyNotEqual("name", "displayName"),
|
||||
|
||||
@computed("model.query", "buffered.query")
|
||||
@discourseComputed("model.query", "buffered.query")
|
||||
hasQuery(modelQuery, bufferedQuery) {
|
||||
if (bufferedQuery) {
|
||||
return bufferedQuery.trim().length > 0;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { later } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.colors", "onlyOverridden")
|
||||
@discourseComputed("model.colors", "onlyOverridden")
|
||||
colors(allColors, onlyOverridden) {
|
||||
if (onlyOverridden) {
|
||||
return allColors.filter(color => color.get("overridden"));
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.@each.id")
|
||||
@discourseComputed("model.@each.id")
|
||||
baseColorScheme() {
|
||||
return this.model.findBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("model.@each.id")
|
||||
@discourseComputed("model.@each.id")
|
||||
baseColorSchemes() {
|
||||
return this.model.filterBy("is_base", true);
|
||||
},
|
||||
|
||||
@computed("baseColorScheme")
|
||||
@discourseComputed("baseColorScheme")
|
||||
baseColors(baseColorScheme) {
|
||||
const baseColorsHash = EmberObject.create({});
|
||||
baseColorScheme.get("colors").forEach(color => {
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
saveButtonText(isSaving) {
|
||||
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
|
||||
},
|
||||
|
||||
@computed("model.changed", "model.isSaving")
|
||||
@discourseComputed("model.changed", "model.isSaving")
|
||||
saveDisabled(changed, isSaving) {
|
||||
return !changed || isSaving;
|
||||
},
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(bufferedProperty("emailTemplate"), {
|
||||
saved: false,
|
||||
|
||||
@computed("buffered.body", "buffered.subject")
|
||||
@discourseComputed("buffered.body", "buffered.subject")
|
||||
saveDisabled(body, subject) {
|
||||
return (
|
||||
this.emailTemplate.body === body && this.emailTemplate.subject === subject
|
||||
);
|
||||
},
|
||||
|
||||
@computed("buffered")
|
||||
@discourseComputed("buffered")
|
||||
hasMultipleSubjects(buffered) {
|
||||
if (buffered.getProperties("subject")["subject"]) {
|
||||
return false;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
section: null,
|
||||
@ -16,7 +16,7 @@ export default Controller.extend({
|
||||
this.set("currentTarget", target && target.id);
|
||||
},
|
||||
|
||||
@computed("currentTarget")
|
||||
@discourseComputed("currentTarget")
|
||||
currentTargetName(id) {
|
||||
const target = this.get("model.targets").find(
|
||||
t => t.id === parseInt(id, 10)
|
||||
@ -24,12 +24,12 @@ export default Controller.extend({
|
||||
return target && target.name;
|
||||
},
|
||||
|
||||
@computed("model.isSaving")
|
||||
@discourseComputed("model.isSaving")
|
||||
saveButtonText(isSaving) {
|
||||
return isSaving ? I18n.t("saving") : I18n.t("admin.customize.save");
|
||||
},
|
||||
|
||||
@computed("model.changed", "model.isSaving")
|
||||
@discourseComputed("model.changed", "model.isSaving")
|
||||
saveDisabled(changed, isSaving) {
|
||||
return !changed || isSaving;
|
||||
},
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { empty, notEmpty, match } from "@ember/object/computed";
|
||||
import {
|
||||
empty,
|
||||
filterBy,
|
||||
match,
|
||||
mapBy,
|
||||
notEmpty
|
||||
} from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { url } from "discourse/lib/computed";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
@ -15,8 +21,17 @@ export default Controller.extend({
|
||||
previewUrl: url("model.id", "/admin/themes/%@/preview"),
|
||||
addButtonDisabled: empty("selectedChildThemeId"),
|
||||
editRouteName: "adminCustomizeThemes.edit",
|
||||
parentThemesNames: mapBy("model.parentThemes", "name"),
|
||||
availableParentThemes: filterBy("allThemes", "component", false),
|
||||
availableActiveParentThemes: filterBy("availableParentThemes", "isActive"),
|
||||
availableThemesNames: mapBy("availableParentThemes", "name"),
|
||||
availableActiveThemesNames: mapBy("availableActiveParentThemes", "name"),
|
||||
availableActiveChildThemes: filterBy("availableChildThemes", "hasParents"),
|
||||
availableComponentsNames: mapBy("availableChildThemes", "name"),
|
||||
availableActiveComponentsNames: mapBy("availableActiveChildThemes", "name"),
|
||||
childThemesNames: mapBy("model.childThemes", "name"),
|
||||
|
||||
@computed("model.editedFields")
|
||||
@discourseComputed("model.editedFields")
|
||||
editedFieldsFormatted() {
|
||||
const descriptions = [];
|
||||
["common", "desktop", "mobile"].forEach(target => {
|
||||
@ -34,13 +49,13 @@ export default Controller.extend({
|
||||
return descriptions;
|
||||
},
|
||||
|
||||
@computed("colorSchemeId", "model.color_scheme_id")
|
||||
@discourseComputed("colorSchemeId", "model.color_scheme_id")
|
||||
colorSchemeChanged(colorSchemeId, existingId) {
|
||||
colorSchemeId = colorSchemeId === null ? null : parseInt(colorSchemeId);
|
||||
colorSchemeId = colorSchemeId === null ? null : parseInt(colorSchemeId, 10);
|
||||
return colorSchemeId !== existingId;
|
||||
},
|
||||
|
||||
@computed("availableChildThemes", "model.childThemes.[]", "model")
|
||||
@discourseComputed("availableChildThemes", "model.childThemes.[]", "model")
|
||||
selectableChildThemes(available, childThemes) {
|
||||
if (available) {
|
||||
const themes = !childThemes
|
||||
@ -50,7 +65,43 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("allThemes", "model.component", "model")
|
||||
@discourseComputed("model.parentThemes.[]")
|
||||
relativesSelectorSettingsForComponent() {
|
||||
return Ember.Object.create({
|
||||
list_type: "compact",
|
||||
type: "list",
|
||||
preview: null,
|
||||
anyValue: false,
|
||||
setting: "parent_theme_ids",
|
||||
label: I18n.t("admin.customize.theme.component_on_themes"),
|
||||
choices: this.availableThemesNames,
|
||||
default: this.parentThemesNames.join("|"),
|
||||
value: this.parentThemesNames.join("|"),
|
||||
defaultValues: this.availableActiveThemesNames.join("|"),
|
||||
allThemes: this.allThemes,
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes")
|
||||
});
|
||||
},
|
||||
|
||||
@discourseComputed("model.parentThemes.[]")
|
||||
relativesSelectorSettingsForTheme() {
|
||||
return Ember.Object.create({
|
||||
list_type: "compact",
|
||||
type: "list",
|
||||
preview: null,
|
||||
anyValue: false,
|
||||
setting: "child_theme_ids",
|
||||
label: I18n.t("admin.customize.theme.included_components"),
|
||||
choices: this.availableComponentsNames,
|
||||
default: this.childThemesNames.join("|"),
|
||||
value: this.childThemesNames.join("|"),
|
||||
defaultValues: this.availableActiveComponentsNames.join("|"),
|
||||
allThemes: this.allThemes,
|
||||
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all")
|
||||
});
|
||||
},
|
||||
|
||||
@discourseComputed("allThemes", "model.component", "model")
|
||||
availableChildThemes(allThemes) {
|
||||
if (!this.get("model.component")) {
|
||||
const themeId = this.get("model.id");
|
||||
@ -60,38 +111,38 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertKey(component) {
|
||||
const type = component ? "component" : "theme";
|
||||
return `admin.customize.theme.convert_${type}`;
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertIcon(component) {
|
||||
return component ? "cube" : "";
|
||||
},
|
||||
|
||||
@computed("model.component")
|
||||
@discourseComputed("model.component")
|
||||
convertTooltip(component) {
|
||||
const type = component ? "component" : "theme";
|
||||
return `admin.customize.theme.convert_${type}_tooltip`;
|
||||
},
|
||||
|
||||
@computed("model.settings")
|
||||
@discourseComputed("model.settings")
|
||||
settings(settings) {
|
||||
return settings.map(setting => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasSettings: notEmpty("settings"),
|
||||
|
||||
@computed("model.translations")
|
||||
@discourseComputed("model.translations")
|
||||
translations(translations) {
|
||||
return translations.map(setting => ThemeSettings.create(setting));
|
||||
},
|
||||
|
||||
hasTranslations: notEmpty("translations"),
|
||||
|
||||
@computed("model.remoteError", "updatingRemote")
|
||||
@discourseComputed("model.remoteError", "updatingRemote")
|
||||
showRemoteError(errorMessage, updating) {
|
||||
return errorMessage && !updating;
|
||||
},
|
||||
@ -189,7 +240,7 @@ export default Controller.extend({
|
||||
let schemeId = this.colorSchemeId;
|
||||
this.set(
|
||||
"model.color_scheme_id",
|
||||
schemeId === null ? null : parseInt(schemeId)
|
||||
schemeId === null ? null : parseInt(schemeId, 10)
|
||||
);
|
||||
this.model.saveChanges("color_scheme_id");
|
||||
},
|
||||
@ -239,9 +290,9 @@ export default Controller.extend({
|
||||
},
|
||||
|
||||
addChildTheme() {
|
||||
let themeId = parseInt(this.selectedChildThemeId);
|
||||
let themeId = parseInt(this.selectedChildThemeId, 10);
|
||||
let theme = this.allThemes.findBy("id", themeId);
|
||||
this.model.addChildTheme(theme);
|
||||
this.model.addChildTheme(theme).then(() => this.store.findAll("theme"));
|
||||
},
|
||||
|
||||
removeUpload(upload) {
|
||||
@ -258,7 +309,9 @@ export default Controller.extend({
|
||||
},
|
||||
|
||||
removeChildTheme(theme) {
|
||||
this.model.removeChildTheme(theme);
|
||||
this.model
|
||||
.removeChildTheme(theme)
|
||||
.then(() => this.store.findAll("theme"));
|
||||
},
|
||||
|
||||
destroy() {
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { THEMES } from "admin/models/theme";
|
||||
|
||||
export default Controller.extend({
|
||||
currentTab: THEMES,
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
fullThemes(themes) {
|
||||
return themes.filter(t => !t.get("component"));
|
||||
},
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
childThemes(themes) {
|
||||
return themes.filter(t => t.get("component"));
|
||||
},
|
||||
|
||||
@computed("model", "model.@each.component")
|
||||
@discourseComputed("model", "model.@each.component")
|
||||
installedThemes(themes) {
|
||||
return themes.map(t => t.name);
|
||||
}
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { makeArray } from "discourse-common/lib/helpers";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import AdminDashboard from "admin/models/admin-dashboard";
|
||||
import Report from "admin/models/report";
|
||||
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||
import { computed } from "@ember/object";
|
||||
|
||||
function staticReport(reportType) {
|
||||
return Ember.computed("reports.[]", function() {
|
||||
return computed("reports.[]", function() {
|
||||
return makeArray(this.reports).find(report => report.type === reportType);
|
||||
});
|
||||
}
|
||||
@ -20,12 +21,12 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
logSearchQueriesEnabled: setting("log_search_queries"),
|
||||
basePath: Discourse.BaseUri,
|
||||
|
||||
@computed("siteSettings.dashboard_general_tab_activity_metrics")
|
||||
@discourseComputed("siteSettings.dashboard_general_tab_activity_metrics")
|
||||
activityMetrics(metrics) {
|
||||
return (metrics || "").split("|").filter(m => m);
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
activityMetricsFilters() {
|
||||
return {
|
||||
startDate: this.lastMonth,
|
||||
@ -33,14 +34,14 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
topReferredTopicsOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
topReferredTopicsFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
@ -50,7 +51,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchFilters() {
|
||||
return {
|
||||
startDate: moment()
|
||||
@ -60,14 +61,14 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchOptions() {
|
||||
return {
|
||||
table: { total: false, limit: 8 }
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
trendingSearchDisabledLabel() {
|
||||
return I18n.t("admin.dashboard.reports.trending_search.disabled", {
|
||||
basePath: Discourse.BaseUri
|
||||
@ -107,7 +108,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
}
|
||||
},
|
||||
|
||||
@computed("startDate", "endDate")
|
||||
@discourseComputed("startDate", "endDate")
|
||||
filters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PeriodComputationMixin from "admin/mixins/period-computation";
|
||||
|
||||
export default Controller.extend(PeriodComputationMixin, {
|
||||
@computed
|
||||
@discourseComputed
|
||||
flagsStatusOptions() {
|
||||
return {
|
||||
table: {
|
||||
@ -13,7 +13,7 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
userFlaggingRatioOptions() {
|
||||
return {
|
||||
table: {
|
||||
@ -23,12 +23,12 @@ export default Controller.extend(PeriodComputationMixin, {
|
||||
};
|
||||
},
|
||||
|
||||
@computed("startDate", "endDate")
|
||||
@discourseComputed("startDate", "endDate")
|
||||
filters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
||||
@computed("lastWeek", "endDate")
|
||||
@discourseComputed("lastWeek", "endDate")
|
||||
lastWeekfilters(startDate, endDate) {
|
||||
return { startDate, endDate };
|
||||
},
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { debounce } from "@ember/runloop";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
const { get } = Ember;
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
|
||||
@computed("model.[]", "filter")
|
||||
@discourseComputed("model.[]", "filter")
|
||||
filterReports(reports, filter) {
|
||||
if (filter) {
|
||||
filter = filter.toLowerCase();
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { setting } from "discourse/lib/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import AdminDashboard from "admin/models/admin-dashboard";
|
||||
import VersionCheck from "admin/models/version-check";
|
||||
|
||||
@ -13,7 +13,7 @@ export default Controller.extend({
|
||||
exceptionController: inject("exception"),
|
||||
showVersionChecks: setting("version_checks"),
|
||||
|
||||
@computed("problems.length")
|
||||
@discourseComputed("problems.length")
|
||||
foundProblems(problemsLength) {
|
||||
return this.currentUser.get("admin") && (problemsLength || 0) > 0;
|
||||
},
|
||||
@ -77,7 +77,7 @@ export default Controller.extend({
|
||||
.finally(() => this.set("loadingProblems", false));
|
||||
},
|
||||
|
||||
@computed("problemsFetchedAt")
|
||||
@discourseComputed("problemsFetchedAt")
|
||||
problemsTimestamp(problemsFetchedAt) {
|
||||
return moment(problemsFetchedAt)
|
||||
.locale("en")
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type}")
|
||||
});
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterIncomingEmails: debounce(function() {
|
||||
filterIncomingEmails: discourseDebounce(function() {
|
||||
this.loadLogs(IncomingEmail);
|
||||
}, 250).observes("filter.{status,from,to,subject}"),
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterIncomingEmails: debounce(function() {
|
||||
filterIncomingEmails: discourseDebounce(function() {
|
||||
this.loadLogs(IncomingEmail);
|
||||
}, 250).observes("filter.{status,from,to,subject,error}"),
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type,reply_key}")
|
||||
});
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import AdminEmailLogsController from "admin/controllers/admin-email-logs";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default AdminEmailLogsController.extend({
|
||||
filterEmailLogs: debounce(function() {
|
||||
filterEmailLogs: discourseDebounce(function() {
|
||||
this.loadLogs();
|
||||
}, 250).observes("filter.{status,user,address,type}")
|
||||
});
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend({
|
||||
@ -7,13 +7,13 @@ export default Controller.extend({
|
||||
embedding: null,
|
||||
|
||||
// show settings if we have at least one created host
|
||||
@computed("embedding.embeddable_hosts.@each.isCreated")
|
||||
@discourseComputed("embedding.embeddable_hosts.@each.isCreated")
|
||||
showSecondary() {
|
||||
const hosts = this.get("embedding.embeddable_hosts");
|
||||
return hosts.length && hosts.findBy("isCreated");
|
||||
},
|
||||
|
||||
@computed("embedding.base_url")
|
||||
@discourseComputed("embedding.base_url")
|
||||
embeddingCode(baseUrl) {
|
||||
const html = `<div id='discourse-comments'></div>
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import ScreenedIpAddress from "admin/models/screened-ip-address";
|
||||
@ -9,7 +9,7 @@ export default Controller.extend({
|
||||
filter: null,
|
||||
savedIpAddress: null,
|
||||
|
||||
show: debounce(function() {
|
||||
show: discourseDebounce(function() {
|
||||
this.set("loading", true);
|
||||
ScreenedIpAddress.findAll(this.filter).then(result => {
|
||||
this.setProperties({ model: result, loading: false });
|
||||
|
||||
@ -5,9 +5,9 @@ import Controller from "@ember/controller";
|
||||
import { exportEntity } from "discourse/lib/export-csv";
|
||||
import { outputExportResult } from "discourse/lib/export-result";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
model: null,
|
||||
@ -15,7 +15,7 @@ export default Controller.extend({
|
||||
filtersExists: gt("filterCount", 0),
|
||||
userHistoryActions: null,
|
||||
|
||||
@computed("filters.action_name")
|
||||
@discourseComputed("filters.action_name")
|
||||
actionFilter(name) {
|
||||
return name ? I18n.t("admin.logs.staff_actions.actions." + name) : null;
|
||||
},
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
import Permalink from "admin/models/permalink";
|
||||
|
||||
export default Controller.extend({
|
||||
loading: false,
|
||||
filter: null,
|
||||
|
||||
show: debounce(function() {
|
||||
show: discourseDebounce(function() {
|
||||
Permalink.findAll(this.filter).then(result => {
|
||||
this.set("model", result);
|
||||
this.set("loading", false);
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
@computed
|
||||
@discourseComputed
|
||||
adminRoutes: function() {
|
||||
return this.model
|
||||
.map(p => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
queryParams: ["start_date", "end_date", "filters"],
|
||||
@ -7,7 +7,7 @@ export default Controller.extend({
|
||||
end_date: null,
|
||||
filters: null,
|
||||
|
||||
@computed("model.type")
|
||||
@discourseComputed("model.type")
|
||||
reportOptions(type) {
|
||||
let options = { table: { perPage: 50, limit: 50, formatNumbers: false } };
|
||||
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
categoryNameKey: null,
|
||||
adminSiteSettings: inject(),
|
||||
|
||||
@computed("adminSiteSettings.visibleSiteSettings", "categoryNameKey")
|
||||
@discourseComputed("adminSiteSettings.visibleSiteSettings", "categoryNameKey")
|
||||
category(categories, nameKey) {
|
||||
return (categories || []).findBy("nameKey", nameKey);
|
||||
},
|
||||
|
||||
@computed("category")
|
||||
@discourseComputed("category")
|
||||
filteredContent(category) {
|
||||
return category ? category.siteSettings : [];
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
@ -76,7 +76,7 @@ export default Controller.extend({
|
||||
);
|
||||
},
|
||||
|
||||
filterContent: debounce(function() {
|
||||
filterContent: discourseDebounce(function() {
|
||||
if (this._skipBounce) {
|
||||
this.set("_skipBounce", false);
|
||||
} else {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { bufferedProperty } from "discourse/mixins/buffered-content";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend(bufferedProperty("siteText"), {
|
||||
saved: false,
|
||||
|
||||
@computed("buffered.value")
|
||||
@discourseComputed("buffered.value")
|
||||
saveDisabled(value) {
|
||||
return this.siteText.value === value;
|
||||
},
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, sort } from "@ember/object/computed";
|
||||
import { next } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
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 Controller.extend(GrantBadgeController, {
|
||||
adminUser: inject(),
|
||||
@ -19,7 +19,7 @@ export default Controller.extend(GrantBadgeController, {
|
||||
this.badgeSortOrder = ["granted_at:desc"];
|
||||
},
|
||||
|
||||
@computed("model", "model.[]", "model.expandedBadges.[]")
|
||||
@discourseComputed("model", "model.[]", "model.expandedBadges.[]")
|
||||
groupedBadges() {
|
||||
const allBadges = this.model;
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import CanCheckEmails from "discourse/mixins/can-check-emails";
|
||||
import { propertyNotEqual, setting } from "discourse/lib/computed";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
|
||||
@ -30,12 +30,12 @@ export default Controller.extend(CanCheckEmails, {
|
||||
"model.can_disable_second_factor"
|
||||
),
|
||||
|
||||
@computed("model.customGroups")
|
||||
@discourseComputed("model.customGroups")
|
||||
customGroupIds(customGroups) {
|
||||
return customGroups.mapBy("id");
|
||||
},
|
||||
|
||||
@computed("customGroupIdsBuffer", "customGroupIds")
|
||||
@discourseComputed("customGroupIdsBuffer", "customGroupIds")
|
||||
customGroupsDirty(buffer, original) {
|
||||
if (buffer === null) return false;
|
||||
|
||||
@ -44,7 +44,7 @@ export default Controller.extend(CanCheckEmails, {
|
||||
: true;
|
||||
},
|
||||
|
||||
@computed("model.automaticGroups")
|
||||
@discourseComputed("model.automaticGroups")
|
||||
automaticGroups(automaticGroups) {
|
||||
return automaticGroups
|
||||
.map(group => {
|
||||
@ -54,26 +54,30 @@ export default Controller.extend(CanCheckEmails, {
|
||||
.join(", ");
|
||||
},
|
||||
|
||||
@computed("model.associated_accounts")
|
||||
@discourseComputed("model.associated_accounts")
|
||||
associatedAccountsLoaded(associatedAccounts) {
|
||||
return typeof associatedAccounts !== "undefined";
|
||||
},
|
||||
|
||||
@computed("model.associated_accounts")
|
||||
@discourseComputed("model.associated_accounts")
|
||||
associatedAccounts(associatedAccounts) {
|
||||
return associatedAccounts
|
||||
.map(provider => `${provider.name} (${provider.description})`)
|
||||
.join(", ");
|
||||
},
|
||||
|
||||
@computed("model.user_fields.[]")
|
||||
@discourseComputed("model.user_fields.[]")
|
||||
userFields(userFields) {
|
||||
return this.site.collectUserFields(userFields);
|
||||
},
|
||||
|
||||
preferencesPath: fmt("model.username_lower", userPath("%@/preferences")),
|
||||
|
||||
@computed("model.can_delete_all_posts", "model.staff", "model.post_count")
|
||||
@discourseComputed(
|
||||
"model.can_delete_all_posts",
|
||||
"model.staff",
|
||||
"model.post_count"
|
||||
)
|
||||
deleteAllPostsExplanation(canDeleteAllPosts, staff, postCount) {
|
||||
if (canDeleteAllPosts) {
|
||||
return null;
|
||||
@ -93,7 +97,7 @@ export default Controller.extend(CanCheckEmails, {
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.canBeDeleted", "model.staff")
|
||||
@discourseComputed("model.canBeDeleted", "model.staff")
|
||||
deleteExplanation(canBeDeleted, staff) {
|
||||
if (canBeDeleted) {
|
||||
return null;
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce 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 Controller.extend(CanCheckEmails, {
|
||||
model: null,
|
||||
@ -24,12 +24,12 @@ export default Controller.extend(CanCheckEmails, {
|
||||
this._canLoadMore = true;
|
||||
},
|
||||
|
||||
@computed("query")
|
||||
@discourseComputed("query")
|
||||
title(query) {
|
||||
return I18n.t("admin.users.titles." + query);
|
||||
},
|
||||
|
||||
_filterUsers: debounce(function() {
|
||||
_filterUsers: discourseDebounce(function() {
|
||||
this.resetFilters();
|
||||
}, 250).observes("listFilter"),
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { or } from "@ember/object/computed";
|
||||
import { schedule } from "@ember/runloop";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import WatchedWord from "admin/models/watched-word";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { fmt } from "discourse/lib/computed";
|
||||
@ -27,22 +27,22 @@ export default Controller.extend({
|
||||
);
|
||||
},
|
||||
|
||||
@computed("actionNameKey", "adminWatchedWords.model")
|
||||
@discourseComputed("actionNameKey", "adminWatchedWords.model")
|
||||
currentAction(actionName) {
|
||||
return this.findAction(actionName);
|
||||
},
|
||||
|
||||
@computed("currentAction.words.[]", "adminWatchedWords.model")
|
||||
@discourseComputed("currentAction.words.[]", "adminWatchedWords.model")
|
||||
filteredContent(words) {
|
||||
return words || [];
|
||||
},
|
||||
|
||||
@computed("actionNameKey")
|
||||
@discourseComputed("actionNameKey")
|
||||
actionDescription(actionNameKey) {
|
||||
return I18n.t("admin.watched_words.action_descriptions." + actionNameKey);
|
||||
},
|
||||
|
||||
@computed("currentAction.count")
|
||||
@discourseComputed("currentAction.count")
|
||||
wordCount(count) {
|
||||
return count || 0;
|
||||
},
|
||||
|
||||
@ -2,7 +2,7 @@ import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
import Controller from "@ember/controller";
|
||||
import debounce from "discourse/lib/debounce";
|
||||
import discourseDebounce from "discourse/lib/debounce";
|
||||
|
||||
export default Controller.extend({
|
||||
filter: null,
|
||||
@ -43,7 +43,7 @@ export default Controller.extend({
|
||||
this.set("model", matchesByAction);
|
||||
},
|
||||
|
||||
filterContent: debounce(function() {
|
||||
filterContent: discourseDebounce(function() {
|
||||
this.filterContentNow();
|
||||
this.set("filtered", !isEmpty(this.filter));
|
||||
}, 250).observes("filter"),
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Controller.extend({
|
||||
pingDisabled: false,
|
||||
@ -14,7 +14,7 @@ export default Controller.extend({
|
||||
this.incomingEventIds = [];
|
||||
},
|
||||
|
||||
@computed("incomingCount")
|
||||
@discourseComputed("incomingCount")
|
||||
hasIncoming(incomingCount) {
|
||||
return incomingCount > 0;
|
||||
},
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import { alias } from "@ember/object/computed";
|
||||
import { inject } from "@ember/controller";
|
||||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { extractDomainFromUrl } from "discourse/lib/utilities";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import InputValidation from "discourse/models/input-validation";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
export default Controller.extend({
|
||||
adminWebHooks: inject(),
|
||||
@ -13,12 +13,12 @@ export default Controller.extend({
|
||||
defaultEventTypes: alias("adminWebHooks.defaultEventTypes"),
|
||||
contentTypes: alias("adminWebHooks.contentTypes"),
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
showTagsFilter() {
|
||||
return this.siteSettings.tagging_enabled;
|
||||
},
|
||||
|
||||
@computed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
@discourseComputed("model.isSaving", "saved", "saveButtonDisabled")
|
||||
savingStatus(isSaving, saved, saveButtonDisabled) {
|
||||
if (isSaving) {
|
||||
return I18n.t("saving");
|
||||
@ -30,25 +30,25 @@ export default Controller.extend({
|
||||
return "";
|
||||
},
|
||||
|
||||
@computed("model.isNew")
|
||||
@discourseComputed("model.isNew")
|
||||
saveButtonText(isNew) {
|
||||
return isNew
|
||||
? I18n.t("admin.web_hooks.create")
|
||||
: I18n.t("admin.web_hooks.save");
|
||||
},
|
||||
|
||||
@computed("model.secret")
|
||||
@discourseComputed("model.secret")
|
||||
secretValidation(secret) {
|
||||
if (!isEmpty(secret)) {
|
||||
if (secret.indexOf(" ") !== -1) {
|
||||
return InputValidation.create({
|
||||
return EmberObject.create({
|
||||
failed: true,
|
||||
reason: I18n.t("admin.web_hooks.secret_invalid")
|
||||
});
|
||||
}
|
||||
|
||||
if (secret.length < 12) {
|
||||
return InputValidation.create({
|
||||
return EmberObject.create({
|
||||
failed: true,
|
||||
reason: I18n.t("admin.web_hooks.secret_too_short")
|
||||
});
|
||||
@ -56,17 +56,17 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
@discourseComputed("model.wildcard_web_hook", "model.web_hook_event_types.[]")
|
||||
eventTypeValidation(isWildcard, eventTypes) {
|
||||
if (!isWildcard && isEmpty(eventTypes)) {
|
||||
return InputValidation.create({
|
||||
return EmberObject.create({
|
||||
failed: true,
|
||||
reason: I18n.t("admin.web_hooks.event_type_missing")
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"model.isSaving",
|
||||
"secretValidation",
|
||||
"eventTypeValidation",
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { inject as service } from "@ember/service";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { dasherize } from "@ember/string";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
||||
@computed("siteSettings.enable_group_directory")
|
||||
@discourseComputed("siteSettings.enable_group_directory")
|
||||
showGroups(enableGroupDirectory) {
|
||||
return !enableGroupDirectory;
|
||||
},
|
||||
|
||||
@computed("siteSettings.enable_badges")
|
||||
@discourseComputed("siteSettings.enable_badges")
|
||||
showBadges(enableBadges) {
|
||||
return this.currentUser.get("admin") && enableBadges;
|
||||
},
|
||||
|
||||
@computed("router._router.currentPath")
|
||||
@discourseComputed("router._router.currentPath")
|
||||
adminContentsClassName(currentPath) {
|
||||
let cssClasses = currentPath
|
||||
.split(".")
|
||||
|
||||
@ -5,9 +5,9 @@ import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
const THEME_FIELD_VARIABLE_TYPE_IDS = [2, 3, 4];
|
||||
@ -69,7 +69,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
enabled: and("nameValid", "fileSelected"),
|
||||
disabled: not("enabled"),
|
||||
|
||||
@computed("name", "adminCustomizeThemesShow.model.theme_fields")
|
||||
@discourseComputed("name", "adminCustomizeThemesShow.model.theme_fields")
|
||||
errorMessage(name, themeFields) {
|
||||
if (name) {
|
||||
if (!name.match(/^[a-z_][a-z0-9_-]*$/i)) {
|
||||
@ -94,7 +94,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
return null;
|
||||
},
|
||||
|
||||
@computed("errorMessage")
|
||||
@discourseComputed("errorMessage")
|
||||
nameValid(errorMessage) {
|
||||
return null === errorMessage;
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { alias, map } from "@ember/object/computed";
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import { escapeExpression } from "discourse/lib/utilities";
|
||||
|
||||
export default Controller.extend({
|
||||
@ -8,7 +8,7 @@ export default Controller.extend({
|
||||
errors: alias("model.errors"),
|
||||
count: alias("model.grant_count"),
|
||||
|
||||
@computed("count", "sample.length")
|
||||
@discourseComputed("count", "sample.length")
|
||||
countWarning(count, sampleLength) {
|
||||
if (count <= 10) {
|
||||
return sampleLength !== count;
|
||||
@ -17,12 +17,12 @@ export default Controller.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("model.query_plan")
|
||||
@discourseComputed("model.query_plan")
|
||||
hasQueryPlan(queryPlan) {
|
||||
return !!queryPlan;
|
||||
},
|
||||
|
||||
@computed("model.query_plan")
|
||||
@discourseComputed("model.query_plan")
|
||||
queryPlanHtml(queryPlan) {
|
||||
let output = `<pre class="badge-query-plan">`;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { observes } from "ember-addons/ember-computed-decorators";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@observes("model")
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import IncomingEmail from "admin/models/incoming-email";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { longDate } from "discourse/lib/formatter";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@computed("model.date")
|
||||
@discourseComputed("model.date")
|
||||
date(d) {
|
||||
return longDate(d);
|
||||
},
|
||||
|
||||
@ -5,9 +5,9 @@ import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { THEMES, COMPONENTS } from "admin/models/theme";
|
||||
import { POPULAR_THEMES } from "discourse-common/helpers/popular-themes";
|
||||
import { set } from "@ember/object";
|
||||
@ -43,7 +43,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
];
|
||||
},
|
||||
|
||||
@computed("themesController.installedThemes")
|
||||
@discourseComputed("themesController.installedThemes")
|
||||
themes(installedThemes) {
|
||||
return POPULAR_THEMES.map(t => {
|
||||
if (installedThemes.includes(t.name)) {
|
||||
@ -53,7 +53,7 @@ export default Controller.extend(ModalFunctionality, {
|
||||
});
|
||||
},
|
||||
|
||||
@computed(
|
||||
@discourseComputed(
|
||||
"loading",
|
||||
"remote",
|
||||
"uploadUrl",
|
||||
@ -102,12 +102,12 @@ export default Controller.extend(ModalFunctionality, {
|
||||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
nameTooShort(name) {
|
||||
return !name || name.length < MIN_NAME_LENGTH;
|
||||
},
|
||||
|
||||
@computed("component")
|
||||
@discourseComputed("component")
|
||||
placeholder(component) {
|
||||
if (component) {
|
||||
return I18n.t("admin.customize.theme.component_name");
|
||||
@ -116,14 +116,14 @@ export default Controller.extend(ModalFunctionality, {
|
||||
}
|
||||
},
|
||||
|
||||
@computed("selection")
|
||||
@discourseComputed("selection")
|
||||
submitLabel(selection) {
|
||||
return `admin.customize.theme.${
|
||||
selection === "create" ? "create" : "install"
|
||||
}`;
|
||||
},
|
||||
|
||||
@computed("privateChecked", "checkPrivate", "publicKey")
|
||||
@discourseComputed("privateChecked", "checkPrivate", "publicKey")
|
||||
showPublicKey(privateChecked, checkPrivate, publicKey) {
|
||||
return privateChecked && checkPrivate && publicKey;
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PenaltyController from "admin/mixins/penalty-controller";
|
||||
|
||||
export default Controller.extend(PenaltyController, {
|
||||
@ -12,7 +12,7 @@ export default Controller.extend(PenaltyController, {
|
||||
this.setProperties({ silenceUntil: null, silencing: false });
|
||||
},
|
||||
|
||||
@computed("silenceUntil", "reason", "silencing")
|
||||
@discourseComputed("silenceUntil", "reason", "silencing")
|
||||
submitDisabled(silenceUntil, reason, silencing) {
|
||||
return silencing || isEmpty(silenceUntil) || !reason || reason.length < 1;
|
||||
},
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { isEmpty } from "@ember/utils";
|
||||
import Controller from "@ember/controller";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import PenaltyController from "admin/mixins/penalty-controller";
|
||||
|
||||
export default Controller.extend(PenaltyController, {
|
||||
@ -12,7 +12,7 @@ export default Controller.extend(PenaltyController, {
|
||||
this.setProperties({ suspendUntil: null, suspending: false });
|
||||
},
|
||||
|
||||
@computed("suspendUntil", "reason", "suspending")
|
||||
@discourseComputed("suspendUntil", "reason", "suspending")
|
||||
submitDisabled(suspendUntil, reason, suspending) {
|
||||
return suspending || isEmpty(suspendUntil) || !reason || reason.length < 1;
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { on, observes } from "ember-addons/ember-computed-decorators";
|
||||
import { on, observes } from "discourse-common/utils/decorators";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import Controller from "@ember/controller";
|
||||
import { default as computed } from "ember-addons/ember-computed-decorators";
|
||||
import { default as discourseComputed } from "discourse-common/utils/decorators";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
@computed("value", "model.compiledRegularExpression")
|
||||
@discourseComputed("value", "model.compiledRegularExpression")
|
||||
matches(value, regexpString) {
|
||||
if (!value || !regexpString) return;
|
||||
let censorRegexp = new RegExp(regexpString, "ig");
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import DiscourseURL from "discourse/lib/url";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
export default Mixin.create({
|
||||
@ -12,7 +12,7 @@ export default Mixin.create({
|
||||
this.availablePeriods = ["yearly", "quarterly", "monthly", "weekly"];
|
||||
},
|
||||
|
||||
@computed("period")
|
||||
@discourseComputed("period")
|
||||
startDate(period) {
|
||||
let fullDay = moment()
|
||||
.locale("en")
|
||||
@ -37,7 +37,7 @@ export default Mixin.create({
|
||||
}
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
lastWeek() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
@ -46,7 +46,7 @@ export default Mixin.create({
|
||||
.subtract(1, "week");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
lastMonth() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
@ -55,7 +55,7 @@ export default Mixin.create({
|
||||
.subtract(1, "month");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
endDate() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
@ -64,7 +64,7 @@ export default Mixin.create({
|
||||
.endOf("day");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
today() {
|
||||
return moment()
|
||||
.locale("en")
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { alias, oneWay } from "@ember/object/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { categoryLinkHTML } from "discourse/helpers/category-link";
|
||||
import { on } from "@ember/object/evented";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import AboutRoute from "discourse/routes/about";
|
||||
import { Promise } from "rsvp";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
|
||||
const CUSTOM_TYPES = [
|
||||
"bool",
|
||||
@ -26,13 +26,21 @@ const CUSTOM_TYPES = [
|
||||
|
||||
const AUTO_REFRESH_ON_SAVE = ["logo", "logo_small", "large_icon"];
|
||||
|
||||
function splitPipes(str) {
|
||||
if (typeof str === "string") {
|
||||
return str.split("|").filter(Boolean);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export default Mixin.create({
|
||||
classNameBindings: [":row", ":setting", "overridden", "typeClass"],
|
||||
content: alias("setting"),
|
||||
validationMessage: null,
|
||||
isSecret: oneWay("setting.secret"),
|
||||
|
||||
@computed("buffered.value", "setting.value")
|
||||
@discourseComputed("buffered.value", "setting.value")
|
||||
dirty(bufferVal, settingVal) {
|
||||
if (bufferVal === null || bufferVal === undefined) bufferVal = "";
|
||||
if (settingVal === null || settingVal === undefined) settingVal = "";
|
||||
@ -40,7 +48,7 @@ export default Mixin.create({
|
||||
return bufferVal.toString() !== settingVal.toString();
|
||||
},
|
||||
|
||||
@computed("setting", "buffered.value")
|
||||
@discourseComputed("setting", "buffered.value")
|
||||
preview(setting, value) {
|
||||
// A bit hacky, but allows us to use helpers
|
||||
if (setting.get("setting") === "category_style") {
|
||||
@ -51,7 +59,6 @@ export default Mixin.create({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let preview = setting.get("preview");
|
||||
if (preview) {
|
||||
return new Handlebars.SafeString(
|
||||
@ -62,22 +69,22 @@ export default Mixin.create({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("componentType")
|
||||
@discourseComputed("componentType")
|
||||
typeClass(componentType) {
|
||||
return componentType.replace(/\_/g, "-");
|
||||
},
|
||||
|
||||
@computed("setting.setting")
|
||||
settingName(setting) {
|
||||
return setting.replace(/\_/g, " ");
|
||||
@discourseComputed("setting.setting", "setting.label")
|
||||
settingName(setting, label) {
|
||||
return label || setting.replace(/\_/g, " ");
|
||||
},
|
||||
|
||||
@computed("type")
|
||||
@discourseComputed("type")
|
||||
componentType(type) {
|
||||
return CUSTOM_TYPES.indexOf(type) !== -1 ? type : "string";
|
||||
},
|
||||
|
||||
@computed("setting")
|
||||
@discourseComputed("setting")
|
||||
type(setting) {
|
||||
if (setting.type === "list" && setting.list_type) {
|
||||
return `${setting.list_type}_list`;
|
||||
@ -86,16 +93,36 @@ export default Mixin.create({
|
||||
return setting.type;
|
||||
},
|
||||
|
||||
@computed("typeClass")
|
||||
@discourseComputed("typeClass")
|
||||
componentName(typeClass) {
|
||||
return "site-settings/" + typeClass;
|
||||
},
|
||||
|
||||
@computed("setting.default", "buffered.value")
|
||||
@discourseComputed("setting.anyValue")
|
||||
allowAny(anyValue) {
|
||||
return anyValue !== false;
|
||||
},
|
||||
|
||||
@discourseComputed("setting.default", "buffered.value")
|
||||
overridden(settingDefault, bufferedValue) {
|
||||
return settingDefault !== bufferedValue;
|
||||
},
|
||||
|
||||
@discourseComputed("buffered.value")
|
||||
bufferedValues: splitPipes,
|
||||
|
||||
@discourseComputed("setting.defaultValues")
|
||||
defaultValues: splitPipes,
|
||||
|
||||
@discourseComputed("defaultValues", "bufferedValues")
|
||||
defaultIsAvailable(defaultValues, bufferedValues) {
|
||||
return (
|
||||
defaultValues &&
|
||||
defaultValues.length > 0 &&
|
||||
!defaultValues.every(value => bufferedValues.includes(value))
|
||||
);
|
||||
},
|
||||
|
||||
_watchEnterKey: on("didInsertElement", function() {
|
||||
$(this.element).on("keydown.setting-enter", ".input-setting-string", e => {
|
||||
if (e.keyCode === 13) {
|
||||
@ -125,7 +152,6 @@ export default Mixin.create({
|
||||
"default_email_messages_level",
|
||||
"default_email_mailing_list_mode",
|
||||
"default_email_mailing_list_mode_frequency",
|
||||
"disable_mailing_list_mode",
|
||||
"default_email_previous_replies",
|
||||
"default_email_in_reply_to",
|
||||
"default_other_new_topic_duration_minutes",
|
||||
@ -151,12 +177,19 @@ export default Mixin.create({
|
||||
const key = this.buffered.get("setting");
|
||||
|
||||
if (defaultUserPreferences.includes(key)) {
|
||||
AboutRoute.create()
|
||||
.model()
|
||||
.then(result => {
|
||||
const data = {};
|
||||
data[key] = this.buffered.get("value");
|
||||
|
||||
ajax(`/admin/site_settings/${key}/user_count.json`, {
|
||||
type: "PUT",
|
||||
data
|
||||
}).then(result => {
|
||||
const count = result.user_count;
|
||||
|
||||
if (count > 0) {
|
||||
const controller = showModal("site-setting-default-categories", {
|
||||
model: {
|
||||
count: result.stats.user_count,
|
||||
count: result.user_count,
|
||||
key: key.replace(/_/g, " ")
|
||||
},
|
||||
admin: true
|
||||
@ -166,7 +199,10 @@ export default Mixin.create({
|
||||
this.updateExistingUsers = controller.updateExistingUsers;
|
||||
this.send("save");
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.send("save");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.send("save");
|
||||
}
|
||||
@ -200,6 +236,16 @@ export default Mixin.create({
|
||||
|
||||
toggleSecret() {
|
||||
this.toggleProperty("isSecret");
|
||||
},
|
||||
|
||||
setDefaultValues() {
|
||||
this.set(
|
||||
"buffered.value",
|
||||
this.bufferedValues
|
||||
.concat(this.defaultValues)
|
||||
.uniq()
|
||||
.join("|")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import Mixin from "@ember/object/mixin";
|
||||
|
||||
export default Mixin.create({
|
||||
@computed("value", "default")
|
||||
@discourseComputed("value", "default")
|
||||
overridden(val, defaultVal) {
|
||||
if (val === null) val = "";
|
||||
if (defaultVal === null) defaultVal = "";
|
||||
@ -10,7 +10,7 @@ export default Mixin.create({
|
||||
return val.toString() !== defaultVal.toString();
|
||||
},
|
||||
|
||||
@computed("valid_values")
|
||||
@discourseComputed("valid_values")
|
||||
validValues(validValues) {
|
||||
const vals = [],
|
||||
translateNames = this.translate_names;
|
||||
@ -25,7 +25,7 @@ export default Mixin.create({
|
||||
return vals;
|
||||
},
|
||||
|
||||
@computed("valid_values")
|
||||
@discourseComputed("valid_values")
|
||||
allowsNone(validValues) {
|
||||
if (validValues && validValues.indexOf("") >= 0) {
|
||||
return "admin.settings.none";
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const GENERAL_ATTRIBUTES = [
|
||||
"updated_at",
|
||||
@ -6,7 +7,7 @@ const GENERAL_ATTRIBUTES = [
|
||||
"release_notes_link"
|
||||
];
|
||||
|
||||
const AdminDashboard = Discourse.Model.extend({});
|
||||
const AdminDashboard = EmberObject.extend({});
|
||||
|
||||
AdminDashboard.reopenClass({
|
||||
fetch() {
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { filter, or, gt, lt, not } from "@ember/object/computed";
|
||||
import { iconHTML } from "discourse-common/lib/icon-library";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Group from "discourse/models/group";
|
||||
import { userPath } from "discourse/lib/url";
|
||||
import { Promise } from "rsvp";
|
||||
import User from "discourse/models/user";
|
||||
|
||||
const wrapAdmin = user => (user ? AdminUser.create(user) : null);
|
||||
|
||||
const AdminUser = Discourse.User.extend({
|
||||
const AdminUser = User.extend({
|
||||
adminUserView: true,
|
||||
customGroups: filter("groups", g => !g.automatic && Group.create(g)),
|
||||
automaticGroups: filter("groups", g => g.automatic && Group.create(g)),
|
||||
|
||||
canViewProfile: or("active", "staged"),
|
||||
|
||||
@computed("bounce_score", "reset_bounce_score_after")
|
||||
@discourseComputed("bounce_score", "reset_bounce_score_after")
|
||||
bounceScore(bounce_score, reset_bounce_score_after) {
|
||||
if (bounce_score > 0) {
|
||||
return `${bounce_score} - ${moment(reset_bounce_score_after).format(
|
||||
@ -28,7 +29,7 @@ const AdminUser = Discourse.User.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("bounce_score")
|
||||
@discourseComputed("bounce_score")
|
||||
bounceScoreExplanation(bounce_score) {
|
||||
if (bounce_score === 0) {
|
||||
return I18n.t("admin.user.bounce_score_explanation.none");
|
||||
@ -39,7 +40,7 @@ const AdminUser = Discourse.User.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
bounceLink() {
|
||||
return Discourse.getURL("/admin/email/bounced");
|
||||
},
|
||||
@ -278,7 +279,7 @@ const AdminUser = Discourse.User.extend({
|
||||
|
||||
canSuspend: not("staff"),
|
||||
|
||||
@computed("suspended_till", "suspended_at")
|
||||
@discourseComputed("suspended_till", "suspended_at")
|
||||
suspendDuration(suspendedTill, suspendedAt) {
|
||||
suspendedAt = moment(suspendedAt);
|
||||
suspendedTill = moment(suspendedTill);
|
||||
@ -513,20 +514,20 @@ const AdminUser = Discourse.User.extend({
|
||||
});
|
||||
},
|
||||
|
||||
@computed("tl3_requirements")
|
||||
@discourseComputed("tl3_requirements")
|
||||
tl3Requirements(requirements) {
|
||||
if (requirements) {
|
||||
return this.store.createRecord("tl3Requirements", requirements);
|
||||
}
|
||||
},
|
||||
|
||||
@computed("suspended_by")
|
||||
@discourseComputed("suspended_by")
|
||||
suspendedBy: wrapAdmin,
|
||||
|
||||
@computed("silenced_by")
|
||||
@discourseComputed("silenced_by")
|
||||
silencedBy: wrapAdmin,
|
||||
|
||||
@computed("approved_by")
|
||||
@discourseComputed("approved_by")
|
||||
approvedBy: wrapAdmin,
|
||||
|
||||
_formatError(event) {
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import RestModel from "discourse/models/rest";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { computed } from "@ember/object";
|
||||
|
||||
const ApiKey = RestModel.extend({
|
||||
user: Ember.computed("_user", {
|
||||
user: computed("_user", {
|
||||
get() {
|
||||
return this._user;
|
||||
},
|
||||
@ -18,12 +19,12 @@ const ApiKey = RestModel.extend({
|
||||
}
|
||||
}),
|
||||
|
||||
@computed("key")
|
||||
@discourseComputed("key")
|
||||
shortKey(key) {
|
||||
return `${key.substring(0, 4)}...`;
|
||||
},
|
||||
|
||||
@computed("description")
|
||||
@discourseComputed("description")
|
||||
shortDescription(description) {
|
||||
if (!description || description.length < 40) return description;
|
||||
return `${description.substring(0, 40)}...`;
|
||||
@ -45,7 +46,7 @@ const ApiKey = RestModel.extend({
|
||||
return this.getProperties("description", "username");
|
||||
},
|
||||
|
||||
@computed()
|
||||
@discourseComputed()
|
||||
basePath() {
|
||||
return this.store
|
||||
.adapterFor("api-key")
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { not } from "@ember/object/computed";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
export default Discourse.Model.extend({
|
||||
export default EmberObject.extend({
|
||||
restoreDisabled: not("restoreEnabled"),
|
||||
|
||||
@computed("allowRestore", "isOperationRunning")
|
||||
@discourseComputed("allowRestore", "isOperationRunning")
|
||||
restoreEnabled(allowRestore, isOperationRunning) {
|
||||
return allowRestore && !isOperationRunning;
|
||||
}
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { extractError } from "discourse/lib/ajax-error";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const Backup = Discourse.Model.extend({
|
||||
const Backup = EmberObject.extend({
|
||||
destroy() {
|
||||
return ajax("/admin/backups/" + this.filename, { type: "DELETE" });
|
||||
},
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
import {
|
||||
default as computed,
|
||||
default as discourseComputed,
|
||||
observes,
|
||||
on
|
||||
} from "ember-addons/ember-computed-decorators";
|
||||
} from "discourse-common/utils/decorators";
|
||||
import { propertyNotEqual } from "discourse/lib/computed";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const ColorSchemeColor = Discourse.Model.extend({
|
||||
const ColorSchemeColor = EmberObject.extend({
|
||||
@on("init")
|
||||
startTrackingChanges() {
|
||||
this.set("originals", { hex: this.hex || "FFFFFF" });
|
||||
@ -15,7 +16,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
},
|
||||
|
||||
// Whether value has changed since it was last saved.
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
changed(hex) {
|
||||
if (!this.originals) return false;
|
||||
if (hex !== this.originals.hex) return true;
|
||||
@ -27,7 +28,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
overridden: propertyNotEqual("hex", "default_hex"),
|
||||
|
||||
// Whether the saved value is different than Discourse's default color scheme.
|
||||
@computed("default_hex", "hex")
|
||||
@discourseComputed("default_hex", "hex")
|
||||
savedIsOverriden(defaultHex) {
|
||||
return this.originals.hex !== defaultHex;
|
||||
},
|
||||
@ -42,7 +43,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
translatedName(name) {
|
||||
if (!this.is_advanced) {
|
||||
return I18n.t(`admin.customize.colors.${name}.name`);
|
||||
@ -51,7 +52,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("name")
|
||||
@discourseComputed("name")
|
||||
description(name) {
|
||||
if (!this.is_advanced) {
|
||||
return I18n.t(`admin.customize.colors.${name}.description`);
|
||||
@ -66,7 +67,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
|
||||
@property brightness
|
||||
**/
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
brightness(hex) {
|
||||
if (hex.length === 6 || hex.length === 3) {
|
||||
if (hex.length === 3) {
|
||||
@ -79,9 +80,9 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
hex.substr(2, 1);
|
||||
}
|
||||
return Math.round(
|
||||
(parseInt("0x" + hex.substr(0, 2)) * 299 +
|
||||
parseInt("0x" + hex.substr(2, 2)) * 587 +
|
||||
parseInt("0x" + hex.substr(4, 2)) * 114) /
|
||||
(parseInt(hex.substr(0, 2), 16) * 299 +
|
||||
parseInt(hex.substr(2, 2), 16) * 587 +
|
||||
parseInt(hex.substr(4, 2), 16) * 114) /
|
||||
1000
|
||||
);
|
||||
}
|
||||
@ -94,7 +95,7 @@ const ColorSchemeColor = Discourse.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
@computed("hex")
|
||||
@discourseComputed("hex")
|
||||
valid(hex) {
|
||||
return hex.match(/^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/) !== null;
|
||||
}
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
import { not } from "@ember/object/computed";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import ColorSchemeColor from "admin/models/color-scheme-color";
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||
const ColorScheme = EmberObject.extend(Ember.Copyable, {
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.startTrackingChanges();
|
||||
},
|
||||
|
||||
@computed
|
||||
@discourseComputed
|
||||
description() {
|
||||
return "" + this.name;
|
||||
},
|
||||
@ -42,7 +43,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||
return newScheme;
|
||||
},
|
||||
|
||||
@computed("name", "colors.@each.changed", "saving")
|
||||
@discourseComputed("name", "colors.@each.changed", "saving")
|
||||
changed(name) {
|
||||
if (!this.originals) return false;
|
||||
if (this.originals.name !== name) return true;
|
||||
@ -51,7 +52,7 @@ const ColorScheme = Discourse.Model.extend(Ember.Copyable, {
|
||||
return false;
|
||||
},
|
||||
|
||||
@computed("changed")
|
||||
@discourseComputed("changed")
|
||||
disableSave(changed) {
|
||||
if (this.theme_id) {
|
||||
return false;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import AdminUser from "admin/models/admin-user";
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const EmailLog = Discourse.Model.extend({});
|
||||
const EmailLog = EmberObject.extend({});
|
||||
|
||||
EmailLog.reopenClass({
|
||||
create(attrs) {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
const EmailPreview = Discourse.Model.extend({});
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const EmailPreview = EmberObject.extend({});
|
||||
|
||||
export function oneWeekAgo() {
|
||||
return moment()
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
const EmailSettings = Discourse.Model.extend({});
|
||||
import EmberObject from "@ember/object";
|
||||
|
||||
const EmailSettings = EmberObject.extend({});
|
||||
|
||||
EmailSettings.reopenClass({
|
||||
find: function() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user