diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..7b1bb84427 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,38 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: daily + time: "08:00" + timezone: Australia/Sydney + open-pull-requests-limit: 10 + versioning-strategy: lockfile-only + allow: + - dependency-type: direct + - dependency-type: indirect + ignore: + - dependency-name: aws-partitions + versions: + - "> 1.329.0" + - "< 2" + - dependency-name: aws-sdk-core + versions: + - "> 3.99.1" + - "< 4" + - dependency-name: aws-sdk-kms + versions: + - "> 1.31.0" + - "< 2" + - dependency-name: aws-sdk-s3 + versions: + - "> 1.66.0" + - "< 2" + - dependency-name: aws-sdk-sns + versions: + - "> 1.25.1" + - "< 2" + - dependency-name: aws-sigv4 + versions: + - "> 1.2.0" + - "< 2" diff --git a/.gitignore b/.gitignore index 421c63ae6d..d0359a12ee 100644 --- a/.gitignore +++ b/.gitignore @@ -137,6 +137,12 @@ node_modules # ignore generated api documentation files openapi/* +# ignore VSCode config files +.vscode + +# ignore direnv +.envrc + # ember-cli generated dist diff --git a/Gemfile.lock b/Gemfile.lock index 8d3218cebb..946b7245a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,34 +45,34 @@ GEM rake (>= 10.4, < 14.0) ast (2.4.1) aws-eventstream (1.1.0) - aws-partitions (1.329.0) - aws-sdk-core (3.99.1) + aws-partitions (1.390.0) + aws-sdk-core (3.109.2) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) aws-sigv4 (~> 1.1) jmespath (~> 1.0) - aws-sdk-kms (1.31.0) - aws-sdk-core (~> 3, >= 3.71.0) + aws-sdk-kms (1.39.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.66.0) - aws-sdk-core (~> 3, >= 3.96.1) + aws-sdk-s3 (1.83.2) + aws-sdk-core (~> 3, >= 3.109.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.1) - aws-sdk-sns (1.25.1) - aws-sdk-core (~> 3, >= 3.99.0) + aws-sdk-sns (1.35.0) + aws-sdk-core (~> 3, >= 3.109.0) aws-sigv4 (~> 1.1) - aws-sigv4 (1.2.0) + aws-sigv4 (1.2.2) aws-eventstream (~> 1, >= 1.0.2) barber (0.12.2) ember-source (>= 1.0, < 3.1) execjs (>= 1.2, < 3) - better_errors (2.8.3) + better_errors (2.9.1) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) - bootsnap (1.4.9) + bootsnap (1.5.1) msgpack (~> 1.0) builder (3.2.4) bullet (6.1.0) @@ -120,7 +120,7 @@ GEM barber (>= 0.11.0) sprockets (>= 3.3, < 4.1) ember-source (2.18.2) - erubi (1.9.0) + erubi (1.10.0) excon (0.78.0) execjs (2.7.0) exifr (1.3.9) @@ -160,7 +160,7 @@ GEM jwt (2.2.2) kgio (2.11.3) libv8 (8.4.255.0) - listen (3.2.1) + listen (3.3.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) lograge (0.11.2) @@ -213,7 +213,7 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - oj (3.10.15) + oj (3.10.16) omniauth (1.9.1) hashie (>= 3.4.6) rack (>= 1.6.2, < 3) @@ -235,7 +235,7 @@ GEM omniauth-twitter (1.4.0) omniauth-oauth (~> 1.1) rack - onebox (2.1.4) + onebox (2.1.6) addressable (~> 2.7.0) htmlentities (~> 4.3) multi_json (~> 1.11) @@ -244,7 +244,7 @@ GEM sanitize openssl-signature_algorithm (1.0.0) optimist (3.0.1) - parallel (1.19.2) + parallel (1.20.0) parallel_tests (3.3.0) parallel parser (2.7.2.0) @@ -275,7 +275,7 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - rails_failover (0.5.7) + rails_failover (0.6.0) activerecord (~> 6.0) railties (~> 6.0) rails_multisite (2.5.0) @@ -311,21 +311,21 @@ GEM chunky_png (~> 1.0) rqrcode_core (~> 0.1) rqrcode_core (0.1.2) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.3) - rspec-support (~> 3.9.3) - rspec-expectations (3.9.4) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-html-matchers (0.9.4) nokogiri (~> 1) rspec (>= 3.0.0.a, < 4) - rspec-mocks (3.9.1) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) + rspec-support (~> 3.10.0) rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) @@ -334,29 +334,30 @@ GEM rspec-expectations (~> 3.9) rspec-mocks (~> 3.9) rspec-support (~> 3.9) - rspec-support (3.9.4) + rspec-support (3.10.0) rswag-specs (2.3.1) activesupport (>= 3.1, < 7.0) json-schema (~> 2.2) railties (>= 3.1, < 7.0) rtlit (0.0.5) - rubocop (1.1.0) + rubocop (1.3.1) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8) rexml - rubocop-ast (>= 1.0.1) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.1.0) + rubocop-ast (1.1.1) parser (>= 2.7.1.5) - rubocop-discourse (2.4.0) + rubocop-discourse (2.4.1) rubocop (>= 1.1.0) - rubocop-rspec (>= 2.0.0.pre) - rubocop-rspec (2.0.0.pre) + rubocop-rspec (>= 2.0.0) + rubocop-rspec (2.0.0) rubocop (~> 1.0) - ruby-prof (1.4.1) + rubocop-ast (>= 1.1.0) + ruby-prof (1.4.2) ruby-progressbar (1.10.1) ruby-readability (0.7.0) guess_html_encoding (>= 0.0.4) @@ -402,7 +403,7 @@ GEM thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) @@ -414,11 +415,11 @@ GEM kgio (~> 2.6) raindrops (~> 0.7) uniform_notifier (1.13.0) - webmock (3.9.3) + webmock (3.10.0) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpush (1.0.0) + webpush (1.1.0) hkdf (~> 0.2) jwt (~> 2.0) xorcist (1.1.2) diff --git a/app/assets/images/favicons/amazon.png b/app/assets/images/favicons/amazon.png index 3f074f64f2..b2ef6045ee 100644 Binary files a/app/assets/images/favicons/amazon.png and b/app/assets/images/favicons/amazon.png differ diff --git a/app/assets/images/favicons/apple.png b/app/assets/images/favicons/apple.png index aed253c7a1..da6b59f17f 100644 Binary files a/app/assets/images/favicons/apple.png and b/app/assets/images/favicons/apple.png differ diff --git a/app/assets/images/favicons/discourse.png b/app/assets/images/favicons/discourse.png index 59be3f7aa2..b0441a3655 100644 Binary files a/app/assets/images/favicons/discourse.png and b/app/assets/images/favicons/discourse.png differ diff --git a/app/assets/images/favicons/github.png b/app/assets/images/favicons/github.png index 32c975f4fa..d19beac3d0 100644 Binary files a/app/assets/images/favicons/github.png and b/app/assets/images/favicons/github.png differ diff --git a/app/assets/images/favicons/google_branding/logo_calendar_128px.png b/app/assets/images/favicons/google_branding/logo_calendar_128px.png index cde34eff31..a013a3fdf3 100644 Binary files a/app/assets/images/favicons/google_branding/logo_calendar_128px.png and b/app/assets/images/favicons/google_branding/logo_calendar_128px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_calendar_48px.png b/app/assets/images/favicons/google_branding/logo_calendar_48px.png index 6ede0bbbd7..549641dae4 100644 Binary files a/app/assets/images/favicons/google_branding/logo_calendar_48px.png and b/app/assets/images/favicons/google_branding/logo_calendar_48px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_docs_48px.png b/app/assets/images/favicons/google_branding/logo_docs_48px.png index c67a2edbf6..6ffbc98567 100644 Binary files a/app/assets/images/favicons/google_branding/logo_docs_48px.png and b/app/assets/images/favicons/google_branding/logo_docs_48px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_drive_48px.png b/app/assets/images/favicons/google_branding/logo_drive_48px.png index 4f9cf38775..6c45b46216 100644 Binary files a/app/assets/images/favicons/google_branding/logo_drive_48px.png and b/app/assets/images/favicons/google_branding/logo_drive_48px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_forms_48px.png b/app/assets/images/favicons/google_branding/logo_forms_48px.png index 660a89ca05..331b9aa9a4 100644 Binary files a/app/assets/images/favicons/google_branding/logo_forms_48px.png and b/app/assets/images/favicons/google_branding/logo_forms_48px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_sheets_48px.png b/app/assets/images/favicons/google_branding/logo_sheets_48px.png index e349d3722a..f507c284d3 100644 Binary files a/app/assets/images/favicons/google_branding/logo_sheets_48px.png and b/app/assets/images/favicons/google_branding/logo_sheets_48px.png differ diff --git a/app/assets/images/favicons/google_branding/logo_slides_48px.png b/app/assets/images/favicons/google_branding/logo_slides_48px.png index 1dcb6027ce..2e65c6ff10 100644 Binary files a/app/assets/images/favicons/google_branding/logo_slides_48px.png and b/app/assets/images/favicons/google_branding/logo_slides_48px.png differ diff --git a/app/assets/images/favicons/google_play.png b/app/assets/images/favicons/google_play.png index 76b523789c..cdd201c2be 100644 Binary files a/app/assets/images/favicons/google_play.png and b/app/assets/images/favicons/google_play.png differ diff --git a/app/assets/images/favicons/instagram.png b/app/assets/images/favicons/instagram.png index e51ea9c92f..5d3ec88632 100644 Binary files a/app/assets/images/favicons/instagram.png and b/app/assets/images/favicons/instagram.png differ diff --git a/app/assets/images/favicons/pdf_48px.png b/app/assets/images/favicons/pdf_48px.png index 4e1330044b..a16e41a6c9 100644 Binary files a/app/assets/images/favicons/pdf_48px.png and b/app/assets/images/favicons/pdf_48px.png differ diff --git a/app/assets/images/favicons/pdf_64px.png b/app/assets/images/favicons/pdf_64px.png index ce59d5ce9e..44ad3ce4c7 100644 Binary files a/app/assets/images/favicons/pdf_64px.png and b/app/assets/images/favicons/pdf_64px.png differ diff --git a/app/assets/images/favicons/rottentomatoes.png b/app/assets/images/favicons/rottentomatoes.png index 6344c1922c..acd019cad3 100644 Binary files a/app/assets/images/favicons/rottentomatoes.png and b/app/assets/images/favicons/rottentomatoes.png differ diff --git a/app/assets/images/favicons/stackexchange.png b/app/assets/images/favicons/stackexchange.png index c33bb9275b..23029c5266 100644 Binary files a/app/assets/images/favicons/stackexchange.png and b/app/assets/images/favicons/stackexchange.png differ diff --git a/app/assets/images/favicons/twitter.png b/app/assets/images/favicons/twitter.png index 0e30273e6c..d46388dc36 100644 Binary files a/app/assets/images/favicons/twitter.png and b/app/assets/images/favicons/twitter.png differ diff --git a/app/assets/images/logo-dev.png b/app/assets/images/logo-dev.png index 1b309fc375..77d47a43ec 100644 Binary files a/app/assets/images/logo-dev.png and b/app/assets/images/logo-dev.png differ diff --git a/app/assets/images/logo-single-dev.png b/app/assets/images/logo-single-dev.png index 04d6caffa5..94cab55bc9 100644 Binary files a/app/assets/images/logo-single-dev.png and b/app/assets/images/logo-single-dev.png differ diff --git a/app/assets/images/push-notifications/check.png b/app/assets/images/push-notifications/check.png index 5415afb5d8..232c1d6293 100644 Binary files a/app/assets/images/push-notifications/check.png and b/app/assets/images/push-notifications/check.png differ diff --git a/app/assets/images/push-notifications/discourse.png b/app/assets/images/push-notifications/discourse.png index 0727e396be..2c97f18c67 100644 Binary files a/app/assets/images/push-notifications/discourse.png and b/app/assets/images/push-notifications/discourse.png differ diff --git a/app/assets/images/push-notifications/group_mentioned.png b/app/assets/images/push-notifications/group_mentioned.png index 35b0fcc803..54ee759a20 100644 Binary files a/app/assets/images/push-notifications/group_mentioned.png and b/app/assets/images/push-notifications/group_mentioned.png differ diff --git a/app/assets/images/push-notifications/linked.png b/app/assets/images/push-notifications/linked.png index 6507ce9ad8..a1ba29d850 100644 Binary files a/app/assets/images/push-notifications/linked.png and b/app/assets/images/push-notifications/linked.png differ diff --git a/app/assets/images/push-notifications/mentioned.png b/app/assets/images/push-notifications/mentioned.png index 35b0fcc803..54ee759a20 100644 Binary files a/app/assets/images/push-notifications/mentioned.png and b/app/assets/images/push-notifications/mentioned.png differ diff --git a/app/assets/images/push-notifications/posted.png b/app/assets/images/push-notifications/posted.png index 188d4378f5..bad4dd5b15 100644 Binary files a/app/assets/images/push-notifications/posted.png and b/app/assets/images/push-notifications/posted.png differ diff --git a/app/assets/images/push-notifications/private_message.png b/app/assets/images/push-notifications/private_message.png index 34656ea7ec..1449a8244a 100644 Binary files a/app/assets/images/push-notifications/private_message.png and b/app/assets/images/push-notifications/private_message.png differ diff --git a/app/assets/images/push-notifications/quoted.png b/app/assets/images/push-notifications/quoted.png index 2fb2e33737..2634da2216 100644 Binary files a/app/assets/images/push-notifications/quoted.png and b/app/assets/images/push-notifications/quoted.png differ diff --git a/app/assets/images/push-notifications/replied.png b/app/assets/images/push-notifications/replied.png index 188d4378f5..bad4dd5b15 100644 Binary files a/app/assets/images/push-notifications/replied.png and b/app/assets/images/push-notifications/replied.png differ diff --git a/app/assets/images/select2-spinner.gif b/app/assets/images/select2-spinner.gif index 5b33f7e54f..703391003b 100644 Binary files a/app/assets/images/select2-spinner.gif and b/app/assets/images/select2-spinner.gif differ diff --git a/app/assets/images/select2.png b/app/assets/images/select2.png index 1d804ffb99..32c2fc3a22 100644 Binary files a/app/assets/images/select2.png and b/app/assets/images/select2.png differ diff --git a/app/assets/images/select2x2.png b/app/assets/images/select2x2.png index 4bdd5c961d..e0a62658da 100644 Binary files a/app/assets/images/select2x2.png and b/app/assets/images/select2x2.png differ diff --git a/app/assets/javascripts/admin/addon/components/site-setting.js b/app/assets/javascripts/admin/addon/components/site-setting.js index af538f7011..695ddac781 100644 --- a/app/assets/javascripts/admin/addon/components/site-setting.js +++ b/app/assets/javascripts/admin/addon/components/site-setting.js @@ -2,6 +2,7 @@ import Component from "@ember/component"; import BufferedContent from "discourse/mixins/buffered-content"; import SiteSetting from "admin/models/site-setting"; import SettingComponent from "admin/mixins/setting-component"; +import { readOnly } from "@ember/object/computed"; export default Component.extend(BufferedContent, SettingComponent, { updateExistingUsers: null, @@ -12,4 +13,6 @@ export default Component.extend(BufferedContent, SettingComponent, { updateExistingUsers: this.updateExistingUsers, }); }, + + staffLogFilter: readOnly("setting.staffLogFilter"), }); diff --git a/app/assets/javascripts/admin/addon/components/suspension-details.js b/app/assets/javascripts/admin/addon/components/suspension-details.js index 0e6d50b17d..f9edc0e225 100644 --- a/app/assets/javascripts/admin/addon/components/suspension-details.js +++ b/app/assets/javascripts/admin/addon/components/suspension-details.js @@ -1,4 +1,52 @@ import Component from "@ember/component"; +import discourseComputed from "discourse-common/utils/decorators"; +import I18n from "I18n"; +import { equal } from "@ember/object/computed"; +import { action } from "@ember/object"; + +const CUSTOM_REASON_KEY = "custom"; + export default Component.extend({ tagName: "", + selectedReason: CUSTOM_REASON_KEY, + customReason: "", + reasonKeys: [ + "not_listening_to_staff", + "consuming_staff_time", + "combatative", + "in_wrong_place", + "no_constructive_purpose", + CUSTOM_REASON_KEY, + ], + isCustomReason: equal("selectedReason", CUSTOM_REASON_KEY), + + @discourseComputed("reasonKeys") + reasons(keys) { + return keys.map((key) => { + return { id: key, name: I18n.t(`admin.user.suspend_reasons.${key}`) }; + }); + }, + + @action + setSelectedReason(value) { + this.set("selectedReason", value); + this.setReason(); + }, + + @action + setCustomReason(value) { + this.set("customReason", value); + this.setReason(); + }, + + setReason() { + if (this.isCustomReason) { + this.set("reason", this.customReason); + } else { + this.set( + "reason", + I18n.t(`admin.user.suspend_reasons.${this.selectedReason}`) + ); + } + }, }); diff --git a/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js b/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js index f38493c556..770f541f6e 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-customize-themes-show.js @@ -35,6 +35,11 @@ export default Controller.extend({ childThemesNames: mapBy("model.childThemes", "name"), extraFiles: filterBy("model.theme_fields", "target", "extra_js"), + @discourseComputed("model.component", "model.remote_theme") + showCheckboxes() { + return !this.model.component || this.model.remote_theme; + }, + @discourseComputed("model.editedFields") editedFieldsFormatted() { const descriptions = []; @@ -304,6 +309,10 @@ export default Controller.extend({ this.model.saveChanges("user_selectable"); }, + applyAutoUpdateable() { + this.model.saveChanges("auto_update"); + }, + addChildTheme() { let themeId = parseInt(this.selectedChildThemeId, 10); let theme = this.allThemes.findBy("id", themeId); diff --git a/app/assets/javascripts/admin/addon/controllers/admin-user-fields.js b/app/assets/javascripts/admin/addon/controllers/admin-user-fields.js index 7800dfc655..913ed729a7 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-user-fields.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-user-fields.js @@ -4,7 +4,7 @@ import Controller from "@ember/controller"; import { popupAjaxError } from "discourse/lib/ajax-error"; import bootbox from "bootbox"; -const MAX_FIELDS = 20; +const MAX_FIELDS = 30; export default Controller.extend({ fieldTypes: null, diff --git a/app/assets/javascripts/admin/addon/controllers/admin-user-index.js b/app/assets/javascripts/admin/addon/controllers/admin-user-index.js index 8ab62307fd..121324711c 100644 --- a/app/assets/javascripts/admin/addon/controllers/admin-user-index.js +++ b/app/assets/javascripts/admin/addon/controllers/admin-user-index.js @@ -19,6 +19,7 @@ export default Controller.extend(CanCheckEmails, { customGroupIdsBuffer: null, availableGroups: null, userTitleValue: null, + ssoExternalEmail: null, showBadges: setting("enable_badges"), hasLockedTrustLevel: notEmpty("model.manual_locked_trust_level"), @@ -339,5 +340,15 @@ export default Controller.extend(CanCheckEmails, { } ); }, + + checkSsoEmail() { + return ajax(userPath(`${this.model.username_lower}/sso-email.json`), { + data: { context: window.location.pathname }, + }).then((result) => { + if (result) { + this.set("ssoExternalEmail", result.email); + } + }); + }, }, }); diff --git a/app/assets/javascripts/admin/addon/mixins/penalty-controller.js b/app/assets/javascripts/admin/addon/mixins/penalty-controller.js index caf3aee559..250d60664f 100644 --- a/app/assets/javascripts/admin/addon/mixins/penalty-controller.js +++ b/app/assets/javascripts/admin/addon/mixins/penalty-controller.js @@ -1,12 +1,13 @@ import I18n from "I18n"; import ModalFunctionality from "discourse/mixins/modal-functionality"; -import { popupAjaxError } from "discourse/lib/ajax-error"; +import { extractError } from "discourse/lib/ajax-error"; import Mixin from "@ember/object/mixin"; import { next } from "@ember/runloop"; import { Promise } from "rsvp"; import bootbox from "bootbox"; export default Mixin.create(ModalFunctionality, { + errorMessage: null, reason: null, message: null, postEdit: null, @@ -18,6 +19,7 @@ export default Mixin.create(ModalFunctionality, { resetModal() { this.setProperties({ + errorMessage: null, reason: null, message: null, loadingUser: true, @@ -66,6 +68,8 @@ export default Mixin.create(ModalFunctionality, { callback(result); } }) - .catch(popupAjaxError); + .catch((error) => { + this.set("errorMessage", extractError(error)); + }); }, }); diff --git a/app/assets/javascripts/admin/addon/models/admin-user.js b/app/assets/javascripts/admin/addon/models/admin-user.js index 4a58d21273..0bc1132623 100644 --- a/app/assets/javascripts/admin/addon/models/admin-user.js +++ b/app/assets/javascripts/admin/addon/models/admin-user.js @@ -352,28 +352,17 @@ const AdminUser = User.extend({ type: "PUT", }) .then((result) => this.setProperties(result.unsilence)) - .catch((e) => { - const error = I18n.t("admin.user.unsilence_failed", { - error: this._formatError(e), - }); - bootbox.alert(error); - }) .finally(() => this.set("silencingUser", false)); }, silence(data) { this.set("silencingUser", true); + return ajax(`/admin/users/${this.id}/silence`, { type: "PUT", data, }) .then((result) => this.setProperties(result.silence)) - .catch((e) => { - const error = I18n.t("admin.user.silence_failed", { - error: this._formatError(e), - }); - bootbox.alert(error); - }) .finally(() => this.set("silencingUser", false)); }, diff --git a/app/assets/javascripts/admin/addon/models/color-scheme.js b/app/assets/javascripts/admin/addon/models/color-scheme.js index 513f8cb3ee..4bce289ba7 100644 --- a/app/assets/javascripts/admin/addon/models/color-scheme.js +++ b/app/assets/javascripts/admin/addon/models/color-scheme.js @@ -20,7 +20,10 @@ const ColorScheme = EmberObject.extend({ }, startTrackingChanges() { - this.set("originals", { name: this.name }); + this.set("originals", { + name: this.name, + user_selectable: this.user_selectable, + }); }, schemeJson() { @@ -46,14 +49,22 @@ const ColorScheme = EmberObject.extend({ return newScheme; }, - @discourseComputed("name", "colors.@each.changed", "saving") - changed(name) { + @discourseComputed( + "name", + "user_selectable", + "colors.@each.changed", + "saving" + ) + changed(name, user_selectable) { if (!this.originals) { return false; } if (this.originals.name !== name) { return true; } + if (this.originals.user_selectable !== user_selectable) { + return true; + } if (this.colors.any((c) => c.get("changed"))) { return true; } @@ -80,9 +91,9 @@ const ColorScheme = EmberObject.extend({ this.setProperties({ savingStatus: I18n.t("saving"), saving: true }); const data = {}; - if (!opts || !opts.enabledOnly) { data.name = this.name; + data.user_selectable = this.user_selectable; data.base_scheme_id = this.base_scheme_id; data.colors = []; this.colors.forEach((c) => { diff --git a/app/assets/javascripts/admin/addon/models/site-setting.js b/app/assets/javascripts/admin/addon/models/site-setting.js index 2c982fd449..350281e616 100644 --- a/app/assets/javascripts/admin/addon/models/site-setting.js +++ b/app/assets/javascripts/admin/addon/models/site-setting.js @@ -2,8 +2,21 @@ import I18n from "I18n"; import { ajax } from "discourse/lib/ajax"; import Setting from "admin/mixins/setting-object"; import EmberObject from "@ember/object"; +import discourseComputed from "discourse-common/utils/decorators"; -const SiteSetting = EmberObject.extend(Setting, {}); +const SiteSetting = EmberObject.extend(Setting, { + @discourseComputed("setting") + staffLogFilter(setting) { + if (!setting) { + return; + } + + return { + subject: setting, + action_name: "change_site_setting", + }; + }, +}); SiteSetting.reopenClass({ findAll() { diff --git a/app/assets/javascripts/admin/addon/models/theme.js b/app/assets/javascripts/admin/addon/models/theme.js index f3daec98e9..10c78c5b82 100644 --- a/app/assets/javascripts/admin/addon/models/theme.js +++ b/app/assets/javascripts/admin/addon/models/theme.js @@ -5,11 +5,6 @@ import { or, gt } from "@ember/object/computed"; import RestModel from "discourse/models/rest"; import discourseComputed from "discourse-common/utils/decorators"; import { popupAjaxError } from "discourse/lib/ajax-error"; -import { ajax } from "discourse/lib/ajax"; -import { escapeExpression } from "discourse/lib/utilities"; -import highlightSyntax from "discourse/lib/highlight-syntax"; -import { url } from "discourse/lib/computed"; -import bootbox from "bootbox"; const THEME_UPLOAD_VAR = 2; const FIELDS_IDS = [0, 1, 5]; @@ -23,7 +18,6 @@ const Theme = RestModel.extend({ isPendingUpdates: gt("remote_theme.commits_behind", 0), hasEditedFields: gt("editedFields.length", 0), hasParents: gt("parent_themes.length", 0), - diffLocalChangesUrl: url("id", "/admin/themes/%@/diff_local_changes"), @discourseComputed("theme_fields.[]") targets() { @@ -292,37 +286,9 @@ const Theme = RestModel.extend({ }, updateToLatest() { - return ajax(this.diffLocalChangesUrl).then((json) => { - if (json && json.error) { - bootbox.alert( - I18n.t("generic_error_with_reason", { - error: json.error, - }) - ); - } else if (json && json.diff) { - bootbox.confirm( - I18n.t("admin.customize.theme.update_confirm") + - `
${escapeExpression(
- json.diff
- )}`,
- I18n.t("cancel"),
- I18n.t("admin.customize.theme.update_confirm_yes"),
- (result) => {
- if (result) {
- return this.save({ remote_update: true }).then(() =>
- this.set("changed", false)
- );
- }
- }
- );
- // TODO: Models shouldn't be updating the DOM
- highlightSyntax(undefined, this.siteSettings, this.session);
- } else {
- return this.save({ remote_update: true }).then(() =>
- this.set("changed", false)
- );
- }
- });
+ return this.save({ remote_update: true }).then(() =>
+ this.set("changed", false)
+ );
},
changed: false,
diff --git a/app/assets/javascripts/admin/addon/routes/admin-customize-themes-edit.js b/app/assets/javascripts/admin/addon/routes/admin-customize-themes-edit.js
index 1576fac0ec..030645e445 100644
--- a/app/assets/javascripts/admin/addon/routes/admin-customize-themes-edit.js
+++ b/app/assets/javascripts/admin/addon/routes/admin-customize-themes-edit.js
@@ -28,6 +28,10 @@ export default Route.extend({
const fields = wrapper.model
.get("fields")
[wrapper.target].map((f) => f.name);
+ if (wrapper.model.remote_theme) {
+ this.transitionTo("adminCustomizeThemes.index");
+ return;
+ }
if (!fields.includes(wrapper.field_name)) {
this.transitionTo(
"adminCustomizeThemes.edit",
diff --git a/app/assets/javascripts/admin/addon/templates/components/site-setting.hbs b/app/assets/javascripts/admin/addon/templates/components/site-setting.hbs
index 88f9919692..b7029ebe02 100644
--- a/app/assets/javascripts/admin/addon/templates/components/site-setting.hbs
+++ b/app/assets/javascripts/admin/addon/templates/components/site-setting.hbs
@@ -1,5 +1,16 @@