mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: when deleting a tag, the warning modal has the wrong topic count
This commit is contained in:
parent
ad58a1743b
commit
298ee26908
@ -119,8 +119,8 @@ export default Ember.Controller.extend(BulkTopicSelection, {
|
|||||||
|
|
||||||
deleteTag() {
|
deleteTag() {
|
||||||
const self = this;
|
const self = this;
|
||||||
const topicsLength = this.get('list.topic_list.topics.length');
|
const numTopics = this.get('list.topic_list.tags.firstObject.topic_count') || 0;
|
||||||
const confirmText = topicsLength === 0 ? I18n.t("tagging.delete_confirm_no_topics") : I18n.t("tagging.delete_confirm", {count: topicsLength});
|
const confirmText = numTopics === 0 ? I18n.t("tagging.delete_confirm_no_topics") : I18n.t("tagging.delete_confirm", {count: numTopics});
|
||||||
bootbox.confirm(confirmText, function(result) {
|
bootbox.confirm(confirmText, function(result) {
|
||||||
if (!result) { return; }
|
if (!result) { return; }
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ class TopicList
|
|||||||
:for_period,
|
:for_period,
|
||||||
:per_page,
|
:per_page,
|
||||||
:top_tags,
|
:top_tags,
|
||||||
:current_user
|
:current_user,
|
||||||
|
:tags
|
||||||
|
|
||||||
def initialize(filter, current_user, topics, opts = nil)
|
def initialize(filter, current_user, topics, opts = nil)
|
||||||
@filter = filter
|
@filter = filter
|
||||||
@ -46,6 +47,10 @@ class TopicList
|
|||||||
if @opts[:category]
|
if @opts[:category]
|
||||||
@category = Category.find_by(id: @opts[:category_id])
|
@category = Category.find_by(id: @opts[:category_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @opts[:tags]
|
||||||
|
@tags = Tag.where(id: @opts[:tags]).all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def top_tags
|
def top_tags
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
class TagSerializer < ApplicationSerializer
|
class TagSerializer < ApplicationSerializer
|
||||||
attributes :id, :name
|
attributes :id, :name, :topic_count
|
||||||
end
|
end
|
||||||
|
@ -7,9 +7,11 @@ class TopicListSerializer < ApplicationSerializer
|
|||||||
:draft_sequence,
|
:draft_sequence,
|
||||||
:for_period,
|
:for_period,
|
||||||
:per_page,
|
:per_page,
|
||||||
:top_tags
|
:top_tags,
|
||||||
|
:tags
|
||||||
|
|
||||||
has_many :topics, serializer: TopicListItemSerializer, embed: :objects
|
has_many :topics, serializer: TopicListItemSerializer, embed: :objects
|
||||||
|
has_many :tags, serializer: TagSerializer, embed: :objects
|
||||||
|
|
||||||
def can_create_topic
|
def can_create_topic
|
||||||
scope.can_create?(Topic)
|
scope.can_create?(Topic)
|
||||||
@ -26,4 +28,8 @@ class TopicListSerializer < ApplicationSerializer
|
|||||||
def include_top_tags?
|
def include_top_tags?
|
||||||
Tag.include_tags?
|
Tag.include_tags?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def include_tags?
|
||||||
|
SiteSetting.tagging_enabled && object.tags.present?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user