mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 01:47:46 +08:00
FEATURE: Gives Back badge
This commit is contained in:
@ -27,6 +27,7 @@ class Badge < ActiveRecord::Base
|
||||
HotLink = 29
|
||||
FamousLink = 30
|
||||
Admired = 31
|
||||
GivesBack = 32
|
||||
|
||||
# other consts
|
||||
AutobiographerMinBioLength = 10
|
||||
@ -207,6 +208,16 @@ SQL
|
||||
HAVING count(*)::float / us.post_count > 0.75
|
||||
SQL
|
||||
|
||||
GivesBack = <<-SQL
|
||||
SELECT us.user_id, current_timestamp AS granted_at
|
||||
FROM user_stats AS us
|
||||
INNER JOIN posts AS p ON us.user_id = p.user_id
|
||||
WHERE p.like_count > 0
|
||||
AND (:backfill OR us.user_id IN (:user_ids))
|
||||
GROUP BY us.user_id
|
||||
HAVING us.likes_given::float / count(*) > 5.0
|
||||
SQL
|
||||
|
||||
def self.invite_badge(count,trust_level)
|
||||
"
|
||||
SELECT u.id user_id, current_timestamp granted_at
|
||||
|
Reference in New Issue
Block a user