fix site unblocking

This commit is contained in:
Kyle Drake 2022-11-12 13:07:49 -06:00
parent b54b2a4818
commit 6ea07df6a8
5 changed files with 39 additions and 13 deletions

View file

@ -73,6 +73,9 @@ class Site < Sequel::Model
ROOT_INDEX_HTML_REGEX = /^\/?index.html$/
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
MAX_FOLLOWS = 1000
BROWSE_MINIMUM_VIEWS = 100
BROWSE_MINIMUM_FOLLOWER_VIEWS = 10_000
SCREENSHOT_DELAY_SECONDS = 30
SCREENSHOT_RESOLUTIONS = ['540x405', '210x158', '100x100', '50x50']
@ -629,6 +632,12 @@ class Site < Sequel::Model
add_blocking site: site
end
def unblock!(site)
block = blockings_dataset.filter(site_id: site.id).first
return true if block.nil?
block.destroy
end
def is_blocking?(site)
@blockings ||= blockings
!@blockings.select {|b| b.site_id == site.id}.empty?