mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
show some site change activity in global activity
This commit is contained in:
parent
293ce32b16
commit
3e8514fde4
2 changed files with 23 additions and 1 deletions
|
@ -8,7 +8,20 @@ get '/activity' do
|
||||||
global_dataset.where! Sequel.qualify(:events, :id) => params[:event_id]
|
global_dataset.where! Sequel.qualify(:events, :id) => params[:event_id]
|
||||||
end
|
end
|
||||||
|
|
||||||
@events = global_dataset.all
|
events = global_dataset.all
|
||||||
|
site_change_events = Event.global_site_changes_dataset.limit(25).all
|
||||||
|
|
||||||
|
@events = []
|
||||||
|
|
||||||
|
events.each do |event|
|
||||||
|
unless site_change_events.empty?
|
||||||
|
until site_change_events.first.created_at < event.created_at
|
||||||
|
@events << site_change_events.shift
|
||||||
|
break if site_change_events.empty?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@events << event
|
||||||
|
end
|
||||||
|
|
||||||
erb :'activity'
|
erb :'activity'
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,6 +14,7 @@ class Event < Sequel::Model
|
||||||
|
|
||||||
DEFAULT_GLOBAL_LIMIT = 300
|
DEFAULT_GLOBAL_LIMIT = 300
|
||||||
GLOBAL_VIEWS_MINIMUM = 5
|
GLOBAL_VIEWS_MINIMUM = 5
|
||||||
|
GLOBAL_VIEWS_SITE_CHANGE_MINIMUM = 1000
|
||||||
|
|
||||||
def self.news_feed_default_dataset
|
def self.news_feed_default_dataset
|
||||||
select_all(:events).
|
select_all(:events).
|
||||||
|
@ -33,6 +34,14 @@ class Event < Sequel::Model
|
||||||
where(site_change_id: nil)
|
where(site_change_id: nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.global_site_changes_dataset
|
||||||
|
news_feed_default_dataset.
|
||||||
|
where{views > GLOBAL_VIEWS_SITE_CHANGE_MINIMUM}.
|
||||||
|
exclude(is_nsfw: true).
|
||||||
|
exclude(is_crashing: true).
|
||||||
|
exclude(site_change_id: nil)
|
||||||
|
end
|
||||||
|
|
||||||
def created_by?(site)
|
def created_by?(site)
|
||||||
return true if actioning_site_id == site.id
|
return true if actioning_site_id == site.id
|
||||||
false
|
false
|
||||||
|
|
Loading…
Add table
Reference in a new issue