mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
FIX: Badges appeared in wrong badge group
Some badges always appeared in the "Other" group (the default group) and some badges were always moved back into the original group during seeding. Now badges are either in the correct, seeded group or stay in a custom group if the admin moved the badge into a custom group.
This commit is contained in:
parent
5218702702
commit
d82628987a
|
@ -199,7 +199,7 @@ class Badge < ActiveRecord::Base
|
|||
|
||||
def default_badge_grouping_id=(val)
|
||||
# allow to correct orphans
|
||||
if !self.badge_grouping_id || self.badge_grouping_id < 0
|
||||
if !self.badge_grouping_id || self.badge_grouping_id <= BadgeGrouping::Other
|
||||
self.badge_grouping_id = val
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ SQL
|
|||
b.default_badge_grouping_id = BadgeGrouping::TrustLevel
|
||||
b.trigger = Badge::Trigger::TrustLevelChange
|
||||
# allow title for tl3 and above
|
||||
b.default_allow_title = id > 2
|
||||
b.default_allow_title = id > Badge::Member
|
||||
b.default_icon = "fa-user"
|
||||
b.system = true
|
||||
end
|
||||
|
@ -134,7 +134,6 @@ Badge.seed do |b|
|
|||
b.target_posts = true
|
||||
b.show_posts = false
|
||||
b.query = BadgeQueries::FirstFlag
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::PostAction
|
||||
b.auto_revoke = false
|
||||
|
@ -227,7 +226,6 @@ Badge.seed do |b|
|
|||
b.badge_type_id = BadgeType::Bronze
|
||||
b.multiple_grant = false
|
||||
b.query = BadgeQueries::Editor
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::PostRevision
|
||||
b.system = true
|
||||
|
@ -240,7 +238,6 @@ Badge.seed do |b|
|
|||
b.multiple_grant = false
|
||||
b.target_posts = true
|
||||
b.query = BadgeQueries::WikiEditor
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::PostRevision
|
||||
b.system = true
|
||||
|
@ -294,7 +291,6 @@ end
|
|||
b.target_posts = true
|
||||
b.show_posts = true
|
||||
b.query = BadgeQueries.linking_badge(count)
|
||||
b.badge_grouping_id = BadgeGrouping::Posting
|
||||
b.default_badge_grouping_id = BadgeGrouping::Posting
|
||||
# don't trigger for now, its too expensive
|
||||
b.trigger = Badge::Trigger::None
|
||||
|
@ -331,7 +327,6 @@ end
|
|||
b.default_icon = "fa-heart"
|
||||
b.badge_type_id = level
|
||||
b.query = BadgeQueries.liked_back(count, ratio)
|
||||
b.badge_grouping_id = BadgeGrouping::Community
|
||||
b.default_badge_grouping_id = BadgeGrouping::Community
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.auto_revoke = false
|
||||
|
@ -350,7 +345,6 @@ end
|
|||
b.default_icon = "fa-heart"
|
||||
b.badge_type_id = level
|
||||
b.query = BadgeQueries.like_rate_limit(count)
|
||||
b.badge_grouping_id = BadgeGrouping::Community
|
||||
b.default_badge_grouping_id = BadgeGrouping::Community
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.auto_revoke = false
|
||||
|
@ -366,7 +360,6 @@ Badge.seed do |b|
|
|||
b.target_posts = true
|
||||
b.show_posts = true
|
||||
b.query = BadgeQueries::FirstMention
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::PostRevision
|
||||
b.system = true
|
||||
|
@ -380,7 +373,6 @@ Badge.seed do |b|
|
|||
b.target_posts = true
|
||||
b.show_posts = true
|
||||
b.query = nil
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.system = true
|
||||
|
@ -394,7 +386,6 @@ Badge.seed do |b|
|
|||
b.target_posts = true
|
||||
b.show_posts = true
|
||||
b.query = nil
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.system = true
|
||||
|
@ -408,7 +399,6 @@ Badge.seed do |b|
|
|||
b.target_posts = true
|
||||
b.show_posts = true
|
||||
b.query = nil
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.system = true
|
||||
|
@ -422,7 +412,6 @@ Badge.seed do |b|
|
|||
b.target_posts = false
|
||||
b.show_posts = false
|
||||
b.query = nil
|
||||
b.badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.default_badge_grouping_id = BadgeGrouping::GettingStarted
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.system = true
|
||||
|
@ -439,7 +428,6 @@ end
|
|||
b.default_icon = "fa-eye"
|
||||
b.badge_type_id = level
|
||||
b.query = BadgeQueries.consecutive_visits(days)
|
||||
b.badge_grouping_id = BadgeGrouping::Community
|
||||
b.default_badge_grouping_id = BadgeGrouping::Community
|
||||
b.trigger = Badge::Trigger::None
|
||||
b.auto_revoke = false
|
||||
|
|
Loading…
Reference in New Issue
Block a user