- | {{i18n "about.stat.last_7_days"}} | -{{i18n "about.stat.last_30_days"}} | -{{i18n "about.stat.all_time"}} | -
---|---|---|---|
{{i18n "about.topic_count"}} | -{{number model.stats.topics_7_days}} | -{{number model.stats.topics_30_days}} | -{{number model.stats.topic_count}} | -
{{i18n "about.post_count"}} | -{{number model.stats.posts_7_days}} | -{{number model.stats.posts_30_days}} | -{{number model.stats.post_count}} | -
{{i18n "about.user_count"}} | -{{number model.stats.users_7_days}} | -{{number model.stats.users_30_days}} | -{{number model.stats.user_count}} | -
{{i18n "about.active_user_count"}} | -{{number model.stats.active_users_7_days}} | -{{number model.stats.active_users_30_days}} | -— | -
{{i18n "about.like_count"}} | -{{number model.stats.likes_7_days}} | -{{number model.stats.likes_30_days}} | -{{number model.stats.like_count}} | -
+ | {{i18n "about.stat.last_7_days"}} | +{{i18n "about.stat.last_30_days"}} | +{{i18n "about.stat.all_time"}} | +
---|---|---|---|
{{i18n "about.topic_count"}} | +{{number model.stats.topics_7_days}} | +{{number model.stats.topics_30_days}} | +{{number model.stats.topic_count}} | +
{{i18n "about.post_count"}} | +{{number model.stats.posts_7_days}} | +{{number model.stats.posts_30_days}} | +{{number model.stats.post_count}} | +
{{i18n "about.user_count"}} | +{{number model.stats.users_7_days}} | +{{number model.stats.users_30_days}} | +{{number model.stats.user_count}} | +
{{i18n "about.active_user_count"}} | +{{number model.stats.active_users_7_days}} | +{{number model.stats.active_users_30_days}} | +— | +
{{i18n "about.like_count"}} | +{{number model.stats.likes_7_days}} | +{{number model.stats.likes_30_days}} | +{{number model.stats.like_count}} | +
{{i18n "user.save_to_change_theme" save_text=(i18n "save") }}
- {{/if}} {{#if showThemeSetDefault}}- {{pinned-options value=pinned topic=topic}} - {{html-safe reasonText}} -
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs b/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs deleted file mode 100644 index f21111ebbd5..00000000000 --- a/app/assets/javascripts/select-kit/addon/templates/components/topic-notifications-button.hbs +++ /dev/null @@ -1,30 +0,0 @@ -{{#if appendReason}} -- {{topic-notifications-options - value=notificationLevel - topic=topic - onChange=(action "changeTopicNotificationLevel") - options=(hash - icon=icon - showFullTitle=showFullTitle - placement=placement - preventsClickPropagation=true - showCaret=showCaret - ) - }} - {{html-safe topic.details.notificationReasonText}} -
-{{else}} - {{topic-notifications-options - value=notificationLevel - topic=topic - onChange=(action "changeTopicNotificationLevel") - options=(hash - icon=icon - showFullTitle=showFullTitle - placement=placement - preventsClickPropagation=true - showCaret=showCaret - ) - }} -{{/if}} diff --git a/app/assets/javascripts/select-kit/addon/components/admin-group-selector.js b/app/assets/javascripts/select-kit/app/components/admin-group-selector.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/admin-group-selector.js rename to app/assets/javascripts/select-kit/app/components/admin-group-selector.js diff --git a/app/assets/javascripts/select-kit/addon/components/categories-admin-dropdown.js b/app/assets/javascripts/select-kit/app/components/categories-admin-dropdown.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/categories-admin-dropdown.js rename to app/assets/javascripts/select-kit/app/components/categories-admin-dropdown.js diff --git a/app/assets/javascripts/select-kit/addon/components/category-chooser.js b/app/assets/javascripts/select-kit/app/components/category-chooser.js similarity index 99% rename from app/assets/javascripts/select-kit/addon/components/category-chooser.js rename to app/assets/javascripts/select-kit/app/components/category-chooser.js index 72d0167ac09..f36e8be2d32 100644 --- a/app/assets/javascripts/select-kit/addon/components/category-chooser.js +++ b/app/assets/javascripts/select-kit/app/components/category-chooser.js @@ -67,7 +67,6 @@ export default ComboBoxComponent.extend({ search(filter) { if (filter) { - filter = filter.toLowerCase(); return this.content.filter(item => { const category = Category.findById(this.getValue(item)); const categoryName = this.getName(item); diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop.js b/app/assets/javascripts/select-kit/app/components/category-drop.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/category-drop.js rename to app/assets/javascripts/select-kit/app/components/category-drop.js diff --git a/app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js b/app/assets/javascripts/select-kit/app/components/category-drop/category-drop-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/category-drop/category-drop-header.js rename to app/assets/javascripts/select-kit/app/components/category-drop/category-drop-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/category-notifications-button.js b/app/assets/javascripts/select-kit/app/components/category-notifications-button.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/category-notifications-button.js rename to app/assets/javascripts/select-kit/app/components/category-notifications-button.js diff --git a/app/assets/javascripts/select-kit/addon/components/category-row.js b/app/assets/javascripts/select-kit/app/components/category-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/category-row.js rename to app/assets/javascripts/select-kit/app/components/category-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/category-selector.js b/app/assets/javascripts/select-kit/app/components/category-selector.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/category-selector.js rename to app/assets/javascripts/select-kit/app/components/category-selector.js diff --git a/app/assets/javascripts/select-kit/addon/components/color-palettes.js b/app/assets/javascripts/select-kit/app/components/color-palettes.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/color-palettes.js rename to app/assets/javascripts/select-kit/app/components/color-palettes.js diff --git a/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js b/app/assets/javascripts/select-kit/app/components/color-palettes/color-palettes-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js rename to app/assets/javascripts/select-kit/app/components/color-palettes/color-palettes-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/combo-box.js b/app/assets/javascripts/select-kit/app/components/combo-box.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/combo-box.js rename to app/assets/javascripts/select-kit/app/components/combo-box.js diff --git a/app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js b/app/assets/javascripts/select-kit/app/components/combo-box/combo-box-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/combo-box/combo-box-header.js rename to app/assets/javascripts/select-kit/app/components/combo-box/combo-box-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/composer-actions.js b/app/assets/javascripts/select-kit/app/components/composer-actions.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/composer-actions.js rename to app/assets/javascripts/select-kit/app/components/composer-actions.js diff --git a/app/assets/javascripts/select-kit/addon/components/create-color-row.js b/app/assets/javascripts/select-kit/app/components/create-color-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/create-color-row.js rename to app/assets/javascripts/select-kit/app/components/create-color-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box.js b/app/assets/javascripts/select-kit/app/components/dropdown-select-box.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/dropdown-select-box.js rename to app/assets/javascripts/select-kit/app/components/dropdown-select-box.js diff --git a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js b/app/assets/javascripts/select-kit/app/components/dropdown-select-box/dropdown-select-box-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-header.js rename to app/assets/javascripts/select-kit/app/components/dropdown-select-box/dropdown-select-box-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js b/app/assets/javascripts/select-kit/app/components/dropdown-select-box/dropdown-select-box-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/dropdown-select-box/dropdown-select-box-row.js rename to app/assets/javascripts/select-kit/app/components/dropdown-select-box/dropdown-select-box-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js b/app/assets/javascripts/select-kit/app/components/future-date-input-selector.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/future-date-input-selector.js rename to app/assets/javascripts/select-kit/app/components/future-date-input-selector.js diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js b/app/assets/javascripts/select-kit/app/components/future-date-input-selector/future-date-input-selector-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-header.js rename to app/assets/javascripts/select-kit/app/components/future-date-input-selector/future-date-input-selector-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-row.js b/app/assets/javascripts/select-kit/app/components/future-date-input-selector/future-date-input-selector-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/future-date-input-selector/future-date-input-selector-row.js rename to app/assets/javascripts/select-kit/app/components/future-date-input-selector/future-date-input-selector-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/future-date-input-selector/mixin.js b/app/assets/javascripts/select-kit/app/components/future-date-input-selector/mixin.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/future-date-input-selector/mixin.js rename to app/assets/javascripts/select-kit/app/components/future-date-input-selector/mixin.js diff --git a/app/assets/javascripts/select-kit/addon/components/group-dropdown.js b/app/assets/javascripts/select-kit/app/components/group-dropdown.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/group-dropdown.js rename to app/assets/javascripts/select-kit/app/components/group-dropdown.js diff --git a/app/assets/javascripts/select-kit/addon/components/group-members-dropdown.js b/app/assets/javascripts/select-kit/app/components/group-members-dropdown.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/group-members-dropdown.js rename to app/assets/javascripts/select-kit/app/components/group-members-dropdown.js diff --git a/app/assets/javascripts/select-kit/addon/components/group-notifications-button.js b/app/assets/javascripts/select-kit/app/components/group-notifications-button.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/group-notifications-button.js rename to app/assets/javascripts/select-kit/app/components/group-notifications-button.js diff --git a/app/assets/javascripts/select-kit/addon/components/icon-picker.js b/app/assets/javascripts/select-kit/app/components/icon-picker.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/icon-picker.js rename to app/assets/javascripts/select-kit/app/components/icon-picker.js diff --git a/app/assets/javascripts/select-kit/addon/components/list-setting.js b/app/assets/javascripts/select-kit/app/components/list-setting.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/list-setting.js rename to app/assets/javascripts/select-kit/app/components/list-setting.js diff --git a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js b/app/assets/javascripts/select-kit/app/components/mini-tag-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/mini-tag-chooser.js rename to app/assets/javascripts/select-kit/app/components/mini-tag-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser/mini-tag-chooser-header.js b/app/assets/javascripts/select-kit/app/components/mini-tag-chooser/mini-tag-chooser-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/mini-tag-chooser/mini-tag-chooser-header.js rename to app/assets/javascripts/select-kit/app/components/mini-tag-chooser/mini-tag-chooser-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/mini-tag-chooser/selected-collection.js b/app/assets/javascripts/select-kit/app/components/mini-tag-chooser/selected-collection.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/mini-tag-chooser/selected-collection.js rename to app/assets/javascripts/select-kit/app/components/mini-tag-chooser/selected-collection.js diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select.js b/app/assets/javascripts/select-kit/app/components/multi-select.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/multi-select.js rename to app/assets/javascripts/select-kit/app/components/multi-select.js diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js b/app/assets/javascripts/select-kit/app/components/multi-select/multi-select-filter.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-filter.js rename to app/assets/javascripts/select-kit/app/components/multi-select/multi-select-filter.js diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.js b/app/assets/javascripts/select-kit/app/components/multi-select/multi-select-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/multi-select/multi-select-header.js rename to app/assets/javascripts/select-kit/app/components/multi-select/multi-select-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/selected-category.js b/app/assets/javascripts/select-kit/app/components/multi-select/selected-category.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/multi-select/selected-category.js rename to app/assets/javascripts/select-kit/app/components/multi-select/selected-category.js diff --git a/app/assets/javascripts/select-kit/addon/components/multi-select/selected-color.js b/app/assets/javascripts/select-kit/app/components/multi-select/selected-color.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/multi-select/selected-color.js rename to app/assets/javascripts/select-kit/app/components/multi-select/selected-color.js diff --git a/app/assets/javascripts/select-kit/addon/components/none-category-row.js b/app/assets/javascripts/select-kit/app/components/none-category-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/none-category-row.js rename to app/assets/javascripts/select-kit/app/components/none-category-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/notifications-button.js b/app/assets/javascripts/select-kit/app/components/notifications-button.js similarity index 96% rename from app/assets/javascripts/select-kit/addon/components/notifications-button.js rename to app/assets/javascripts/select-kit/app/components/notifications-button.js index 32dc2ad7ba1..f5423b9e64a 100644 --- a/app/assets/javascripts/select-kit/addon/components/notifications-button.js +++ b/app/assets/javascripts/select-kit/app/components/notifications-button.js @@ -13,7 +13,8 @@ export default DropdownSelectBoxComponent.extend({ autoFilterable: false, filterable: false, i18nPrefix: "", - i18nPostfix: "" + i18nPostfix: "", + showCaret: true }, modifyComponentForRow() { diff --git a/app/assets/javascripts/select-kit/addon/components/notifications-button/notifications-button-row.js b/app/assets/javascripts/select-kit/app/components/notifications-button/notifications-button-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/notifications-button/notifications-button-row.js rename to app/assets/javascripts/select-kit/app/components/notifications-button/notifications-button-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/notifications-filter.js b/app/assets/javascripts/select-kit/app/components/notifications-filter.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/notifications-filter.js rename to app/assets/javascripts/select-kit/app/components/notifications-filter.js diff --git a/app/assets/javascripts/select-kit/addon/components/notifications-filter/notifications-filter-header.js b/app/assets/javascripts/select-kit/app/components/notifications-filter/notifications-filter-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/notifications-filter/notifications-filter-header.js rename to app/assets/javascripts/select-kit/app/components/notifications-filter/notifications-filter-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/period-chooser.js b/app/assets/javascripts/select-kit/app/components/period-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/period-chooser.js rename to app/assets/javascripts/select-kit/app/components/period-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/period-chooser/period-chooser-header.js b/app/assets/javascripts/select-kit/app/components/period-chooser/period-chooser-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/period-chooser/period-chooser-header.js rename to app/assets/javascripts/select-kit/app/components/period-chooser/period-chooser-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/period-chooser/period-chooser-row.js b/app/assets/javascripts/select-kit/app/components/period-chooser/period-chooser-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/period-chooser/period-chooser-row.js rename to app/assets/javascripts/select-kit/app/components/period-chooser/period-chooser-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/pinned-button.js b/app/assets/javascripts/select-kit/app/components/pinned-button.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/pinned-button.js rename to app/assets/javascripts/select-kit/app/components/pinned-button.js diff --git a/app/assets/javascripts/select-kit/addon/components/pinned-options.js b/app/assets/javascripts/select-kit/app/components/pinned-options.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/pinned-options.js rename to app/assets/javascripts/select-kit/app/components/pinned-options.js diff --git a/app/assets/javascripts/select-kit/addon/components/search-advanced-category-chooser.js b/app/assets/javascripts/select-kit/app/components/search-advanced-category-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/search-advanced-category-chooser.js rename to app/assets/javascripts/select-kit/app/components/search-advanced-category-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit.js b/app/assets/javascripts/select-kit/app/components/select-kit.js similarity index 99% rename from app/assets/javascripts/select-kit/addon/components/select-kit.js rename to app/assets/javascripts/select-kit/app/components/select-kit.js index 02acfb5a2e1..f2fbbbf1c2b 100644 --- a/app/assets/javascripts/select-kit/addon/components/select-kit.js +++ b/app/assets/javascripts/select-kit/app/components/select-kit.js @@ -1,6 +1,5 @@ import I18n from "I18n"; -import EmberObject, { computed, get } from "@ember/object"; -import { guidFor } from "@ember/object/internals"; +import EmberObject, { computed, get, guidFor } from "@ember/object"; import Component from "@ember/component"; import deprecated from "discourse-common/lib/deprecated"; import { makeArray } from "discourse-common/lib/helpers"; @@ -272,8 +271,7 @@ export default Component.extend( selectedNameComponent: "selected-name", castInteger: false, preventsClickPropagation: false, - focusAfterOnChange: true, - triggerOnChangeOnTab: true + focusAfterOnChange: true }, autoFilterable: computed("content.[]", "selectKit.filter", function() { diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/errors-collection.js b/app/assets/javascripts/select-kit/app/components/select-kit/errors-collection.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/errors-collection.js rename to app/assets/javascripts/select-kit/app/components/select-kit/errors-collection.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-body.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-body.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-body.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-body.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-collection.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-collection.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-collection.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-create-row.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-create-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-create-row.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-create-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-filter.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-filter.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-filter.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-filter.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js similarity index 97% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js index 5697826f59f..785b2a47022 100644 --- a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-header.js +++ b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-header.js @@ -140,11 +140,7 @@ export default Component.extend(UtilsMixin, { this._focusFilterInput(); } else if (event.keyCode === 9) { // Tab - if ( - this.selectKit.highlighted && - this.selectKit.isExpanded && - this.selectKit.options.triggerOnChangeOnTab - ) { + if (this.selectKit.highlighted && this.selectKit.isExpanded) { this.selectKit.select( this.getValue(this.selectKit.highlighted), this.selectKit.highlighted diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-none-row.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-none-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-none-row.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-none-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-row.js b/app/assets/javascripts/select-kit/app/components/select-kit/select-kit-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/select-kit-row.js rename to app/assets/javascripts/select-kit/app/components/select-kit/select-kit-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.js b/app/assets/javascripts/select-kit/app/components/select-kit/single-select-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/select-kit/single-select-header.js rename to app/assets/javascripts/select-kit/app/components/select-kit/single-select-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/selected-color.js b/app/assets/javascripts/select-kit/app/components/selected-color.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/selected-color.js rename to app/assets/javascripts/select-kit/app/components/selected-color.js diff --git a/app/assets/javascripts/select-kit/addon/components/selected-name.js b/app/assets/javascripts/select-kit/app/components/selected-name.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/selected-name.js rename to app/assets/javascripts/select-kit/app/components/selected-name.js diff --git a/app/assets/javascripts/select-kit/addon/components/single-select.js b/app/assets/javascripts/select-kit/app/components/single-select.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/single-select.js rename to app/assets/javascripts/select-kit/app/components/single-select.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-chooser-row.js b/app/assets/javascripts/select-kit/app/components/tag-chooser-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-chooser-row.js rename to app/assets/javascripts/select-kit/app/components/tag-chooser-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-chooser.js b/app/assets/javascripts/select-kit/app/components/tag-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-chooser.js rename to app/assets/javascripts/select-kit/app/components/tag-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-drop.js b/app/assets/javascripts/select-kit/app/components/tag-drop.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-drop.js rename to app/assets/javascripts/select-kit/app/components/tag-drop.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-drop/tag-drop-header.js b/app/assets/javascripts/select-kit/app/components/tag-drop/tag-drop-header.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-drop/tag-drop-header.js rename to app/assets/javascripts/select-kit/app/components/tag-drop/tag-drop-header.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-group-chooser.js b/app/assets/javascripts/select-kit/app/components/tag-group-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-group-chooser.js rename to app/assets/javascripts/select-kit/app/components/tag-group-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-notifications-button.js b/app/assets/javascripts/select-kit/app/components/tag-notifications-button.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-notifications-button.js rename to app/assets/javascripts/select-kit/app/components/tag-notifications-button.js diff --git a/app/assets/javascripts/select-kit/addon/components/tag-row.js b/app/assets/javascripts/select-kit/app/components/tag-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/tag-row.js rename to app/assets/javascripts/select-kit/app/components/tag-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/timezone-input.js b/app/assets/javascripts/select-kit/app/components/timezone-input.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/timezone-input.js rename to app/assets/javascripts/select-kit/app/components/timezone-input.js diff --git a/app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options.js b/app/assets/javascripts/select-kit/app/components/toolbar-popup-menu-options.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options.js rename to app/assets/javascripts/select-kit/app/components/toolbar-popup-menu-options.js diff --git a/app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.js b/app/assets/javascripts/select-kit/app/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.js rename to app/assets/javascripts/select-kit/app/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.js diff --git a/app/assets/javascripts/select-kit/addon/components/topic-footer-mobile-dropdown.js b/app/assets/javascripts/select-kit/app/components/topic-footer-mobile-dropdown.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/topic-footer-mobile-dropdown.js rename to app/assets/javascripts/select-kit/app/components/topic-footer-mobile-dropdown.js diff --git a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js b/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js similarity index 55% rename from app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js rename to app/assets/javascripts/select-kit/app/components/topic-notifications-button.js index d9c09001823..58329393e7c 100644 --- a/app/assets/javascripts/select-kit/addon/components/topic-notifications-button.js +++ b/app/assets/javascripts/select-kit/app/components/topic-notifications-button.js @@ -1,28 +1,20 @@ import Component from "@ember/component"; -import { action, computed } from "@ember/object"; +import { action } from "@ember/object"; export default Component.extend({ layoutName: "select-kit/templates/components/topic-notifications-button", classNames: ["topic-notifications-button"], - classNameBindings: ["isLoading"], appendReason: true, showFullTitle: true, placement: "bottom-start", notificationLevel: null, topic: null, showCaret: true, - isLoading: false, - icon: computed("isLoading", function() { - return this.isLoading ? "spinner" : null; - }), @action changeTopicNotificationLevel(levelId) { if (levelId !== this.notificationLevel) { - this.set("isLoading", true); - this.topic.details - .updateNotifications(levelId) - .finally(() => this.set("isLoading", false)); + this.topic.details.updateNotifications(levelId); } } }); diff --git a/app/assets/javascripts/select-kit/addon/components/topic-notifications-options.js b/app/assets/javascripts/select-kit/app/components/topic-notifications-options.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/topic-notifications-options.js rename to app/assets/javascripts/select-kit/app/components/topic-notifications-options.js diff --git a/app/assets/javascripts/select-kit/addon/components/user-chooser.js b/app/assets/javascripts/select-kit/app/components/user-chooser.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/user-chooser.js rename to app/assets/javascripts/select-kit/app/components/user-chooser.js diff --git a/app/assets/javascripts/select-kit/addon/components/user-chooser/user-row.js b/app/assets/javascripts/select-kit/app/components/user-chooser/user-row.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/user-chooser/user-row.js rename to app/assets/javascripts/select-kit/app/components/user-chooser/user-row.js diff --git a/app/assets/javascripts/select-kit/addon/components/user-notifications-dropdown.js b/app/assets/javascripts/select-kit/app/components/user-notifications-dropdown.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/components/user-notifications-dropdown.js rename to app/assets/javascripts/select-kit/app/components/user-notifications-dropdown.js diff --git a/app/assets/javascripts/select-kit/addon/mixins/plugin-api.js b/app/assets/javascripts/select-kit/app/mixins/plugin-api.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/mixins/plugin-api.js rename to app/assets/javascripts/select-kit/app/mixins/plugin-api.js diff --git a/app/assets/javascripts/select-kit/addon/mixins/tags.js b/app/assets/javascripts/select-kit/app/mixins/tags.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/mixins/tags.js rename to app/assets/javascripts/select-kit/app/mixins/tags.js diff --git a/app/assets/javascripts/select-kit/addon/mixins/utils.js b/app/assets/javascripts/select-kit/app/mixins/utils.js similarity index 100% rename from app/assets/javascripts/select-kit/addon/mixins/utils.js rename to app/assets/javascripts/select-kit/app/mixins/utils.js diff --git a/app/assets/javascripts/select-kit/addon/templates/components/category-drop/category-drop-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/category-drop/category-drop-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/category-drop/category-drop-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/category-drop/category-drop-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/category-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/category-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/category-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/color-palettes/color-palettes-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/color-palettes/color-palettes-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/combo-box/combo-box-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/combo-box/combo-box-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/combo-box/combo-box-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/combo-box/combo-box-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/create-color-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/create-color-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/create-color-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/create-color-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/dropdown-select-box/dropdown-select-box-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/dropdown-select-box/dropdown-select-box-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/dropdown-select-box/dropdown-select-box-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/dropdown-select-box/dropdown-select-box-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/dropdown-select-box/dropdown-select-box-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/future-date-input-selector/future-date-input-selector-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/future-date-input-selector/future-date-input-selector-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/future-date-input-selector/future-date-input-selector-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/future-date-input-selector/future-date-input-selector-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/future-date-input-selector/future-date-input-selector-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/future-date-input-selector/future-date-input-selector-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/future-date-input-selector/future-date-input-selector-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/future-date-input-selector/future-date-input-selector-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/mini-tag-chooser/mini-tag-chooser-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/mini-tag-chooser/mini-tag-chooser-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/mini-tag-chooser/mini-tag-chooser-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/mini-tag-chooser/mini-tag-chooser-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/mini-tag-chooser/selected-collection.hbs b/app/assets/javascripts/select-kit/app/templates/components/mini-tag-chooser/selected-collection.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/mini-tag-chooser/selected-collection.hbs rename to app/assets/javascripts/select-kit/app/templates/components/mini-tag-chooser/selected-collection.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/multi-select.hbs b/app/assets/javascripts/select-kit/app/templates/components/multi-select.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/multi-select.hbs rename to app/assets/javascripts/select-kit/app/templates/components/multi-select.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/multi-select/multi-select-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/multi-select/multi-select-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/multi-select/multi-select-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/multi-select/multi-select-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbs b/app/assets/javascripts/select-kit/app/templates/components/multi-select/selected-category.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/multi-select/selected-category.hbs rename to app/assets/javascripts/select-kit/app/templates/components/multi-select/selected-category.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/notifications-filter/notifications-filter-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/notifications-filter/notifications-filter-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/notifications-filter/notifications-filter-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/notifications-filter/notifications-filter-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/period-chooser/period-chooser-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/period-chooser/period-chooser-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/period-chooser/period-chooser-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/period-chooser/period-chooser-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/period-chooser/period-chooser-row.hbs diff --git a/app/assets/javascripts/select-kit/app/templates/components/pinned-button.hbs b/app/assets/javascripts/select-kit/app/templates/components/pinned-button.hbs new file mode 100644 index 00000000000..f54bdb6b5fe --- /dev/null +++ b/app/assets/javascripts/select-kit/app/templates/components/pinned-button.hbs @@ -0,0 +1,5 @@ +{{pinned-options value=pinned topic=topic}} + ++ {{html-safe reasonText}} +
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/errors-collection.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/errors-collection.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/errors-collection.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/errors-collection.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-body.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-body.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-body.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-body.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-collection.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-collection.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-collection.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-collection.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-filter.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-filter.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-filter.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-filter.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/select-kit-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/select-kit-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/select-kit/single-select-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/select-kit/single-select-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/select-kit/single-select-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/select-kit/single-select-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs b/app/assets/javascripts/select-kit/app/templates/components/selected-name.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/selected-name.hbs rename to app/assets/javascripts/select-kit/app/templates/components/selected-name.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/single-select.hbs b/app/assets/javascripts/select-kit/app/templates/components/single-select.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/single-select.hbs rename to app/assets/javascripts/select-kit/app/templates/components/single-select.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/tag-chooser-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/tag-chooser-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/tag-chooser-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/tag-chooser-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/tag-drop/tag-drop-header.hbs b/app/assets/javascripts/select-kit/app/templates/components/tag-drop/tag-drop-header.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/tag-drop/tag-drop-header.hbs rename to app/assets/javascripts/select-kit/app/templates/components/tag-drop/tag-drop-header.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/tag-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/tag-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/tag-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/tag-row.hbs diff --git a/app/assets/javascripts/select-kit/addon/templates/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.hbs b/app/assets/javascripts/select-kit/app/templates/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.hbs rename to app/assets/javascripts/select-kit/app/templates/components/toolbar-popup-menu-options/toolbar-popup-menu-options-heading.hbs diff --git a/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs b/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs new file mode 100644 index 00000000000..50dd20e56eb --- /dev/null +++ b/app/assets/javascripts/select-kit/app/templates/components/topic-notifications-button.hbs @@ -0,0 +1,17 @@ +{{topic-notifications-options + value=notificationLevel + topic=topic + onChange=(action "changeTopicNotificationLevel") + options=(hash + showFullTitle=showFullTitle + placement=placement + preventsClickPropagation=true + showCaret=showCaret + ) +}} + +{{#if appendReason}} ++ {{html-safe topic.details.notificationReasonText}} +
+{{/if}} diff --git a/app/assets/javascripts/select-kit/addon/templates/components/user-chooser/user-row.hbs b/app/assets/javascripts/select-kit/app/templates/components/user-chooser/user-row.hbs similarity index 100% rename from app/assets/javascripts/select-kit/addon/templates/components/user-chooser/user-row.hbs rename to app/assets/javascripts/select-kit/app/templates/components/user-chooser/user-row.hbs diff --git a/app/assets/javascripts/wizard-application.js b/app/assets/javascripts/wizard-application.js index 4e2a7adc072..b8e8797f0c6 100644 --- a/app/assets/javascripts/wizard-application.js +++ b/app/assets/javascripts/wizard-application.js @@ -1,6 +1,6 @@ //= require_tree ./discourse-common/addon //= require i18n-patches -//= require_tree ./select-kit/addon +//= require_tree ./select-kit/app //= require wizard/router //= require wizard/wizard //= require_tree ./wizard/templates diff --git a/app/assets/stylesheets/common/base/_topic-list.scss b/app/assets/stylesheets/common/base/_topic-list.scss index a80e54c4fda..aa51fccce15 100644 --- a/app/assets/stylesheets/common/base/_topic-list.scss +++ b/app/assets/stylesheets/common/base/_topic-list.scss @@ -53,6 +53,7 @@ color: $primary-medium; } span.badge-category { + font-weight: normal; color: $primary-medium; } a.discourse-tag { diff --git a/app/assets/stylesheets/common/base/alert.scss b/app/assets/stylesheets/common/base/alert.scss index 05a29029059..d729cdc7423 100644 --- a/app/assets/stylesheets/common/base/alert.scss +++ b/app/assets/stylesheets/common/base/alert.scss @@ -3,7 +3,6 @@ background-color: $danger-low; color: $primary; position: relative; - margin-bottom: 1em; .close { font-size: $font-up-3; diff --git a/app/assets/stylesheets/common/base/crawler_layout.scss b/app/assets/stylesheets/common/base/crawler_layout.scss index bff0addac1a..c279aceff4c 100644 --- a/app/assets/stylesheets/common/base/crawler_layout.scss +++ b/app/assets/stylesheets/common/base/crawler_layout.scss @@ -27,36 +27,6 @@ body.crawler { .topic-list { margin-bottom: 1em; - @media (max-width: 850px) { - td { - word-break: break-all; - &.posters { - a:not(:last-of-type) { - display: none; - } - a:last-of-type { - display: block; - } - } - } - - td, - th { - &.views { - display: none; - } - } - - .link-top-line { - a.title { - padding: 0; - } - } - - .link-bottom-line { - margin-top: 0.25em; - } - } } footer { diff --git a/app/assets/stylesheets/common/base/topic-post.scss b/app/assets/stylesheets/common/base/topic-post.scss index 48c361c1647..6e465bbc6b6 100644 --- a/app/assets/stylesheets/common/base/topic-post.scss +++ b/app/assets/stylesheets/common/base/topic-post.scss @@ -1005,51 +1005,10 @@ a.mention-group { } #topic-footer-buttons { - padding: 0.5em 0; - - .topic-footer-main-buttons { - margin: 0 0 -0.5em 0; - display: flex; - flex-wrap: wrap; - - > .btn { - margin: 0 0.5em 0.5em 0; - display: inline-flex; - align-items: center; - - .d-button-label { - display: flex; - flex: 1 0 auto; - align-items: center; - } - } - - .topic-admin-menu-button-container { - display: inline-flex; - } - - .topic-admin-menu-button-container > span:not(:empty) { - margin: 0 0.5em 0.5em 0; - } - } - - .pinned-button:not(.is-hidden) + .topic-notifications-button { - margin-top: 0; - } - - .pinned-button, - .topic-notifications-button { - margin: 1em 0; - - .reason { - color: $primary-high; - display: inline-flex; - margin: 0; - align-items: center; - - .text { - margin-left: 0.5em; - } - } + .reason { + color: $primary-high; + display: inline; + margin: 0 0 0 8px; + line-height: $line-height-medium; } } diff --git a/app/assets/stylesheets/common/base/user.scss b/app/assets/stylesheets/common/base/user.scss index 4d5e9f42886..587af3c3539 100644 --- a/app/assets/stylesheets/common/base/user.scss +++ b/app/assets/stylesheets/common/base/user.scss @@ -653,9 +653,6 @@ padding: 5px 0; font-weight: bold; } - .save-theme-alert { - font-size: $font-down-1; - } } .paginated-topics-list { diff --git a/app/assets/stylesheets/common/components/badges.scss b/app/assets/stylesheets/common/components/badges.scss index 20ed535931d..3881ee7b70f 100644 --- a/app/assets/stylesheets/common/components/badges.scss +++ b/app/assets/stylesheets/common/components/badges.scss @@ -17,6 +17,7 @@ .badge-wrapper { font-size: $font-down-1; + font-weight: bold; white-space: nowrap; position: relative; display: inline-flex; diff --git a/app/assets/stylesheets/common/select-kit/category-row.scss b/app/assets/stylesheets/common/select-kit/category-row.scss index df43c956035..2bbe33c96ea 100644 --- a/app/assets/stylesheets/common/select-kit/category-row.scss +++ b/app/assets/stylesheets/common/select-kit/category-row.scss @@ -9,9 +9,6 @@ -ms-flex: 1 1 auto; flex: 1 1 auto; } - .category-desc p { - margin: 0; - } .category-status { .badge-wrapper.box { margin-bottom: 1px; diff --git a/app/assets/stylesheets/common/select-kit/pinned-button.scss b/app/assets/stylesheets/common/select-kit/pinned-button.scss index 3e51092ae39..f080b8a016c 100644 --- a/app/assets/stylesheets/common/select-kit/pinned-button.scss +++ b/app/assets/stylesheets/common/select-kit/pinned-button.scss @@ -1,7 +1,28 @@ #topic-footer-buttons { .pinned-button { + min-width: auto; + margin: 1em 0; + &.is-hidden { display: none; } + + .btn { + margin: 0; + } + + .reason { + display: inline; + line-height: $line-height-medium; + } + } +} + +.pinned-button { + margin: 0; + min-width: auto; + + .pinned-options { + display: inline; } } diff --git a/app/assets/stylesheets/common/select-kit/select-kit.scss b/app/assets/stylesheets/common/select-kit/select-kit.scss index a9769b59710..130bad52f80 100644 --- a/app/assets/stylesheets/common/select-kit/select-kit.scss +++ b/app/assets/stylesheets/common/select-kit/select-kit.scss @@ -63,11 +63,6 @@ flex-direction: row; min-height: 30px; - .d-icon-spinner { - -webkit-animation: rotate-forever 1s infinite linear; - animation: rotate-forever 1s infinite linear; - } - .selected-name { text-align: left; flex: 0 1 auto; diff --git a/app/assets/stylesheets/common/select-kit/topic-notifications-button.scss b/app/assets/stylesheets/common/select-kit/topic-notifications-button.scss index b3808031a1d..1e7c7972054 100644 --- a/app/assets/stylesheets/common/select-kit/topic-notifications-button.scss +++ b/app/assets/stylesheets/common/select-kit/topic-notifications-button.scss @@ -1,18 +1,27 @@ -.topic-notifications-button { - &.is-loading { - pointer-events: none; - user-select: none; +#topic-footer-buttons { + .topic-notifications-button { + min-width: auto; + margin: 1em 0; - .d-icon-spinner { + .btn { margin: 0; } - .selected-name .d-icon { - display: none; - } - - .topic-notifications-options { - opacity: 0.5; + .reason { + display: inline; + line-height: $line-height-medium; } } } + +.topic-notifications-button .topic-notifications-options { + min-width: auto; +} + +.topic-notifications-button { + margin: 0; + + .topic-notifications-options { + display: inline-flex; + } +} diff --git a/app/assets/stylesheets/desktop.scss b/app/assets/stylesheets/desktop.scss index e9213e897b3..70229afbbc1 100644 --- a/app/assets/stylesheets/desktop.scss +++ b/app/assets/stylesheets/desktop.scss @@ -1,6 +1,24 @@ @import "common"; -@import "desktop/*"; +/* @import "desktop/*"; TODO: get this working again */ + +@import "desktop/alert"; +@import "desktop/banner"; +@import "desktop/compose"; +@import "desktop/discourse"; +@import "desktop/header"; +@import "desktop/login"; +@import "desktop/modal"; +@import "desktop/category-list"; +@import "desktop/latest-topic-list"; +@import "desktop/topic-list"; +@import "desktop/topic-post"; +@import "desktop/topic"; +@import "desktop/upload"; +@import "desktop/user"; +@import "desktop/history"; +@import "desktop/group"; +@import "desktop/admin_customize"; // Import all component-specific files @import "desktop/components/*"; diff --git a/app/assets/stylesheets/desktop/alert.scss b/app/assets/stylesheets/desktop/alert.scss new file mode 100644 index 00000000000..f3f57eac668 --- /dev/null +++ b/app/assets/stylesheets/desktop/alert.scss @@ -0,0 +1,3 @@ +.alert { + margin-bottom: 1em; +} diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index 5adc17d3eb1..ca304b8e951 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -451,15 +451,20 @@ pre.copy-codeblocks:hover .copy-cmd { } } -#topic-footer-buttons { - max-width: calc(690px + (11px * 2) + 45px); +@mixin topic-footer-button { + margin-bottom: 5px; + margin-right: 10px; +} - .bookmark { +#topic-footer-buttons { + padding: 10px 10px 0 0; + float: left; + .btn { + @include topic-footer-button; .d-icon-bookmark.bookmarked { color: $tertiary; } } - .bookmark.bookmarked .d-icon-bookmark, .bookmark.bookmarked .d-icon-discourse-bookmark-clock { color: $tertiary; @@ -469,6 +474,10 @@ pre.copy-codeblocks:hover .copy-cmd { } } +#topic-footer-button { + width: 757px; +} + .suggested-topics { clear: left; padding: 20px 0 15px 0; diff --git a/app/assets/stylesheets/mobile.scss b/app/assets/stylesheets/mobile.scss index a3202ca43c1..ee9c3ed92df 100644 --- a/app/assets/stylesheets/mobile.scss +++ b/app/assets/stylesheets/mobile.scss @@ -1,6 +1,37 @@ @import "common"; -@import "mobile/*"; +/* @import "mobile/*"; TODO: get this working again */ + +@import "mobile/buttons"; +@import "mobile/alert"; +@import "mobile/banner"; +@import "mobile/compose"; +@import "mobile/discourse"; +@import "mobile/header"; +@import "mobile/login"; +@import "mobile/modal"; +@import "mobile/topic-list"; +@import "mobile/topic-post"; +@import "mobile/topic"; +@import "mobile/upload"; +@import "mobile/user"; +@import "mobile/history"; +@import "mobile/lightbox"; +@import "mobile/directory"; +@import "mobile/search"; +@import "mobile/emoji"; +@import "mobile/ring"; +@import "mobile/group"; +@import "mobile/dashboard"; +@import "mobile/admin_badges"; +@import "mobile/admin_customize"; +@import "mobile/admin_reports"; +@import "mobile/admin_report"; +@import "mobile/admin_report_table"; +@import "mobile/admin_report_counters"; +@import "mobile/admin_emojis"; +@import "mobile/menu-panel"; +@import "mobile/reviewables"; // Import all component-specific files @import "mobile/components/*"; diff --git a/app/assets/stylesheets/mobile/alert.scss b/app/assets/stylesheets/mobile/alert.scss index 12e60245e57..0ee9b44ee0e 100644 --- a/app/assets/stylesheets/mobile/alert.scss +++ b/app/assets/stylesheets/mobile/alert.scss @@ -1,8 +1,7 @@ +// there are (n) new or updated topics, click to show .alert.alert-info { - margin-bottom: 0.5em; + margin: 0; &.clickable { - // there are (n) new or updated topics, click to show - margin-bottom: 0; padding: 1em; } } diff --git a/app/assets/stylesheets/mobile/banner.scss b/app/assets/stylesheets/mobile/banner.scss index fc308f05880..852b2847364 100644 --- a/app/assets/stylesheets/mobile/banner.scss +++ b/app/assets/stylesheets/mobile/banner.scss @@ -3,6 +3,11 @@ // -------------------------------------------------- #banner { + // go full width on mobile, by extending into the 10px wrap + // borders on left and right + margin: 0 -10px; max-height: 180px; - height: 20vh; + @media all and (max-height: 499px) { + max-height: 100px; + } } diff --git a/app/assets/stylesheets/mobile/discourse.scss b/app/assets/stylesheets/mobile/discourse.scss index c9406abca6b..260f8d4b13f 100644 --- a/app/assets/stylesheets/mobile/discourse.scss +++ b/app/assets/stylesheets/mobile/discourse.scss @@ -63,6 +63,11 @@ blockquote { margin-bottom: 9px; } +// categories should not be bold on mobile; they fight with the topic title too much +.badge-wrapper { + font-weight: normal; +} + .mobile-nav { margin: 0; padding: 0; diff --git a/app/assets/stylesheets/mobile/topic-post.scss b/app/assets/stylesheets/mobile/topic-post.scss index d84b4a727cf..9cd4931ce83 100644 --- a/app/assets/stylesheets/mobile/topic-post.scss +++ b/app/assets/stylesheets/mobile/topic-post.scss @@ -36,7 +36,6 @@ span.badge-posts { .double-button { display: flex; flex: 0 1 auto; - align-items: center; button { &.like, &.read-indicator, @@ -236,16 +235,20 @@ a.reply-to-tab { } #topic-footer-buttons { + @include clearfix; + padding: 20px 0 0 0; .d-icon-bookmark.bookmarked, .d-icon-discourse-bookmark-clock.bookmarked { color: $tertiary; } - - .topic-footer-mobile-dropdown { - margin: 0 0.5em 0.5em 0; + .combobox { + margin-right: 0.5em; width: 160px; + margin-bottom: 0.5em; } +} +#topic-footer-buttons { .topic-notifications-button, .pinned-button { display: flex; @@ -260,6 +263,11 @@ a.reply-to-tab { } } +#topic-footer-button { + width: 100px; + margin: 0 auto; +} + .suggested-topics { clear: left; padding: 20px 0 15px 0; @@ -284,6 +292,13 @@ span.post-count { opacity: 0.8; } +#topic-footer-buttons { + .btn { + margin-bottom: 0.5em; + margin-right: 0.5em; + } +} + #topic-title { z-index: z("base") + 1; margin: 0 0 0 0 !important; diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 3f3f9e15a36..fe2d3a2327d 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -16,7 +16,7 @@ class AboutController < ApplicationController render :index end format.json do - render_json_dump(AboutSerializer.new(@about, scope: guardian)) + render_serialized(@about, AboutSerializer) end end end diff --git a/app/controllers/list_controller.rb b/app/controllers/list_controller.rb index 5eadbbcf6d7..81511387f73 100644 --- a/app/controllers/list_controller.rb +++ b/app/controllers/list_controller.rb @@ -331,13 +331,7 @@ class ListController < ApplicationController params[:category] = @category.id.to_s - @description_meta = if @category.uncategorized? - I18n.t('category.uncategorized_description', locale: SiteSetting.default_locale) - else - @category.description_text - end - @description_meta = SiteSetting.site_description if @description_meta.blank? - + @description_meta = @category.description_text if !guardian.can_see?(@category) if SiteSetting.detailed_404 raise Discourse::InvalidAccess diff --git a/app/controllers/themes_controller.rb b/app/controllers/themes_controller.rb new file mode 100644 index 00000000000..6520ec70975 --- /dev/null +++ b/app/controllers/themes_controller.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +class ThemesController < ::ApplicationController + def assets + theme_ids = params[:ids].to_s.split("-").map(&:to_i) + + if params[:ids] == "default" + theme_ids = nil + else + raise Discourse::NotFound unless guardian.allow_themes?(theme_ids) + end + + targets = view_context.mobile_view? ? [:mobile, :mobile_theme] : [:desktop, :desktop_theme] + targets << :admin if guardian.is_staff? + targets.append(*Discourse.find_plugin_css_assets(mobile_view: true, desktop_view: true)) + + object = targets.map do |target| + Stylesheet::Manager.stylesheet_data(target, theme_ids).map do |hash| + next hash unless Rails.env.development? + + dup_hash = hash.dup + dup_hash[:new_href] = dup_hash[:new_href].dup + dup_hash[:new_href] << (dup_hash[:new_href].include?("?") ? "&" : "?") + dup_hash[:new_href] << SecureRandom.hex + dup_hash + end + end.flatten + + render json: object.as_json + end +end diff --git a/app/helpers/email_helper.rb b/app/helpers/email_helper.rb index 14364d45c32..c579473a4d2 100644 --- a/app/helpers/email_helper.rb +++ b/app/helpers/email_helper.rb @@ -25,8 +25,12 @@ module EmailHelper raw "#{title}" end - def email_html_template - EmailStyle.new.html.sub('%{email_content}', yield).html_safe + def email_html_template(binding_arg) + template = EmailStyle.new.html.sub( + '%{email_content}', + '<%= yield %><% if defined?(html_body) %><%= html_body %><% end %>' + ) + ERB.new(template).result(binding_arg) end protected diff --git a/app/models/application_request.rb b/app/models/application_request.rb index 3d0d8ae905f..52a6a8a87e0 100644 --- a/app/models/application_request.rb +++ b/app/models/application_request.rb @@ -16,16 +16,15 @@ class ApplicationRequest < ActiveRecord::Base include CachedCounting def self.disable - @disabled = true + @enabled = false end def self.enable - @disabled = false + @enabled = true end def self.increment!(type, opts = nil) - return if @disabled - perform_increment!(redis_key(type), opts) + perform_increment!(redis_key(type), opts) if @enabled end def self.write_cache!(date = nil) diff --git a/app/models/category.rb b/app/models/category.rb index 6ecfe9d3afe..63db814752e 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -709,29 +709,37 @@ class Category < ActiveRecord::Base ].include? id end - def full_slug(separator = "-") - start_idx = "#{Discourse.base_uri}/c/".size - url[start_idx..-1].gsub("/", separator) - end - - @@url_cache = DistributedCache.new("category_url") + @@url_cache = DistributedCache.new('category_url') def clear_url_cache @@url_cache.clear end + def full_slug(separator = "-") + start_idx = "#{Discourse.base_uri}/c/".length + url[start_idx..-1].gsub("/", separator) + end + def url - @@url_cache[self.id] ||= "#{Discourse.base_uri}/c/#{slug_path.join('/')}" + url = @@url_cache[self.id] + unless url + url = "#{Discourse.base_uri}/c/#{slug_path.join('/')}" + + @@url_cache[self.id] = url + end + + url end def url_with_id self.parent_category ? "#{url}/#{self.id}" : "#{Discourse.base_uri}/c/#{self.slug}/#{self.id}" end - # If the name changes, try and update the category definition topic too if it's an exact match + # If the name changes, try and update the category definition topic too if it's + # an exact match def rename_category_definition - return unless topic.present? old_name = saved_changes.transform_values(&:first)["name"] + return unless topic.present? if topic.title == I18n.t("category.topic_prefix", category: old_name) topic.update_attribute(:title, I18n.t("category.topic_prefix", category: name)) end diff --git a/app/models/global_setting.rb b/app/models/global_setting.rb index 21e5a137dcf..f4425919ed3 100644 --- a/app/models/global_setting.rb +++ b/app/models/global_setting.rb @@ -164,15 +164,9 @@ class GlobalSetting c[:port] = redis_port if redis_port if redis_slave_host && redis_slave_port - if ENV["RAILS_FAILOVER"] - c[:replica_host] = redis_slave_host - c[:replica_port] = redis_slave_port - c[:connector] = RailsFailover::Redis::Connector - else - c[:slave_host] = redis_slave_host - c[:slave_port] = redis_slave_port - c[:connector] = DiscourseRedis::Connector - end + c[:slave_host] = redis_slave_host + c[:slave_port] = redis_slave_port + c[:connector] = DiscourseRedis::Connector end c[:password] = redis_password if redis_password.present? @@ -194,15 +188,9 @@ class GlobalSetting c[:port] = message_bus_redis_port if message_bus_redis_port if message_bus_redis_slave_host && message_bus_redis_slave_port - if ENV["RAILS_FAILOVER"] - c[:replica_host] = message_bus_redis_slave_host - c[:replica_port] = message_bus_redis_slave_port - c[:connector] = RailsFailover::Redis::Connector - else - c[:slave_host] = message_bus_redis_slave_host - c[:slave_port] = message_bus_redis_slave_port - c[:connector] = DiscourseRedis::Connector - end + c[:slave_host] = message_bus_redis_slave_host + c[:slave_port] = message_bus_redis_slave_port + c[:connector] = DiscourseRedis::Connector end c[:password] = message_bus_redis_password if message_bus_redis_password.present? diff --git a/app/models/group_archived_message.rb b/app/models/group_archived_message.rb index 8199a53cf62..1715a57585f 100644 --- a/app/models/group_archived_message.rb +++ b/app/models/group_archived_message.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class GroupArchivedMessage < ActiveRecord::Base - belongs_to :group + belongs_to :user belongs_to :topic def self.move_to_inbox!(group_id, topic) diff --git a/app/models/post.rb b/app/models/post.rb index e1a3a1f391e..89dbbcfebba 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -159,6 +159,14 @@ class Post < ActiveRecord::Base includes(:post_details).find_by(post_details: { key: key, value: value }) end + def self.excerpt_size=(sz) + @excerpt_size = sz + end + + def self.excerpt_size + @excerpt_size || 220 + end + def whisper? post_type == Post.types[:whisper] end @@ -474,7 +482,7 @@ class Post < ActiveRecord::Base end def excerpt_for_topic - Post.excerpt(cooked, SiteSetting.topic_excerpt_maxlength, strip_links: true, strip_images: true, post: self) + Post.excerpt(cooked, Post.excerpt_size, strip_links: true, strip_images: true, post: self) end def is_first_post? @@ -650,10 +658,6 @@ class Post < ActiveRecord::Base baked_version: BAKED_VERSION ) - if is_first_post? - topic.update_excerpt(excerpt_for_topic) - end - if invalidate_broken_images custom_fields.delete(BROKEN_IMAGES) save_custom_fields diff --git a/app/models/topic.rb b/app/models/topic.rb index 38affdb327b..d331a308060 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -33,11 +33,11 @@ class Topic < ActiveRecord::Base end def self.thumbnail_sizes - [ self.share_thumbnail_size ] + DiscoursePluginRegistry.topic_thumbnail_sizes + [ self.share_thumbnail_size ] end - def thumbnail_job_redis_key(sizes) - "generate_topic_thumbnail_enqueue_#{id}_#{sizes.inspect}" + def thumbnail_job_redis_key(extra_sizes) + "generate_topic_thumbnail_enqueue_#{id}_#{extra_sizes.inspect}" end def filtered_topic_thumbnails(extra_sizes: []) @@ -79,7 +79,7 @@ class Topic < ActiveRecord::Base if SiteSetting.create_thumbnails && enqueue_if_missing && records.length < thumbnail_sizes.length && - Discourse.redis.set(thumbnail_job_redis_key(thumbnail_sizes), 1, nx: true, ex: 1.minute) + Discourse.redis.set(thumbnail_job_redis_key(extra_sizes), 1, nx: true, ex: 1.minute) Jobs.enqueue(:generate_topic_thumbnails, { topic_id: id, extra_sizes: extra_sizes }) end @@ -1476,13 +1476,6 @@ class Topic < ActiveRecord::Base private_topic end - def update_excerpt(excerpt) - update_column(:excerpt, excerpt) - if archetype == "banner" - ApplicationController.banner_json_cache.clear - end - end - def pm_with_non_human_user? sql = <<~SQL SELECT 1 FROM topics diff --git a/app/models/topic_embed.rb b/app/models/topic_embed.rb index 362ee79f4ac..a18e5b85dea 100644 --- a/app/models/topic_embed.rb +++ b/app/models/topic_embed.rb @@ -109,8 +109,6 @@ class TopicEmbed < ActiveRecord::Base url = UrlHelper.escape_uri(url) original_uri = URI.parse(url) - raise URI::InvalidURIError unless original_uri.is_a?(URI::HTTP) - opts = { tags: %w[div p code pre h1 h2 h3 b em i strong a img ul li ol blockquote], attributes: %w[href src class], diff --git a/app/models/upload.rb b/app/models/upload.rb index 31c931c172b..bb4e7976f5e 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -448,3 +448,7 @@ end # index_uploads_on_url (url) # index_uploads_on_user_id (user_id) # +# Foreign Keys +# +# fk_rails_... (access_control_post_id => posts.id) +# diff --git a/app/models/user.rb b/app/models/user.rb index d9678d1a1c7..9d682a62bd8 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,95 +7,102 @@ class User < ActiveRecord::Base include SecondFactorManager include HasDestroyedWebHook - DEFAULT_FEATURED_BADGE_COUNT = 3 - - # not deleted on user delete has_many :posts - has_many :topics - has_many :uploads - + has_many :notifications, dependent: :delete_all + has_many :topic_users, dependent: :delete_all has_many :category_users, dependent: :destroy has_many :tag_users, dependent: :destroy has_many :user_api_keys, dependent: :destroy - has_many :topic_allowed_users, dependent: :destroy - has_many :user_archived_messages, dependent: :destroy - has_many :email_change_requests, dependent: :destroy - has_many :email_tokens, dependent: :destroy - has_many :invites, dependent: :destroy - has_many :topic_links, dependent: :destroy - has_many :user_uploads, dependent: :destroy - has_many :user_emails, dependent: :destroy - has_many :user_associated_accounts, dependent: :destroy - has_many :oauth2_user_infos, dependent: :destroy - has_many :user_second_factors, dependent: :destroy - has_many :user_badges, -> { for_enabled_badges }, dependent: :destroy - has_many :user_auth_tokens, dependent: :destroy - has_many :group_users, dependent: :destroy - has_many :user_warnings, dependent: :destroy - has_many :api_keys, dependent: :destroy - has_many :push_subscriptions, dependent: :destroy - has_many :acting_group_histories, dependent: :destroy, foreign_key: :acting_user_id, class_name: 'GroupHistory' - has_many :targeted_group_histories, dependent: :destroy, foreign_key: :target_user_id, class_name: 'GroupHistory' - has_many :reviewable_scores, dependent: :destroy + has_many :topics + has_many :bookmarks - has_one :user_option, dependent: :destroy - has_one :user_avatar, dependent: :destroy - has_one :github_user_info, dependent: :destroy - has_one :primary_email, -> { where(primary: true) }, class_name: 'UserEmail', dependent: :destroy - has_one :user_stat, dependent: :destroy - has_one :user_profile, dependent: :destroy, inverse_of: :user - has_one :single_sign_on_record, dependent: :destroy - has_one :anonymous_user_master, class_name: 'AnonymousUser', dependent: :destroy - has_one :anonymous_user_shadow, ->(record) { where(active: true) }, foreign_key: :master_user_id, class_name: 'AnonymousUser', dependent: :destroy - - # delete all is faster but bypasses callbacks - has_many :bookmarks, dependent: :delete_all - has_many :notifications, dependent: :delete_all - has_many :topic_users, dependent: :delete_all - has_many :email_logs, dependent: :delete_all - has_many :incoming_emails, dependent: :delete_all - has_many :user_visits, dependent: :delete_all - has_many :user_auth_token_logs, dependent: :delete_all - has_many :group_requests, dependent: :delete_all - has_many :muted_user_records, class_name: 'MutedUser', dependent: :delete_all - has_many :ignored_user_records, class_name: 'IgnoredUser', dependent: :delete_all - - # dependent deleting handled via before_destroy (special cases) + # dependent deleting handled via before_destroy has_many :user_actions has_many :post_actions - has_many :post_timings - has_many :directory_items - has_many :security_keys, -> { - where(enabled: true) - }, class_name: "UserSecurityKey" + DEFAULT_FEATURED_BADGE_COUNT = 3 + + has_many :user_badges, -> { for_enabled_badges }, dependent: :destroy has_many :badges, through: :user_badges has_many :default_featured_user_badges, -> { for_enabled_badges.grouped_with_count.where("featured_rank <= ?", DEFAULT_FEATURED_BADGE_COUNT) }, class_name: "UserBadge" + has_many :email_logs, dependent: :delete_all + has_many :incoming_emails, dependent: :delete_all + has_many :post_timings + has_many :topic_allowed_users, dependent: :destroy has_many :topics_allowed, through: :topic_allowed_users, source: :topic + has_many :email_tokens, dependent: :destroy + has_many :user_visits, dependent: :destroy + has_many :invites, dependent: :destroy + has_many :topic_links, dependent: :destroy + has_many :uploads + has_many :user_warnings + has_many :user_archived_messages, dependent: :destroy + has_many :email_change_requests, dependent: :destroy + + # see before_destroy + has_many :directory_items + has_many :user_auth_tokens, dependent: :destroy + has_many :user_auth_token_logs, dependent: :destroy + + has_many :group_users, dependent: :destroy has_many :groups, through: :group_users + has_many :group_requests, dependent: :destroy has_many :secure_categories, through: :groups, source: :categories - # deleted in user_second_factors relationship + has_many :user_uploads, dependent: :destroy + has_many :user_emails, dependent: :destroy + + has_one :primary_email, -> { where(primary: true) }, class_name: 'UserEmail', dependent: :destroy + + has_one :user_option, dependent: :destroy + has_one :user_avatar, dependent: :destroy + has_many :user_associated_accounts, dependent: :destroy + has_one :github_user_info, dependent: :destroy + has_many :oauth2_user_infos, dependent: :destroy + has_many :user_second_factors, dependent: :destroy + has_many :totps, -> { where(method: UserSecondFactor.methods[:totp], enabled: true) }, class_name: "UserSecondFactor" + has_many :security_keys, -> { + where(enabled: true) + }, class_name: "UserSecurityKey" + + has_one :anonymous_user_master, class_name: 'AnonymousUser' + has_one :anonymous_user_shadow, ->(record) { where(active: true) }, foreign_key: :master_user_id, class_name: 'AnonymousUser' + has_one :master_user, through: :anonymous_user_master has_one :shadow_user, through: :anonymous_user_shadow, source: :user + has_one :user_stat, dependent: :destroy + has_one :user_profile, dependent: :destroy, inverse_of: :user has_one :profile_background_upload, through: :user_profile has_one :card_background_upload, through: :user_profile + has_one :single_sign_on_record, dependent: :destroy belongs_to :approved_by, class_name: 'User' belongs_to :primary_group, class_name: 'Group' + has_many :muted_user_records, class_name: 'MutedUser' has_many :muted_users, through: :muted_user_records + + has_many :ignored_user_records, class_name: 'IgnoredUser' has_many :ignored_users, through: :ignored_user_records + has_many :api_keys, dependent: :destroy + + has_many :push_subscriptions, dependent: :destroy + belongs_to :uploaded_avatar, class_name: 'Upload' + has_many :acting_group_histories, dependent: :destroy, foreign_key: :acting_user_id, class_name: 'GroupHistory' + has_many :targeted_group_histories, dependent: :destroy, foreign_key: :target_user_id, class_name: 'GroupHistory' + + has_many :reviewable_scores, dependent: :destroy + delegate :last_sent_email_address, to: :email_logs validates_presence_of :username @@ -157,9 +164,6 @@ class User < ActiveRecord::Base DirectoryItem.where(user_id: self.id) .where('period_type in (?)', DirectoryItem.period_types.values) .delete_all - - # our relationship filters on enabled, this makes sure everything is deleted - UserSecurityKey.where(user_id: self.id).delete_all end # Skip validating email, for example from a particular auth provider plugin @@ -929,7 +933,7 @@ class User < ActiveRecord::Base def activate if email_token = self.email_tokens.active.where(email: self.email).first - EmailToken.confirm(email_token.token, skip_reviewable: true) + user = EmailToken.confirm(email_token.token, skip_reviewable: true) end self.update!(active: true) create_reviewable @@ -1115,9 +1119,10 @@ class User < ActiveRecord::Base end def number_of_rejected_posts - ReviewableQueuedPost - .where(status: Reviewable.statuses[:rejected]) - .where(created_by_id: self.id) + Post.with_deleted + .where(user_id: self.id) + .joins('INNER JOIN reviewables r ON posts.id = r.target_id') + .where(r: { status: Reviewable.statuses[:rejected], type: ReviewableQueuedPost.name }) .count end diff --git a/app/models/user_avatar.rb b/app/models/user_avatar.rb index bd2751d6b45..f6dbf133126 100644 --- a/app/models/user_avatar.rb +++ b/app/models/user_avatar.rb @@ -5,14 +5,6 @@ class UserAvatar < ActiveRecord::Base belongs_to :gravatar_upload, class_name: 'Upload' belongs_to :custom_upload, class_name: 'Upload' - @@custom_user_gravatar_email_hash = { - Discourse::SYSTEM_USER_ID => User.email_hash("info@discourse.org") - } - - def self.register_custom_user_gravatar_email_hash(user_id, email) - @@custom_user_gravatar_email_hash[user_id] = User.email_hash(email) - end - def contains_upload?(id) gravatar_upload_id == id || custom_upload_id == id end @@ -20,14 +12,14 @@ class UserAvatar < ActiveRecord::Base def update_gravatar! DistributedMutex.synchronize("update_gravatar_#{user_id}") do begin - self.update!(last_gravatar_download_attempt: Time.zone.now) + self.update!(last_gravatar_download_attempt: Time.now) max = Discourse.avatar_sizes.max # The user could be deleted before this executes return if user.blank? || user.primary_email.blank? - email_hash = @@custom_user_gravatar_email_hash[user_id] || user.email_hash + email_hash = user_id == Discourse::SYSTEM_USER_ID ? User.email_hash("info@discourse.org") : user.email_hash gravatar_url = "https://#{SiteSetting.gravatar_base_url}/avatar/#{email_hash}.png?s=#{max}&d=404&reset_cache=#{SecureRandom.urlsafe_base64(5)}" # follow redirects in case gravatar change rules on us diff --git a/app/models/web_hook_event_type.rb b/app/models/web_hook_event_type.rb index 442f14cb8ce..952c1c2062c 100644 --- a/app/models/web_hook_event_type.rb +++ b/app/models/web_hook_event_type.rb @@ -7,6 +7,8 @@ class WebHookEventType < ActiveRecord::Base GROUP = 4 CATEGORY = 5 TAG = 6 + FLAG = 7 + QUEUED_POST = 8 REVIEWABLE = 9 NOTIFICATION = 10 SOLVED = 11 diff --git a/app/serializers/about_serializer.rb b/app/serializers/about_serializer.rb index 8230c590a4c..308f990fd6c 100644 --- a/app/serializers/about_serializer.rb +++ b/app/serializers/about_serializer.rb @@ -21,16 +21,7 @@ class AboutSerializer < ApplicationSerializer :title, :locale, :version, - :https, - :can_see_about_stats - - def can_see_about_stats - scope.can_see_about_stats? - end - - def include_stats? - can_see_about_stats - end + :https def stats object.class.fetch_cached_stats || Jobs::AboutStats.new.execute({}) diff --git a/app/services/badge_granter.rb b/app/services/badge_granter.rb index a5027c53030..e402fb880cc 100644 --- a/app/services/badge_granter.rb +++ b/app/services/badge_granter.rb @@ -3,11 +3,11 @@ class BadgeGranter def self.disable_queue - @queue_disabled = true + @queue_enabled = false end def self.enable_queue - @queue_disabled = false + @queue_enabled = true end def initialize(badge, user, opts = {}) @@ -124,7 +124,7 @@ class BadgeGranter end def self.queue_badge_grant(type, opt) - return if !SiteSetting.enable_badges || @queue_disabled + return if !SiteSetting.enable_badges || !@queue_enabled payload = nil case type diff --git a/app/views/email/default_template.html b/app/views/email/default_template.html index 99b2e94995c..382f939273b 100644 --- a/app/views/email/default_template.html +++ b/app/views/email/default_template.html @@ -3,8 +3,6 @@ - -