diff --git a/app/models/badge.rb b/app/models/badge.rb index fe559099b..9db8b37b0 100644 --- a/app/models/badge.rb +++ b/app/models/badge.rb @@ -7,14 +7,47 @@ class Badge < ActiveRecord::Base GreatPost = 8 Autobiographer = 9 Editor = 10 - PayingItForward = 11 + FirstLike = 11 + FirstShare = 12 + FirstFlag = 13 # other consts AutobiographerMinBioLength = 10 module Queries - PayingItForward = < 2 end end Badge.seed do |b| - b.id = Badge::PayingItForward - b.name = "Paying It Forward" + b.id = Badge::FirstLike + b.name = "First Like" b.badge_type_id = BadgeType::Bronze b.multiple_grant = false b.target_posts = true - b.query = Badge::Queries::PayingItForward + b.query = Badge::Queries::FirstLike +end + +Badge.seed do |b| + b.id = Badge::FirstFlag + b.name = "First Flag" + b.badge_type_id = BadgeType::Bronze + b.multiple_grant = false + b.target_posts = false + b.query = Badge::Queries::FirstFlag +end + +Badge.seed do |b| + b.id = Badge::FirstShare + b.name = "First Share" + b.badge_type_id = BadgeType::Bronze + b.multiple_grant = false + b.target_posts = true + b.query = Badge::Queries::FirstShare end Badge.seed do |b| diff --git a/spec/services/badge_granter_spec.rb b/spec/services/badge_granter_spec.rb index 3dba73241..b2845aeb7 100644 --- a/spec/services/badge_granter_spec.rb +++ b/spec/services/badge_granter_spec.rb @@ -20,7 +20,7 @@ describe BadgeGranter do UserBadge.destroy_all BadgeGranter.backfill(Badge.find(Badge::Welcome)) - BadgeGranter.backfill(Badge.find(Badge::PayingItForward)) + BadgeGranter.backfill(Badge.find(Badge::FirstLike)) b = UserBadge.find_by(user_id: post.user_id) b.post_id.should == post.id @@ -28,7 +28,7 @@ describe BadgeGranter do b = UserBadge.find_by(user_id: user2.id) b.post_id.should == post.id - b.badge_id = Badge::PayingItForward + b.badge_id = Badge::FirstLike end it 'should grant missing badges' do