better check for forum post votability
This commit is contained in:
@@ -125,7 +125,9 @@ class ForumPost < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def votable?
|
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
|
end
|
||||||
|
|
||||||
def voted?(user, score)
|
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
|
||||||
Reference in New Issue
Block a user