mirror of
https://github.com/tildeverse/lobsters
synced 2024-06-25 01:37:05 +00:00
note submitters in keystore
This commit is contained in:
parent
354a90ec92
commit
909feb49cb
|
@ -10,7 +10,7 @@ class Comment < ActiveRecord::Base
|
|||
:indent_level
|
||||
|
||||
before_create :assign_short_id_and_upvote
|
||||
after_create :assign_votes
|
||||
after_create :assign_votes, :mark_submitter
|
||||
after_destroy :unassign_votes
|
||||
|
||||
MAX_EDIT_MINS = 45
|
||||
|
@ -50,6 +50,10 @@ class Comment < ActiveRecord::Base
|
|||
self.story.update_comment_count!
|
||||
end
|
||||
|
||||
def mark_submitter
|
||||
Keystore.increment_value_for("user:#{self.user_id}:comments_posted")
|
||||
end
|
||||
|
||||
# http://evanmiller.org/how-not-to-sort-by-average-rating.html
|
||||
# https://github.com/reddit/reddit/blob/master/r2/r2/lib/db/_sorts.pyx
|
||||
def confidence
|
||||
|
|
|
@ -20,6 +20,7 @@ class Story < ActiveRecord::Base
|
|||
|
||||
after_save :deal_with_tags
|
||||
before_create :assign_short_id
|
||||
after_create :mark_submitter
|
||||
|
||||
validate do
|
||||
if self.url.present?
|
||||
|
@ -57,6 +58,10 @@ class Story < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def mark_submitter
|
||||
Keystore.increment_value_for("user:#{self.user_id}:stories_submitted")
|
||||
end
|
||||
|
||||
def deal_with_tags
|
||||
(self.tags_to_delete || []).each do |t|
|
||||
if t.is_a?(Tagging)
|
||||
|
|
Loading…
Reference in New Issue
Block a user