mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 20:22:45 +08:00
Add some TODO's
This commit is contained in:
parent
ebd5fa76c5
commit
b58da2fcf9
|
@ -292,6 +292,7 @@ class Post < ActiveRecord::Base
|
|||
end
|
||||
|
||||
|
||||
# TODO: move to post-analyzer?
|
||||
# Determine what posts are quoted by this post
|
||||
def extract_quoted_post_numbers
|
||||
temp_collector = []
|
||||
|
|
|
@ -96,20 +96,18 @@ class PostAlertObserver < ActiveRecord::Observer
|
|||
display_username: opts[:display_username] || post.user.username }.to_json)
|
||||
end
|
||||
|
||||
# TODO: Move to post-analyzer?
|
||||
# Returns a list users who have been mentioned
|
||||
def extract_mentioned_users(post)
|
||||
User.where(username_lower: post.raw_mentions).where("id <> ?", post.user_id)
|
||||
end
|
||||
|
||||
# TODO: Move to post-analyzer?
|
||||
# Returns a list of users who were quoted in the post
|
||||
def extract_quoted_users(post)
|
||||
result = []
|
||||
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.each do |m|
|
||||
username = m.first.strip.downcase
|
||||
user = User.where("username_lower = :username and id != :id", username: username, id: post.user_id).first
|
||||
result << user if user.present?
|
||||
end
|
||||
result
|
||||
post.raw.scan(/\[quote=\"([^,]+),.+\"\]/).uniq.map do |m|
|
||||
User.where("username_lower = :username and id != :id", username: m.first.strip.downcase, id: post.user_id).first
|
||||
end.compact
|
||||
end
|
||||
|
||||
# Notify a bunch of users
|
||||
|
|
Loading…
Reference in New Issue
Block a user