Skip to content

Commit 9c6efd1

Browse files
authored
Merge branch 'master' into dependabot/bundler/stripe-5.42.0
2 parents 4411a2c + 61f816f commit 9c6efd1

20 files changed

+151
-27
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ gem 'thredded', git: 'https://github.com/indentlabs/thredded.git', branch: 'feat
7878
# gem 'thredded', git: 'https://github.com/sudara/thredded', branch: 'master'
7979
gem 'rails-ujs'
8080
gem 'language_filter'
81+
gem 'discordrb'
8182

8283
# Smarts
8384
gem 'word_count_analyzer'

Gemfile.lock

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ GEM
117117
autoprefixer-rails (10.3.3.0)
118118
execjs (~> 2)
119119
aws-eventstream (1.2.0)
120-
aws-partitions (1.503.0)
120+
aws-partitions (1.543.0)
121121
aws-sdk (3.1.0)
122122
aws-sdk-resources (~> 3)
123123
aws-sdk-accessanalyzer (1.23.0)
@@ -315,9 +315,9 @@ GEM
315315
aws-sdk-connectparticipant (1.14.0)
316316
aws-sdk-core (~> 3, >= 3.120.0)
317317
aws-sigv4 (~> 1.1)
318-
aws-sdk-core (3.121.0)
318+
aws-sdk-core (3.125.0)
319319
aws-eventstream (~> 1, >= 1.0.2)
320-
aws-partitions (~> 1, >= 1.239.0)
320+
aws-partitions (~> 1, >= 1.525.0)
321321
aws-sigv4 (~> 1.1)
322322
jmespath (~> 1.0)
323323
aws-sdk-costandusagereportservice (1.34.0)
@@ -578,8 +578,8 @@ GEM
578578
aws-sdk-kinesisvideosignalingchannels (1.13.0)
579579
aws-sdk-core (~> 3, >= 3.120.0)
580580
aws-sigv4 (~> 1.1)
581-
aws-sdk-kms (1.48.0)
582-
aws-sdk-core (~> 3, >= 3.120.0)
581+
aws-sdk-kms (1.53.0)
582+
aws-sdk-core (~> 3, >= 3.125.0)
583583
aws-sigv4 (~> 1.1)
584584
aws-sdk-lakeformation (1.17.0)
585585
aws-sdk-core (~> 3, >= 3.120.0)
@@ -1086,8 +1086,8 @@ GEM
10861086
aws-sdk-route53resolver (1.30.0)
10871087
aws-sdk-core (~> 3, >= 3.120.0)
10881088
aws-sigv4 (~> 1.1)
1089-
aws-sdk-s3 (1.103.0)
1090-
aws-sdk-core (~> 3, >= 3.120.0)
1089+
aws-sdk-s3 (1.110.0)
1090+
aws-sdk-core (~> 3, >= 3.125.0)
10911091
aws-sdk-kms (~> 1)
10921092
aws-sigv4 (~> 1.4)
10931093
aws-sdk-s3control (1.40.0)
@@ -1281,7 +1281,7 @@ GEM
12811281
concurrent-ruby (1.1.9)
12821282
connection_pool (2.2.5)
12831283
crass (1.0.6)
1284-
csv (3.2.0)
1284+
csv (3.2.2)
12851285
d3-rails (5.9.2)
12861286
railties (>= 3.1)
12871287
database_cleaner (2.0.1)
@@ -1301,11 +1301,20 @@ GEM
13011301
railties (>= 4.1.0)
13021302
responders
13031303
warden (~> 1.2.3)
1304+
discordrb (3.4.0)
1305+
discordrb-webhooks (~> 3.3.0)
1306+
ffi (>= 1.9.24)
1307+
opus-ruby
1308+
rest-client (>= 2.0.0)
1309+
websocket-client-simple (>= 0.3.0)
1310+
discordrb-webhooks (3.3.0)
1311+
rest-client (>= 2.1.0.rc1)
13041312
docile (1.1.5)
13051313
domain_name (0.5.20190701)
13061314
unf (>= 0.0.5, < 1.0.0)
13071315
engtagger (0.2.1)
13081316
erubi (1.10.0)
1317+
event_emitter (0.2.6)
13091318
eventmachine (1.2.7)
13101319
execjs (2.8.1)
13111320
faraday (0.17.4)
@@ -1339,6 +1348,7 @@ GEM
13391348
http-cookie (~> 1.0)
13401349
http-form_data (~> 2.2)
13411350
http-parser (~> 1.2.0)
1351+
http-accept (1.7.0)
13421352
http-cookie (1.0.4)
13431353
domain_name (~> 0.5)
13441354
http-form_data (2.3.0)
@@ -1423,6 +1433,7 @@ GEM
14231433
multipart-post (2.1.1)
14241434
mustache (1.1.1)
14251435
nested_form (0.3.2)
1436+
netrc (0.11.0)
14261437
newrelic_rpm (8.0.0)
14271438
nio4r (2.5.8)
14281439
nokogiri (1.12.5)
@@ -1435,6 +1446,8 @@ GEM
14351446
mustache
14361447
nokogiri (~> 1.7)
14371448
sanitize
1449+
opus-ruby (1.0.1)
1450+
ffi
14381451
orm_adapter (0.5.0)
14391452
paperclip (6.1.0)
14401453
activemodel (>= 4.2.0)
@@ -1533,9 +1546,14 @@ GEM
15331546
responders (3.0.1)
15341547
actionpack (>= 5.0)
15351548
railties (>= 5.0)
1549+
rest-client (2.1.0)
1550+
http-accept (>= 1.7.0, < 2.0)
1551+
http-cookie (>= 1.0.2, < 2.0)
1552+
mime-types (>= 1.16, < 4.0)
1553+
netrc (~> 0.8)
15361554
rexml (3.2.5)
15371555
rinku (2.0.6)
1538-
rmagick (4.2.2)
1556+
rmagick (4.2.4)
15391557
ruby-vips (2.0.17)
15401558
ffi (~> 1.9)
15411559
rubyzip (2.0.0)
@@ -1614,6 +1632,10 @@ GEM
16141632
rack-proxy (>= 0.6.1)
16151633
railties (>= 5.2)
16161634
semantic_range (>= 2.3.0)
1635+
websocket (1.2.9)
1636+
websocket-client-simple (0.3.0)
1637+
event_emitter
1638+
websocket
16171639
websocket-driver (0.7.5)
16181640
websocket-extensions (>= 0.1.0)
16191641
websocket-extensions (0.1.5)
@@ -1644,6 +1666,7 @@ DEPENDENCIES
16441666
database_cleaner
16451667
dateslices
16461668
devise
1669+
discordrb
16471670
engtagger
16481671
filesize
16491672
flamegraph

app/controllers/admin_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ def reported_shares
5959
def churn
6060
end
6161

62+
def notifications
63+
@clicked_notifications = Notification.where.not(viewed_at: nil)
64+
@notifications = Notification.all.order(:reference_code)
65+
66+
@codes = Notification.distinct.order('reference_code').pluck(:reference_code)
67+
end
68+
6269
def hate
6370
@posts = Thredded::PrivatePost.order('id DESC').limit(params.fetch(:limit, 500)).includes(:postable)
6471
@list = params[:matchlist]

app/controllers/contributors_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def destroy
1313
icon: Universe.icon,
1414
icon_color: Universe.color,
1515
happened_at: DateTime.current,
16-
passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe)
16+
passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe),
17+
reference_code: 'contributor-removed'
1718
) if user.present?
1819

1920
# Create a notification letting the universe owner know
@@ -22,7 +23,8 @@ def destroy
2223
icon: Universe.icon,
2324
icon_color: Universe.color,
2425
happened_at: DateTime.current,
25-
passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe)
26+
passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe),
27+
reference_code: 'contributor-left'
2628
) if user.present?
2729

2830
#todo send "you've been removed as a contributor" email

app/controllers/data_controller.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@ def review_year
1818

1919
@created_content = {}
2020
@total_created_non_universe_content = 0
21+
@words_written = 0
2122
Rails.application.config.content_types[:all].each do |klass|
2223
@created_content[klass.name] = klass.where(user_id: current_user.id)
2324
.where('created_at > ?', comparable_year.beginning_of_year)
2425
.where('created_at < ?', comparable_year.end_of_year)
2526
.order('created_at ASC')
2627

28+
@words_written += WordCountUpdate.where(
29+
entity_type: klass.name,
30+
entity_id: @created_content[klass.name].map(&:id)
31+
).sum(:word_count)
32+
2733
if klass.name != 'Universe'
2834
@total_created_non_universe_content += @created_content[klass.name].count
2935
end
@@ -34,6 +40,8 @@ def review_year
3440
.where('created_at < ?', comparable_year.end_of_year)
3541
.order('created_at ASC')
3642

43+
@words_written += @created_content['Document'].sum(:cached_word_count)
44+
3745
earliest_page_date = DateTime.current
3846
@earliest_page = nil
3947
@created_content.each do |content_type, list|
@@ -80,7 +88,6 @@ def review_year
8088

8189
@published_collections = PageCollection.where(id: @created_content['PageCollectionSubmission'].pluck(:page_collection_id) - @created_content['PageCollection'].pluck(:id))
8290
@publish_rate = @created_content['PageCollectionSubmission'].select { |s| s.accepted_at.present? && !@created_content['PageCollection'].pluck(:id).include?(s.page_collection_id) }.count.to_f / @created_content['PageCollectionSubmission'].count
83-
8491
end
8592

8693
def archive

app/controllers/page_collection_submissions_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def approve
6868
icon: PageCollection.icon,
6969
icon_color: PageCollection.color,
7070
happened_at: DateTime.current,
71-
passthrough_link: Rails.application.routes.url_helpers.page_collection_path(@page_collection_submission.page_collection)
71+
passthrough_link: Rails.application.routes.url_helpers.page_collection_path(@page_collection_submission.page_collection),
72+
reference_code: 'approved-in-collection'
7273
)
7374

7475
redirect_to(page_collection_pending_submissions_path(@page_collection_submission.page_collection), notice: "Submission approved!")

app/controllers/registrations_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def add_account
8888
icon: Universe.icon,
8989
icon_color: Universe.color,
9090
happened_at: DateTime.current,
91-
passthrough_link: Rails.application.routes.url_helpers.universe_path(contributorship.universe)
91+
passthrough_link: Rails.application.routes.url_helpers.universe_path(contributorship.universe),
92+
reference_code: 'contributor-added'
9293
)
9394
end
9495
end

app/controllers/subscriptions_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ def redeem_code
224224
icon: 'star',
225225
icon_color: 'text-darken-3 yellow',
226226
happened_at: DateTime.current,
227-
passthrough_link: Rails.application.routes.url_helpers.customization_content_types_path
227+
passthrough_link: Rails.application.routes.url_helpers.customization_content_types_path,
228+
reference_code: 'premium-activation'
228229
)
229230

230231
redirect_back(fallback_location: subscription_path, notice: "Promo code successfully activated!")

app/controllers/user_followings_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def create
3434
icon: User.icon,
3535
icon_color: User.color,
3636
happened_at: DateTime.current,
37-
passthrough_link: Rails.application.routes.url_helpers.user_path(@user_following.user)
37+
passthrough_link: Rails.application.routes.url_helpers.user_path(@user_following.user),
38+
reference_code: 'followed-by-user'
3839
)
3940

4041
redirect_to @user_following.followed_user, notice: "You're now following #{@user_following.followed_user.name.presence || 'this user'}"

app/jobs/content_page_share_notification_job.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def perform(*args)
2020
passthrough_link: Rails.application.routes.url_helpers.user_content_page_share_path(
2121
id: comment.content_page_share.id,
2222
user_id: comment.content_page_share.user_id
23-
)
23+
),
24+
reference_code: 'comment-on-shared-page'
2425
)
2526
end
2627
end

0 commit comments

Comments
 (0)