Skip to content

Commit 07699fe

Browse files
authored
Merge branch 'main' into codex/add-block-and-report-system
Signed-off-by: Robert Smith <[email protected]>
2 parents 8e864b7 + d090194 commit 07699fe

File tree

39 files changed

+463
-93
lines changed

39 files changed

+463
-93
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: 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

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
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
module Metrics
5+
class TrackSearchQueryJob < MetricsJob # rubocop:todo Style/Documentation
6+
def perform(query, results_count, locale)
7+
BetterTogether::Metrics::SearchQuery.create!(
8+
query: query,
9+
results_count: results_count,
10+
locale: locale,
11+
searched_at: Time.current
12+
)
13+
end
14+
end
15+
end
16+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
module Metrics
5+
class SearchQuery < ApplicationRecord # rubocop:todo Style/Documentation
6+
validates :query, presence: true
7+
validates :results_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
8+
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
9+
validates :searched_at, presence: true
10+
end
11+
end
12+
end

0 commit comments

Comments
 (0)