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