Skip to content

Commit cc3616c

Browse files
authored
Merge branch 'main' into feature/message-opt-in
Signed-off-by: Robert Smith <[email protected]>
2 parents 7fcdec6 + 03de690 commit cc3616c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+616
-217
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ jobs:
1313
- ruby: '3.4.4'
1414
rails: '7.1.5.1'
1515
allowed_failure: false # ✅ required
16-
# - ruby: '3.4.4'
17-
# rails: '7.2'
18-
# allowed_failure: true # ⚠️ allowed to fail
1916
- ruby: '3.4.4'
20-
rails: '8.0'
17+
rails: '7.2.2.1'
18+
allowed_failure: false # ⚠️ allowed to fail
19+
- ruby: '3.4.4'
20+
rails: '8.0.2'
2121
allowed_failure: true # ⚠️ allowed to fail
2222

2323
env:

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ gem 'redis', '~> 5.4'
3535
gem 'rswag'
3636

3737
# Sidekiq for background processing
38-
gem 'sidekiq', '~> 8.0.6'
38+
gem 'sidekiq', '~> 8.0.7'
3939

4040
# Error and performance monitoring with Sentry
4141
gem 'sentry-rails'

Gemfile.lock

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ GEM
314314
railties (>= 6.1.0)
315315
faker (3.5.2)
316316
i18n (>= 1.8.11, < 2)
317-
faraday (2.13.0)
317+
faraday (2.13.4)
318318
faraday-net_http (>= 2.0, < 3.5)
319319
json
320320
logger
321-
faraday-multipart (1.1.0)
321+
faraday-multipart (1.1.1)
322322
multipart-post (~> 2.0)
323-
faraday-net_http (3.4.0)
323+
faraday-net_http (3.4.1)
324324
net-http (>= 0.5.0)
325325
ffi (1.17.2-aarch64-linux-gnu)
326326
ffi (1.17.2-arm64-darwin)
@@ -595,7 +595,7 @@ GEM
595595
psych (>= 4.0.0)
596596
redis (5.4.1)
597597
redis-client (>= 0.22.0)
598-
redis-client (0.25.1)
598+
redis-client (0.25.2)
599599
connection_pool
600600
reform (2.6.2)
601601
disposable (>= 0.5.0, < 1.0.0)
@@ -604,7 +604,7 @@ GEM
604604
reform-rails (0.2.6)
605605
activemodel (>= 5.0)
606606
reform (>= 2.3.1, < 3.0.0)
607-
regexp_parser (2.11.0)
607+
regexp_parser (2.11.1)
608608
reline (0.6.2)
609609
io-console (~> 0.5)
610610
representable (3.2.0)
@@ -678,7 +678,7 @@ GEM
678678
rubocop-factory_bot (2.27.1)
679679
lint_roller (~> 1.1)
680680
rubocop (~> 1.72, >= 1.72.1)
681-
rubocop-rails (2.32.0)
681+
rubocop-rails (2.33.0)
682682
activesupport (>= 4.2.0)
683683
lint_roller (~> 1.1)
684684
rack (>= 1.1)
@@ -691,7 +691,7 @@ GEM
691691
lint_roller (~> 1.1)
692692
rubocop (~> 1.72, >= 1.72.1)
693693
rubocop-rspec (~> 3.5)
694-
ruby-openai (8.1.0)
694+
ruby-openai (8.2.0)
695695
event_stream_parser (>= 0.3.0, < 2.0.0)
696696
faraday (>= 1)
697697
faraday-multipart (>= 1)
@@ -727,7 +727,7 @@ GEM
727727
activesupport (>= 3)
728728
shoulda-matchers (6.5.0)
729729
activesupport (>= 5.2.0)
730-
sidekiq (8.0.6)
730+
sidekiq (8.0.7)
731731
connection_pool (>= 2.5.0)
732732
json (>= 2.9.0)
733733
logger (>= 1.6.2)
@@ -863,7 +863,7 @@ DEPENDENCIES
863863
sentry-ruby
864864
shoulda-callback-matchers
865865
shoulda-matchers
866-
sidekiq (~> 8.0.6)
866+
sidekiq (~> 8.0.7)
867867
simplecov
868868
spring
869869
spring-watcher-listen (~> 2.1.0)

app/controllers/better_together/conversations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def show # rubocop:todo Metrics/MethodLength, Metrics/AbcSize
4747
# Move this to separate action/bg process only activated when the messages are actually read.
4848
events = BetterTogether::NewMessageNotifier.where(record_id: @messages.pluck(:id)).select(:id)
4949

50-
notifications = helpers.current_person.notifications.where(event_id: events.pluck(:id))
50+
notifications = helpers.current_person.notifications.unread.where(event_id: events.pluck(:id))
5151
notifications.update_all(read_at: Time.current)
5252
end
5353

app/controllers/better_together/metrics/link_click_reports_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
4141

4242
respond_to do |format| # rubocop:todo Metrics/BlockLength
4343
if @link_click_report.persisted?
44-
flash[:notice] = 'Report was successfully created.'
44+
flash[:notice] = t('flash.generic.created', resource: t('resources.report'))
4545
format.html { redirect_to metrics_link_click_reports_path, notice: flash[:notice] }
4646
format.turbo_stream do
4747
render turbo_stream: [
@@ -55,7 +55,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5555
]
5656
end
5757
else
58-
flash.now[:alert] = 'Error creating report.'
58+
flash.now[:alert] = t('flash.generic.error_create', resource: t('resources.report'))
5959
format.html { render :new, status: :unprocessable_entity }
6060
format.turbo_stream do
6161
render turbo_stream: [

app/controllers/better_together/metrics/page_view_reports_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
3939

4040
respond_to do |format| # rubocop:todo Metrics/BlockLength
4141
if @page_view_report.persisted?
42-
flash[:notice] = 'Report was successfully created.'
42+
flash[:notice] = t('flash.generic.created', resource: t('resources.report'))
4343
format.html { redirect_to metrics_page_view_reports_path, notice: flash[:notice] }
4444
format.turbo_stream do
4545
render turbo_stream: [
@@ -55,7 +55,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5555
]
5656
end
5757
else
58-
flash.now[:alert] = 'Error creating report.'
58+
flash.now[:alert] = t('flash.generic.error_create', resource: t('resources.report'))
5959
format.html { render :new, status: :unprocessable_entity }
6060
format.turbo_stream do
6161
render turbo_stream: [

app/controllers/better_together/notifications_controller.rb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ def index
1111
end
1212

1313
# TODO: Make a Stimulus controller to dispatch this action async when messages are viewed
14-
# rubocop:todo Metrics/MethodLength
1514
def mark_as_read # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
1615
if params[:id]
17-
@notification = helpers.current_person.notifications.find(params[:id])
18-
@notification.update(read_at: Time.current)
16+
mark_notification_as_read(params[:id])
17+
elsif params[:record_id]
18+
mark_record_notification_as_read(params[:record_id])
1919
else
2020
helpers.current_person.notifications.unread.update_all(read_at: Time.current)
2121
end
@@ -35,6 +35,17 @@ def mark_as_read # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
3535
end
3636
end
3737
end
38-
# rubocop:enable Metrics/MethodLength
38+
39+
def mark_notification_as_read(id)
40+
@notification = helpers.current_person.notifications.find(id)
41+
@notification.update(read_at: Time.current)
42+
end
43+
44+
def mark_record_notification_as_read(id)
45+
@notifications = helpers.current_person.notifications.unread.includes(
46+
:event
47+
).references(:event).where(event: { record_id: id })
48+
@notifications.update_all(read_at: Time.current)
49+
end
3950
end
4051
end

app/controllers/better_together/pages_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create
3737
authorize @page
3838

3939
if @page.save
40-
redirect_to edit_page_path(@page), notice: 'Page was successfully created.'
40+
redirect_to edit_page_path(@page), notice: t('flash.generic.created', resource: t('resources.page'))
4141
else
4242
render :new
4343
end
@@ -53,11 +53,11 @@ def update # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5353
respond_to do |format|
5454
if @page.update(page_params)
5555
format.html do
56-
flash[:notice] = 'Page was successfully updated.'
57-
redirect_to edit_page_path(@page), notice: 'Page was successfully updated.'
56+
flash[:notice] = t('flash.generic.updated', resource: t('resources.page'))
57+
redirect_to edit_page_path(@page), notice: t('flash.generic.updated', resource: t('resources.page'))
5858
end
5959
format.turbo_stream do
60-
flash.now[:notice] = 'Page was successfully updated.'
60+
flash.now[:notice] = t('flash.generic.updated', resource: t('resources.page'))
6161
render turbo_stream: [
6262
turbo_stream.replace(helpers.dom_id(@page, 'form'), partial: 'form',
6363
locals: { page: @page }),
@@ -77,7 +77,7 @@ def update # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
7777
def destroy
7878
authorize @page
7979
@page.destroy
80-
redirect_to pages_url, notice: 'Page was successfully destroyed.'
80+
redirect_to pages_url, notice: t('flash.generic.destroyed', resource: t('resources.page'))
8181
end
8282

8383
protected

app/controllers/better_together/person_community_memberships_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
1313

1414
respond_to do |format|
1515
if @person_community_membership.save
16-
flash[:notice] = 'Member was successfully added.'
16+
flash[:notice] = t('flash.generic.created', resource: t('resources.member'))
1717
format.html { redirect_to @community, notice: flash[:notice] }
1818
format.turbo_stream do
1919
render turbo_stream: [
@@ -26,7 +26,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
2626
]
2727
end
2828
else
29-
flash.now[:alert] = 'Error adding member.'
29+
flash.now[:alert] = t('flash.generic.error_create', resource: t('resources.member'))
3030
format.html { redirect_to @community, alert: @person_community_membership.errors.full_messages.to_sentence }
3131
format.turbo_stream do
3232
render turbo_stream: [
@@ -44,7 +44,7 @@ def destroy # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
4444
authorize @person_community_membership
4545

4646
if @person_community_membership.destroy
47-
flash.now[:notice] = 'Member was successfully removed.'
47+
flash.now[:notice] = t('flash.generic.removed', resource: t('resources.member'))
4848
respond_to do |format|
4949
format.html { redirect_to @community }
5050
format.turbo_stream do
@@ -56,7 +56,7 @@ def destroy # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5656
end
5757
end
5858
else
59-
flash.now[:error] = 'Failed to remove member.'
59+
flash.now[:error] = t('flash.generic.error_remove', resource: t('resources.member'))
6060
respond_to do |format|
6161
format.html { redirect_to @community, alert: flash.now[:error] }
6262
format.turbo_stream do

app/controllers/better_together/platform_invitations_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
2121

2222
respond_to do |format|
2323
if @platform_invitation.save
24-
flash[:notice] = 'Invitation was successfully created.'
24+
flash[:notice] = t('flash.generic.created', resource: t('resources.invitation'))
2525
format.html { redirect_to @platform, notice: flash[:notice] }
2626
format.turbo_stream do
2727
render turbo_stream: [
@@ -34,7 +34,7 @@ def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
3434
]
3535
end
3636
else
37-
flash.now[:alert] = 'Error creating platform_invitation.'
37+
flash.now[:alert] = t('flash.generic.error_create', resource: t('resources.invitation'))
3838
format.html { redirect_to @platform, alert: @platform_invitation.errors.full_messages.to_sentence }
3939
format.turbo_stream do
4040
render turbo_stream: [
@@ -52,7 +52,7 @@ def destroy # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
5252
authorize @platform_invitation
5353

5454
if @platform_invitation.destroy
55-
flash.now[:notice] = 'Invitation was successfully removed.'
55+
flash.now[:notice] = t('flash.generic.removed', resource: t('resources.invitation'))
5656
respond_to do |format|
5757
format.html { redirect_to @platform }
5858
format.turbo_stream do
@@ -64,7 +64,7 @@ def destroy # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
6464
end
6565
end
6666
else
67-
flash.now[:error] = 'Failed to remove platform_invitation.'
67+
flash.now[:error] = t('flash.generic.error_remove', resource: t('resources.invitation'))
6868
respond_to do |format|
6969
format.html { redirect_to @platform, alert: flash.now[:error] }
7070
format.turbo_stream do
@@ -82,7 +82,7 @@ def resend # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
8282
authorize @platform_invitation
8383

8484
BetterTogether::PlatformInvitationMailerJob.perform_later(@platform_invitation.id)
85-
flash[:notice] = 'Invitation email has been queued for sending.'
85+
flash[:notice] = t('flash.generic.queued', resource: t('resources.invitation_email'))
8686

8787
respond_to do |format|
8888
format.html { redirect_to @platform, notice: flash[:notice] }

0 commit comments

Comments
 (0)