mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 01:01:30 +02:00
email newsletter capability
This commit is contained in:
parent
d4303c7e46
commit
b986c57577
8 changed files with 169 additions and 1 deletions
|
@ -118,6 +118,15 @@ class Site < Sequel::Model
|
|||
maximum_site_files: 1000
|
||||
)
|
||||
|
||||
def self.newsletter_sites
|
||||
Site.select(:email).
|
||||
exclude(email: 'nil').exclude(is_banned: true).
|
||||
where{updated_at > EMAIL_BLAST_MAXIMUM_AGE}.
|
||||
where{changed_count > 0}.
|
||||
order(:updated_at.desc).
|
||||
all
|
||||
end
|
||||
|
||||
def too_many_files?(file_count=0)
|
||||
(site_files_dataset.count + file_count) > plan_feature(:maximum_site_files)
|
||||
end
|
||||
|
@ -140,6 +149,14 @@ class Site < Sequel::Model
|
|||
|
||||
BROWSE_PAGINATION_LENGTH = 100
|
||||
|
||||
EMAIL_BLAST_MAXIMUM_AGE = 6.months.ago
|
||||
|
||||
if ENV['RACK_ENV'] == 'test'
|
||||
EMAIL_BLAST_MAXIMUM_PER_DAY = 2
|
||||
else
|
||||
EMAIL_BLAST_MAXIMUM_PER_DAY = 2000
|
||||
end
|
||||
|
||||
many_to_many :tags
|
||||
|
||||
one_to_many :profile_comments
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue