FEATURE: Add Wiki Editor badge. (#6511)
This commit is contained in:
parent
637123ff6f
commit
b69652278f
|
@ -15,6 +15,7 @@ class Badge < ActiveRecord::Base
|
|||
GreatPost = 8
|
||||
Autobiographer = 9
|
||||
Editor = 10
|
||||
WikiEditor = 48
|
||||
|
||||
FirstLike = 11
|
||||
FirstShare = 12
|
||||
|
|
|
@ -3655,6 +3655,11 @@ en:
|
|||
description: First post edit
|
||||
long_description: |
|
||||
This badge is granted the first time you edit one of your posts. While you won’t be able to edit your posts forever, editing is encouraged — you can improve the formatting, fix small mistakes, or add anything you missed when you originally posted. Edit to make your posts even better!
|
||||
wiki_editor:
|
||||
name: Wiki Editor
|
||||
description: First wiki edit
|
||||
long_description: |
|
||||
This badge is granted the first time you edit one wiki post.
|
||||
basic_user:
|
||||
name: Basic
|
||||
description: <a href="https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/">Granted</a> all essential community functions
|
||||
|
|
|
@ -233,6 +233,19 @@ Badge.seed do |b|
|
|||
b.system = true
|
||||
end
|
||||
|
||||
Badge.seed do |b|
|
||||
b.id = Badge::WikiEditor
|
||||
b.name = "Wiki Editor"
|
||||
b.badge_type_id = BadgeType::Bronze
|
||||
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
|
||||
end
|
||||
|
||||
[
|
||||
[Badge::NicePost, "Nice Post", BadgeType::Bronze, false],
|
||||
[Badge::GoodPost, "Good Post", BadgeType::Silver, false],
|
||||
|
|
|
@ -99,6 +99,15 @@ SQL
|
|||
GROUP BY p.user_id
|
||||
SQL
|
||||
|
||||
WikiEditor = <<~SQL
|
||||
SELECT DISTINCT ON (pr.user_id) pr.user_id, pr.post_id, pr.created_at granted_at
|
||||
FROM post_revisions pr
|
||||
JOIN badge_posts p on p.id = pr.post_id
|
||||
WHERE p.wiki
|
||||
AND NOT pr.hidden
|
||||
AND (:backfill OR p.id IN (:post_ids))
|
||||
SQL
|
||||
|
||||
Welcome = <<SQL
|
||||
SELECT p.user_id, min(post_id) post_id, min(pa.created_at) granted_at
|
||||
FROM post_actions pa
|
||||
|
|
Loading…
Reference in New Issue