FIX: Determine uncategorized category name using new core pattern
This commit is contained in:
parent
3c030c8fbf
commit
f75903cae5
|
@ -41,7 +41,9 @@ module DiscourseChat
|
||||||
topic = post.topic
|
topic = post.topic
|
||||||
|
|
||||||
category = ''
|
category = ''
|
||||||
if topic.category
|
if topic.category&.uncategorized?
|
||||||
|
category = "[#{I18n.t('uncategorized_category_name')}]"
|
||||||
|
elsif topic.category
|
||||||
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ module DiscourseChat
|
||||||
author_icon: post.user.small_avatar_url,
|
author_icon: post.user.small_avatar_url,
|
||||||
color: topic.category ? "##{topic.category.color}" : nil,
|
color: topic.category ? "##{topic.category.color}" : nil,
|
||||||
text: post.excerpt(SiteSetting.chat_integration_mattermost_excerpt_length, text_entities: true, strip_links: true, remap_emoji: true),
|
text: post.excerpt(SiteSetting.chat_integration_mattermost_excerpt_length, text_entities: true, strip_links: true, remap_emoji: true),
|
||||||
title: "#{topic.title} #{(category == '[uncategorized]') ? '' : category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
title: "#{topic.title} #{category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
||||||
title_link: post.full_url,
|
title_link: post.full_url,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,9 @@ module DiscourseChat::Provider::RocketchatProvider
|
||||||
topic = post.topic
|
topic = post.topic
|
||||||
|
|
||||||
category = ''
|
category = ''
|
||||||
if topic.category
|
if topic.category&.uncategorized?
|
||||||
|
category = "[#{I18n.t('uncategorized_category_name')}]"
|
||||||
|
elsif topic.category
|
||||||
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,7 +38,7 @@ module DiscourseChat::Provider::RocketchatProvider
|
||||||
color: topic.category ? "##{topic.category.color}" : nil,
|
color: topic.category ? "##{topic.category.color}" : nil,
|
||||||
text: post.excerpt(SiteSetting.chat_integration_rocketchat_excerpt_length, text_entities: true, strip_links: true, remap_emoji: true),
|
text: post.excerpt(SiteSetting.chat_integration_rocketchat_excerpt_length, text_entities: true, strip_links: true, remap_emoji: true),
|
||||||
mrkdwn_in: ["text"],
|
mrkdwn_in: ["text"],
|
||||||
title: "#{topic.title} #{(category == '[uncategorized]') ? '' : category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
title: "#{topic.title} #{category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
||||||
title_link: post.full_url
|
title_link: post.full_url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,9 @@ module DiscourseChat::Provider::SlackProvider
|
||||||
topic = post.topic
|
topic = post.topic
|
||||||
|
|
||||||
category = ''
|
category = ''
|
||||||
if topic.category
|
if topic.category&.uncategorized?
|
||||||
|
category = "[#{I18n.t('uncategorized_category_name')}]"
|
||||||
|
elsif topic.category
|
||||||
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
category = (topic.category.parent_category) ? "[#{topic.category.parent_category.name}/#{topic.category.name}]" : "[#{topic.category.name}]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ module DiscourseChat::Provider::SlackProvider
|
||||||
color: topic.category ? "##{topic.category.color}" : nil,
|
color: topic.category ? "##{topic.category.color}" : nil,
|
||||||
text: excerpt(post),
|
text: excerpt(post),
|
||||||
mrkdwn_in: ["text"],
|
mrkdwn_in: ["text"],
|
||||||
title: "#{topic.title} #{(category == '[uncategorized]') ? '' : category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
title: "#{topic.title} #{category} #{topic.tags.present? ? topic.tags.map(&:name).join(', ') : ''}",
|
||||||
title_link: post.full_url,
|
title_link: post.full_url,
|
||||||
thumb_url: post.full_url
|
thumb_url: post.full_url
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue