Skip to content

Commit bed8e51

Browse files
authored
Merge branch 'main' into ojtjo3-codex/update-favicon-and-title-on-page-load
2 parents 647e44c + e808463 commit bed8e51

File tree

53 files changed

+778
-79
lines changed

Some content is hidden

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

53 files changed

+778
-79
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ 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
16+
# - ruby: '3.4.4'
17+
# rails: '7.2'
18+
# allowed_failure: true # ⚠️ allowed to fail
1919
- ruby: '3.4.4'
2020
rails: '8.0'
2121
allowed_failure: true # ⚠️ allowed to fail

AGENTS.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# AGENTS.md
22

3+
Instructions for GitHub Copilot and other automated contributors working in this repository.
4+
35
## Project
46
- Ruby: 3.4.4 (installed via rbenv in setup)
57
- Rails: 7.1
@@ -13,18 +15,17 @@
1315
- Databases:
1416
- development: `community_engine_development`
1517
- test: `community_engine_test`
16-
- Use `DATABASE_URL` to connect (overrides fallback host in database.yml).
18+
- Use `DATABASE_URL` to connect (overrides fallback host in `config/database.yml`).
1719

1820
## Commands
19-
- Run tests: `bin/ci`
21+
- **Tests:** `bin/ci`
2022
(Equivalent: `cd spec/dummy && bundle exec rspec`)
21-
- Lint: `bundle exec rubocop`
22-
- Security: `bundle exec brakeman -q -w2` and `bundle exec bundler-audit --update`
23+
- **Lint:** `bundle exec rubocop`
24+
- **Security:** `bundle exec brakeman -q -w2` and `bundle exec bundler-audit --update`
25+
- **Style:** `bin/codex_style_guard`
2326

2427
## Conventions
2528
- Make incremental changes with passing tests.
2629
- Avoid introducing new external services in tests; stub where possible.
27-
28-
## Code Style
29-
- Always run `bin/codex_style_guard` before proposing a patch.
30-
- If RuboCop reports offenses after autocorrect, update the changes until it passes.
30+
- If RuboCop reports offenses after autocorrect, update and rerun until clean.
31+
- Keep commit messages and PR descriptions concise and informative.

Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,19 +167,19 @@ GEM
167167
unf
168168
ast (2.4.3)
169169
aws-eventstream (1.4.0)
170-
aws-partitions (1.1139.0)
171-
aws-sdk-core (3.228.0)
170+
aws-partitions (1.1142.0)
171+
aws-sdk-core (3.229.0)
172172
aws-eventstream (~> 1, >= 1.3.0)
173173
aws-partitions (~> 1, >= 1.992.0)
174174
aws-sigv4 (~> 1.9)
175175
base64
176176
bigdecimal
177177
jmespath (~> 1, >= 1.6.1)
178178
logger
179-
aws-sdk-kms (1.109.0)
179+
aws-sdk-kms (1.110.0)
180180
aws-sdk-core (~> 3, >= 3.228.0)
181181
aws-sigv4 (~> 1.5)
182-
aws-sdk-s3 (1.195.0)
182+
aws-sdk-s3 (1.196.1)
183183
aws-sdk-core (~> 3, >= 3.228.0)
184184
aws-sdk-kms (~> 1)
185185
aws-sigv4 (~> 1.5)
@@ -658,7 +658,7 @@ GEM
658658
rswag-ui (2.16.0)
659659
actionpack (>= 5.2, < 8.1)
660660
railties (>= 5.2, < 8.1)
661-
rubocop (1.79.1)
661+
rubocop (1.79.2)
662662
json (~> 2.3)
663663
language_server-protocol (~> 3.17.0.2)
664664
lint_roller (~> 1.1.0)

app/controllers/better_together/messages_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def notify_participants(message)
3535
recipients = message.conversation.participants.where.not(id: message.sender_id)
3636

3737
# Pass the array of recipients to the notification
38-
BetterTogether::NewMessageNotifier.with(record: message).deliver_later(recipients)
38+
BetterTogether::NewMessageNotifier.with(record: message,
39+
conversation_id: message.conversation_id).deliver_later(recipients)
3940
end
4041

4142
def broadcast_to_recipients(message, recipients)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
module Metrics
5+
class SearchQueriesController < ApplicationController # rubocop:todo Style/Documentation
6+
def create
7+
query = params[:query]
8+
results_count = params[:results_count]
9+
locale = I18n.locale.to_s
10+
11+
if query.blank? || results_count.blank?
12+
render json: { error: I18n.t('metrics.search_queries.invalid_parameters') },
13+
status: :unprocessable_entity and return
14+
end
15+
16+
BetterTogether::Metrics::TrackSearchQueryJob.perform_later(query, results_count.to_i, locale)
17+
18+
render json: { success: true }, status: :ok
19+
end
20+
end
21+
end
22+
end

app/controllers/better_together/people_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def set_resource_instance
7575

7676
def person_params
7777
params.require(:person).permit(
78-
:name, :description, :profile_image, :slug, :locale,
78+
:name, :description, :profile_image, :slug, :locale, :notify_by_email,
7979
:profile_image, :cover_image, :remove_profile_image, :remove_cover_image,
8080
*resource_class.permitted_attributes
8181
)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
class PersonBlocksController < ApplicationController # rubocop:todo Style/Documentation
5+
before_action :set_person_block, only: :destroy
6+
after_action :verify_authorized
7+
8+
def index
9+
authorize PersonBlock
10+
@blocked_people = current_person.blocked_people
11+
end
12+
13+
def create
14+
@person_block = current_person.person_blocks.new(person_block_params)
15+
authorize @person_block
16+
17+
if @person_block.save
18+
redirect_to blocks_path, notice: 'Person was successfully blocked.'
19+
else
20+
redirect_to blocks_path, alert: @person_block.errors.full_messages.to_sentence
21+
end
22+
end
23+
24+
def destroy
25+
authorize @person_block
26+
@person_block.destroy
27+
redirect_to blocks_path, notice: 'Person was successfully unblocked.'
28+
end
29+
30+
private
31+
32+
def current_person
33+
current_user.person
34+
end
35+
36+
def set_person_block
37+
@person_block = current_person.person_blocks.find(params[:id])
38+
end
39+
40+
def person_block_params
41+
params.require(:person_block).permit(:blocked_id)
42+
end
43+
end
44+
end
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
# CRUD for BetterTogether::Post
5+
class PostsController < FriendlyResourceController
6+
protected
7+
8+
def resource_class
9+
::BetterTogether::Post
10+
end
11+
12+
def resource_params
13+
super.tap do |attrs|
14+
attrs[:creator_id] = helpers.current_person&.id if action_name == 'create'
15+
end
16+
end
17+
end
18+
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
class ReportsController < ApplicationController # rubocop:todo Style/Documentation
5+
after_action :verify_authorized
6+
7+
def create
8+
@report = current_person.reports_made.new(report_params)
9+
authorize @report
10+
11+
if @report.save
12+
redirect_back fallback_location: root_path, notice: 'Report was successfully submitted.'
13+
else
14+
redirect_back fallback_location: root_path, alert: @report.errors.full_messages.to_sentence
15+
end
16+
end
17+
18+
private
19+
20+
def current_person
21+
current_user.person
22+
end
23+
24+
def report_params
25+
params.require(:report).permit(:reportable_id, :reportable_type, :reason)
26+
end
27+
end
28+
end

app/controllers/better_together/search_controller.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ def search # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
1818
o['text']
1919
end
2020
end.flatten
21+
22+
BetterTogether::Metrics::TrackSearchQueryJob.perform_later(
23+
@query,
24+
search_results.length,
25+
I18n.locale.to_s
26+
)
2127
end
2228

2329
# Use Kaminari for pagination

0 commit comments

Comments
 (0)