fix for comment limit not applying to profile comments

This commit is contained in:
Kyle Drake 2024-07-17 17:02:51 -05:00
parent 0531a1d85f
commit dfd30d489c

View file

@ -171,7 +171,7 @@ class Site < Sequel::Model
end end
MAXIMUM_EMAIL_CONFIRMATIONS = 20 MAXIMUM_EMAIL_CONFIRMATIONS = 20
MAX_COMMENTS_PER_DAY = 5 MAX_COMMENTS_PER_DAY = 10
SANDBOX_TIME = 14.days SANDBOX_TIME = 14.days
BLACK_BOX_WAIT_TIME = 10.seconds BLACK_BOX_WAIT_TIME = 10.seconds
MAX_DISPLAY_FOLLOWS = 56*3 MAX_DISPLAY_FOLLOWS = 56*3
@ -603,16 +603,16 @@ class Site < Sequel::Model
def commenting_allowed? def commenting_allowed?
return false if owner.commenting_banned == true return false if owner.commenting_banned == true
return true if owner.commenting_allowed return false if owner.commenting_too_much?
if owner.supporter? if owner.supporter?
set commenting_allowed: true set commenting_allowed: true
save_changes validate: false save_changes validate: false
return true return true
else
return false if owner.commenting_too_much?
end end
return true if owner.commenting_allowed
if (account_sites_events_dataset.exclude(site_change_id: nil).count >= COMMENTING_ALLOWED_UPDATED_COUNT || (created_at < Date.new(2014, 12, 25).to_time && changed_count >= COMMENTING_ALLOWED_UPDATED_COUNT )) && if (account_sites_events_dataset.exclude(site_change_id: nil).count >= COMMENTING_ALLOWED_UPDATED_COUNT || (created_at < Date.new(2014, 12, 25).to_time && changed_count >= COMMENTING_ALLOWED_UPDATED_COUNT )) &&
created_at < Time.now - 604800 created_at < Time.now - 604800
owner.set commenting_allowed: true owner.set commenting_allowed: true