Skip to content

Commit 9c0e2c0

Browse files
committed
new hosting (/s/udj6qf) tweaks + placeholders
1 parent f58afbb commit 9c0e2c0

File tree

6 files changed

+43
-29
lines changed

6 files changed

+43
-29
lines changed

.gitignore

+25-21
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
1-
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2-
#
3-
# If you find yourself ignoring temporary files generated by your text editor
1+
# If you find yourself ignoring temporary files generated by your editor
42
# or operating system, you probably want to add a global ignore instead:
53
# git config --global core.excludesfile '~/.gitignore_global'
64

7-
# Ignore bundler config.
5+
# local bundler config
86
/.bundle
97

10-
# Ignore the default SQLite database.
8+
# default databases
119
/db/*.sqlite3
1210
/db/*.sqlite3-journal
1311
/db/sphinx
1412

15-
# Ignore all logfiles and tempfiles.
13+
# log and tmpfiles
14+
.byebug*
1615
/log
1716
/tmp
17+
yarn-error.log
18+
yarn.lock
1819

20+
# vendored
21+
node_modules/
1922
vendor/bundle
23+
24+
# compiled output
25+
coverage/
2026
public/assets
27+
28+
# cache
2129
public/avatars
2230
public/sitemap*
23-
node_modules/
24-
coverage/
25-
yarn-error.log
26-
yarn.lock
27-
.byebug*
2831

2932
# templates to be created per-site
30-
app/views/home/privacy.*
33+
app/assets/stylesheets/local/*
34+
app/views/home/404.*
3135
app/views/home/about.*
3236
app/views/home/chat.*
33-
app/views/home/404.*
37+
app/views/home/privacy.*
3438
app/views/layouts/_footer.*
35-
app/assets/stylesheets/local/*
36-
public/favicon.ico
3739
public/apple-touch-icon*
40+
public/favicon.ico
3841

39-
# files added in production
40-
lib/tasks/deploy.rake
41-
config/initializers/production.rb
42-
config/initializers/development.rb
42+
# prod config
43+
config/credentials.yml.enc
4344
config/database.yml
44-
config/initializers/secret_token.rb
45+
config/initializers/development.rb
46+
config/initializers/production.rb
47+
config/master.key
48+
config/scout_apm.yml
4549
config/*.sphinx.conf
4650
config/unicorn.conf.rb
47-
config/scout_apm.yml
51+
lib/tasks/deploy.rake

app/controllers/replies_controller.rb

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class RepliesController < ApplicationController
55
after_action :update_read_ribbons, only: [:unread]
66

77
def all
8+
render action: 'placeholder' and return
89
@heading = @title = "All Your Replies"
910
@replies = ReplyingComment
1011
.for_user(@user.id)
@@ -15,6 +16,7 @@ def all
1516
end
1617

1718
def comments
19+
render action: 'placeholder' and return
1820
@heading = @title = "Your Comment Replies"
1921
@replies = ReplyingComment
2022
.comment_replies_for(@user.id)
@@ -25,6 +27,7 @@ def comments
2527
end
2628

2729
def stories
30+
render action: 'placeholder' and return
2831
@heading = @title = "Your Story Replies"
2932
@replies = ReplyingComment
3033
.story_replies_for(@user.id)
@@ -35,6 +38,7 @@ def stories
3538
end
3639

3740
def unread
41+
render action: 'placeholder' and return
3842
@heading = @title = "Your Unread Replies"
3943
@replies = ReplyingComment.unread_replies_for(@user.id)
4044
apply_current_vote

app/helpers/traffic_helper.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module TrafficHelper
77
CACHE_FOR = 5 # minutes
88

99
def self.traffic_range
10+
return [0, 2]
1011
div = PERIOD_LENGTH * 60
1112
start_at = 90.days.ago
1213
result = ActiveRecord::Base.connection.execute <<-SQL
@@ -19,9 +20,9 @@ def self.traffic_range
1920
-- s.period,
2021
v.n_votes + (c.n_comments * 10) + (s.n_stories * 20) AS activity
2122
from
22-
(SELECT count(1) AS n_votes, floor(UNIX_TIMESTAMP(updated_at)/#{div}) AS period FROM votes WHERE updated_at >= "#{start_at}" GROUP BY period) v,
23-
(SELECT count(1) AS n_comments, floor(UNIX_TIMESTAMP(created_at)/#{div}) AS period FROM comments WHERE created_at >= "#{start_at}" GROUP BY period) c,
24-
(SELECT count(1) AS n_stories, floor(UNIX_TIMESTAMP(created_at)/#{div}) AS period FROM stories WHERE created_at >= "#{start_at}" GROUP BY period) s
23+
(SELECT count(1) AS n_votes, floor(UNIX_TIMESTAMP(updated_at)/#{div}) AS period FROM votes WHERE updated_at >= '#{start_at}' GROUP BY period) v,
24+
(SELECT count(1) AS n_comments, floor(UNIX_TIMESTAMP(created_at)/#{div}) AS period FROM comments WHERE created_at >= '#{start_at}' GROUP BY period) c,
25+
(SELECT count(1) AS n_stories, floor(UNIX_TIMESTAMP(created_at)/#{div}) AS period FROM stories WHERE created_at >= '#{start_at}' GROUP BY period) s
2526
where
2627
s.period = c.period and
2728
s.period = v.period) act;
@@ -41,12 +42,13 @@ def self.cached_traffic_range
4142
end
4243

4344
def self.current_activity
45+
return 1
4446
start_at = Time.now.utc - 15.minutes
4547
result = ActiveRecord::Base.connection.execute <<-SQL
4648
select
47-
(SELECT count(1) AS n_votes FROM votes WHERE updated_at >= "#{start_at}") +
48-
(SELECT count(1) AS n_comment FROM comments WHERE created_at >= "#{start_at}") * 10 +
49-
(SELECT count(1) AS n_stories FROM stories WHERE created_at >= "#{start_at}") * 20
49+
(SELECT count(1) AS n_votes FROM votes WHERE updated_at >= '#{start_at}') +
50+
(SELECT count(1) AS n_comment FROM comments WHERE created_at >= '#{start_at}') * 10 +
51+
(SELECT count(1) AS n_stories FROM stories WHERE created_at >= '#{start_at}') * 20
5052
SQL
5153
result.to_a.first.first
5254
end

app/models/user.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def update_unread_message_count!
588588
end
589589

590590
def unread_replies_count
591-
@unread_replies_count ||= ReplyingComment.where(user_id: self.id, is_unread: true).count
591+
0 # @unread_replies_count ||= ReplyingComment.where(user_id: self.id, is_unread: true).count
592592
end
593593

594594
def votes_for_others

app/views/home/about.html.erb

+2-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@
293293

294294
<ul>
295295
<li><p>
296-
Lobsters' hosting is donated by <a href="https://prgmr.com">Prgmr.com</a> (thanks, <a href="/u/alynpost">alynpost</a>).
296+
Lobsters is hosted at DigitalOcean. We <a href="https://lobste.rs/s/udj6qf/hosting_update">recently migrated</a> and our setup is still in flux.
297+
Please hassle pushcx if he hasn't filled in details by March 2021.
297298
Our domain name is registered with <a href="https://cridomains.rs/en">CRI Domains</a>, who donated our first year of registration.
298299
DNS is provided by <a href="https://dnsimple.com/">DNSimple</a> and
299300
we use <a href="https://www.tarsnap.com">Tarsnap</a> for backups, both of which pushcx pays for.
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
2020-12-03: We recently migrated the database and this feature hammers this db config, so it's unavailable until we can sort that out. Sorry for the hassle. - Peter
3+
</p>

0 commit comments

Comments
 (0)