forked from e621ng/e621ng
better check for forum post votability
This commit is contained in:
parent
9fda456b7d
commit
caf60d690d
@ -125,7 +125,9 @@ class ForumPost < ApplicationRecord
|
||||
end
|
||||
|
||||
def votable?
|
||||
body.to_s.match?(/->/)
|
||||
TagAlias.where(forum_post_id: id).exists? ||
|
||||
TagImplication.where(forum_post_id: id).exists? ||
|
||||
BulkUpdateRequest.where(forum_post_id: id).exists?
|
||||
end
|
||||
|
||||
def voted?(user, score)
|
||||
|
@ -0,0 +1,8 @@
|
||||
class AddTagRelationshipForumPostIndices < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
execute "set statement_timeout = 0"
|
||||
add_index :tag_aliases, :forum_post_id
|
||||
add_index :tag_implications, :forum_post_id
|
||||
add_index :bulk_update_requests, :forum_post_id
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user