Skip to content
Draft
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d4828f5
WIP: test devise github oauth integration
rsmithlal Jun 11, 2024
7cc86e2
Update omniauth routes
rsmithlal Jun 11, 2024
fb4885b
update github oauth action
rsmithlal Jun 11, 2024
68ea4bf
WIP: github oauth
rsmithlal Jun 12, 2024
72a0030
WIP: github oauth use correct user class reference
rsmithlal Jun 12, 2024
a1a9b0a
WIP: github oauth use correct user method to process auth env data
rsmithlal Jun 12, 2024
042249f
Only show oauth login links if param oauth_login=true
rsmithlal Jun 12, 2024
b7f8af6
adjustment for frozen arrays
rsmithlal Jun 12, 2024
ed709f5
WIP: initial foundation to integrate GitHub API using Octokit gem
rsmithlal Jun 12, 2024
8f2f392
rubocop fixes
rsmithlal Jun 12, 2024
163baea
WIP: Initial scaffolding of PersonPlatformIntegrations
rsmithlal Jun 12, 2024
56253fe
WIP: Flesh out PersonPlatformIntegration
rsmithlal Jun 12, 2024
d0afb15
rubocop fixes
rsmithlal Jun 12, 2024
1ec7f73
rubocop fixes
rsmithlal Jun 12, 2024
8bc4afa
WIP: attempt to correctly sign_in the user after oauth
rsmithlal Jun 16, 2024
3bdbd69
Rubocop fixes
rsmithlal Jun 16, 2024
72272b1
Merge branch 'main' into feature/github-integration
rsmithlal Jul 20, 2024
ba905b6
Merge branch 'main' into feature/github-integration
rsmithlal Mar 1, 2025
e9caf22
Update Gemfile.lock
rsmithlal Mar 1, 2025
4292d62
Improved references to ::BetterTogether modules
rsmithlal Feb 28, 2025
d2f638c
Improved success rate for generating page view urls
rsmithlal Feb 28, 2025
4ac9afb
Add BetterTogether::Metrics::PageViewReport
rsmithlal Feb 28, 2025
81bfbf2
Improve metrics reporting page with tabbed layout and add page view r…
rsmithlal Feb 28, 2025
ee4ff34
Add BetterTogether::Metrics::Pageable concern
rsmithlal Feb 28, 2025
0cf31b7
Default locale to current_person's locale if not in params and person…
rsmithlal Feb 28, 2025
93149c0
Rubocop fixes
rsmithlal Feb 28, 2025
fe025da
Address misaligned locale count and url csv headers
rsmithlal Feb 28, 2025
12a9d28
Adjust heading level of new page view report header
rsmithlal Feb 28, 2025
df59892
Update rubyonrails.yml
rsmithlal Feb 28, 2025
dfb4dd0
rubocop:disable Style/CombinableLoops for page view report csv headers
rsmithlal Feb 28, 2025
1254186
Relocate model concerns to models/concerns directory
rsmithlal Feb 28, 2025
04ea923
Rename Metrics::Pageable concern to Viewable
rsmithlal Feb 28, 2025
850edda
Add LinkClickReport and new tabbed section in link click report metri…
rsmithlal Feb 28, 2025
4af60c2
Render conversations inside of communicator view
rsmithlal Feb 28, 2025
d9a4a1a
Re-implement flexible invitation model
rsmithlal Feb 28, 2025
275fd16
Re-implement Post model
rsmithlal Feb 28, 2025
a773b3b
Re-implement Authorship system
rsmithlal Feb 28, 2025
e11d25a
Adjust page migration to use the bt_privacy helper
rsmithlal Feb 28, 2025
d12eee2
Make Community Searchable
rsmithlal Feb 28, 2025
25c4405
Rubocop fixes
rsmithlal Feb 28, 2025
adbd0ea
Allow navigation items to have fallback urls that include their ident…
rsmithlal Feb 28, 2025
d3712d5
Improve structure of importmap channels
rsmithlal Mar 1, 2025
ce61d54
Add initial feature spec for setup wizard. Coverage 28.87%
rsmithlal Mar 1, 2025
bab1aeb
Disable html content for posts for now
rsmithlal Mar 1, 2025
4872016
Set post slugged after slugged attribute is defined
rsmithlal Mar 1, 2025
5bebdd0
Rubocop fixes
rsmithlal Mar 1, 2025
09eda33
Merge branch 'dev' into feature/github-integration
rsmithlal Mar 1, 2025
ba02c2f
adjust omniauth route definitions
rsmithlal Mar 1, 2025
1598daf
Rubocop fixes
rsmithlal Mar 1, 2025
e6f76c2
Potential fix for code scanning alert no. 7: CSRF protection weakened…
rsmithlal Mar 1, 2025
2c28bd7
Rubocop fixes
rsmithlal Mar 1, 2025
96f0560
Merge branch 'dev' into feature/github-integration
rsmithlal Mar 1, 2025
71a142d
Merge branch 'dev' into feature/github-integration
rsmithlal Mar 1, 2025
6324d4e
Build(deps): Bump active_storage_validations from 1.4.0 to 2.0.2
dependabot[bot] Feb 3, 2025
4afdb1f
Build(deps): Bump redis from 5.3.0 to 5.4.0
dependabot[bot] Feb 21, 2025
b61e6b6
Build(deps): Bump aws-sdk-s3 from 1.181.0 to 1.182.0
dependabot[bot] Feb 20, 2025
df2125c
Build(deps): Bump ruby-openai from 7.3.1 to 7.4.0
dependabot[bot] Feb 20, 2025
ba84c40
Build(deps-dev): Bump rubocop from 1.72.2 to 1.73.0
dependabot[bot] Feb 27, 2025
d0ff490
Add ActsAsTenant to gemspec and Gemfile.lock
rsmithlal Mar 4, 2025
fdc0f66
Remove unlisted as an option for privacy
rsmithlal Mar 4, 2025
728680a
No longer excluding db schema and migrations from string literal rubo…
rsmithlal Mar 4, 2025
8700a1b
Improve the SetupWizard platform details page
rsmithlal Mar 4, 2025
4add9dd
Move time zone control into a stimulus controller
rsmithlal Mar 5, 2025
d063df6
Move language translation keys under better_together namespace
rsmithlal Mar 5, 2025
590b59a
Customize default theme colours
rsmithlal Mar 5, 2025
4f616f6
Allow viewing default informational and promo pages without a host pl…
rsmithlal Mar 5, 2025
20d1abc
Improve platform setup page copywriting
rsmithlal Mar 5, 2025
7170747
Add BetterTogether::Seed
rsmithlal Mar 5, 2025
ea3b6df
refactor admin_creation setup wizard step to use same style as platfo…
rsmithlal Mar 5, 2025
b7c0c68
Add custom seed data config for BetterTogether::Wizard
rsmithlal Mar 5, 2025
8ac0493
Merge branch 'dev' into feature/github-integration
rsmithlal Mar 7, 2025
eb7d6f9
Merge branch 'dev' into feature/github-integration
rsmithlal Mar 7, 2025
b7ef209
Merge branch 'main' into feature/github-integration
rsmithlal Jun 28, 2025
61181ef
Merge branch 'main' into feature/github-integration
rsmithlal Jul 5, 2025
6a7b670
Merge branch 'main' into feature/github-integration
rsmithlal Aug 7, 2025
6bdb807
Merge branch 'main' into feature/github-integration
rsmithlal Aug 24, 2025
e623c52
Rubocop fixes
rsmithlal Aug 24, 2025
0e1d92a
Rubocop fixes
rsmithlal Aug 24, 2025
10d44f0
Rubocop fixes
rsmithlal Aug 24, 2025
81bd298
Refactor destroy? method placement in PersonBlockPolicy
rsmithlal Aug 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ AllCops:
Exclude:
- 'bin/*'
- 'node_modules/**/*'
- 'spec/dummy/db/schema.rb'
# - 'spec/dummy/db/schema.rb'
- 'vendor/**/*'
NewCops: enable
Style/StringLiterals:
Exclude:
- 'db/migrate/*'
# Style/StringLiterals:
# Exclude:
# - 'db/migrate/*'
39 changes: 39 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ PATH
active_storage_validations
activerecord-import
activerecord-postgis-adapter
acts_as_tenant
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

bootstrap (~> 5.3.2)
dartsass-sprockets (~> 3.1)
devise
Expand All @@ -46,6 +47,10 @@ PATH
mobility (>= 1.0.1, < 2.0)
mobility-actiontext (~> 1.1)
noticed
octokit
omniauth
omniauth-github (~> 2.0.0)
omniauth-rails_csrf_protection
premailer-rails
public_activity
pundit (>= 2.1, < 2.6)
Expand Down Expand Up @@ -158,6 +163,8 @@ GEM
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0)
acts_as_tenant (1.0.1)
rails (>= 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
asset_sync (2.19.2)
Expand Down Expand Up @@ -459,6 +466,8 @@ GEM
mobility (~> 1.2)
msgpack (1.8.0)
multi_json (1.15.0)
multi_xml (0.7.1)
bigdecimal (~> 3.1)
multipart-post (2.4.1)
mutex_m (0.3.0)
net-http (0.6.0)
Expand All @@ -477,6 +486,29 @@ GEM
racc (~> 1.4)
noticed (2.7.1)
rails (>= 6.1.0)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
multi_xml (~> 0.5)
rack (>= 1.2, < 4)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
octokit (9.1.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 2.2.3)
rack-protection
omniauth-github (2.0.1)
omniauth (~> 2.0)
omniauth-oauth2 (~> 1.8)
omniauth-oauth2 (1.8.0)
oauth2 (>= 1.4, < 3)
omniauth (~> 2.0)
omniauth-rails_csrf_protection (1.0.2)
actionpack (>= 4.2)
omniauth (~> 2.0)
optimist (3.2.1)
orm_adapter (0.5.0)
parallel (1.27.0)
Expand Down Expand Up @@ -691,6 +723,9 @@ GEM
ffi (~> 1.9)
sassc-embedded (1.80.4)
sass-embedded (~> 1.80)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
securerandom (0.4.1)
selenium-webdriver (4.34.0)
base64 (~> 0.2)
Expand Down Expand Up @@ -722,6 +757,9 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
spring (4.3.0)
spring-watcher-listen (2.1.0)
listen (>= 2.7, < 4.0)
Expand Down Expand Up @@ -766,6 +804,7 @@ GEM
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
version_gem (1.1.4)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
Expand Down
21 changes: 21 additions & 0 deletions app/assets/stylesheets/better_together/theme.scss
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed

Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
// New to NL colour palette
$blue-1: #004BA8;
$blue-2: #3E78B2;
$beige: #EAF0CE;
$teal: #5a8f9b;
$beige-light: lighten($beige, 10%);
$green-2: #70A288;
$green-1: #42b983; // variant

// Override the color variables in the host application
$primary: $green-1; /* Change to a different blue */
$secondary: $green-2; /* Change to a different green */
$success: $green-2;
$info: $green-1;
$warning: #C9B947;
$danger: #BF4A47;
$text-opposite-theme-color: #222; /* Darker text */
$background-opposite-theme-color: #f0f0f0; /* Lighter background */
$light-background-text-color: #222;
$dark-background-text-color: #f0f0f0;

@import "bootstrap/functions";
@import "bootstrap/mixins";
@import "bootstrap/variables";
Expand Down
64 changes: 64 additions & 0 deletions app/controllers/better_together/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# frozen_string_literal: true

module BetterTogether
class OmniauthCallbacksController < Devise::OmniauthCallbacksController # rubocop:todo Style/Documentation
# See https://github.com/omniauth/omniauth/wiki/FAQ#rails-session-is-clobbered-after-callback-on-developer-strategy
before_action :verify_oauth_state, only: %i[github]

before_action :set_person_platform_integration, except: [:failure]
before_action :set_user, except: [:failure]
before_action :generate_oauth_state, only: %i[github]

attr_reader :person_platform_integration, :user

def github
handle_auth 'Github'
end

private

def verify_oauth_state
return unless params[:state] != session[:oauth_state]

flash[:alert] = 'Invalid OAuth state parameter'
redirect_to new_user_registration_path
end

def handle_auth(kind) # rubocop:todo Metrics/AbcSize
if user.present?
flash[:success] = t 'devise_omniauth_callbacks.success', kind: kind if is_navigational_format?
sign_in_and_redirect user, event: :authentication
redirect_to edit_user_registration_path
else
flash[:alert] =
t 'devise_omniauth_callbacks.failure', kind:, reason: "#{auth.info.email} is not authorized"
redirect_to new_user_registration_path
end
end

def auth
request.env['omniauth.auth']
end

def set_person_platform_integration
@person_platform_integration = PersonPlatformIntegration.find_by(provider: auth.provider, uid: auth.uid)
end

def set_user
@user = ::BetterTogether.user_class.from_omniauth(
person_platform_integration:,
auth:,
current_user:
)
end

def generate_oauth_state
session[:oauth_state] = SecureRandom.hex(24)
end

def failure
flash[:error] = 'There was a problem signing you in. Please register or try signing in later.'
redirect_to helpers.base_url
end
end
end
2 changes: 2 additions & 0 deletions app/controllers/better_together/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module BetterTogether
class PagesController < FriendlyResourceController # rubocop:todo Metrics/ClassLength
before_action :set_page, only: %i[show edit update destroy]

skip_before_action :check_platform_setup, unless: -> { ::BetterTogether::Platform.where(host: true).any? }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update check to use host scope instead of where query


before_action only: %i[new edit], if: -> { Rails.env.development? } do
# Make sure that all BLock subclasses are loaded in dev to generate new block buttons
BetterTogether::Content::Block.load_all_subclasses
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# frozen_string_literal: true

module BetterTogether
# Allows for the management of PersonPlatformIntegrations
class PersonPlatformIntegrationsController < ApplicationController
before_action :set_person_platform_integration, only: %i[show edit update destroy]

# GET /better_together/person_platform_integrations
def index
@person_platform_integrations = BetterTogether::PersonPlatformIntegration.all
end

# GET /better_together/person_platform_integrations/1
def show; end

# GET /better_together/person_platform_integrations/new
def new
@person_platform_integration = BetterTogether::PersonPlatformIntegration.new
end

# GET /better_together/person_platform_integrations/1/edit
def edit; end

# POST /better_together/person_platform_integrations
def create
# rubocop:todo Layout/LineLength
@better_together_person_platform_integration = BetterTogether::PersonPlatformIntegration.new(person_platform_integration_params)
# rubocop:enable Layout/LineLength

if @person_platform_integration.save
redirect_to @person_platform_integration, notice: 'PersonPlatformIntegration was successfully created.'
else
render :new, status: :unprocessable_entity
end
end

# PATCH/PUT /better_together/person_platform_integrations/1
def update
if @person_platform_integration.update(person_platform_integration_params)
redirect_to @person_platform_integration, notice: 'PersonPlatformIntegration was successfully updated.',
status: :see_other
else
render :edit, status: :unprocessable_entity
end
end

# DELETE /better_together/person_platform_integrations/1
def destroy
@person_platform_integration.destroy!
redirect_to person_platform_integrations_url, notice: 'PersonPlatformIntegration was successfully destroyed.',
status: :see_other
end

private

# Use callbacks to share common setup or constraints between actions.
def set_person_platform_integration
@person_platform_integration = BetterTogether::PersonPlatformIntegration.find(params[:id])
end

# Only allow a list of trusted parameters through.
def person_platform_integration_params
params.require(:person_platform_integration).permit(:provider, :uid, :token, :secret, :profile_url, :user_id)
end
end
end
62 changes: 62 additions & 0 deletions app/controllers/better_together/seeds_controller.rb
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be removed or moved to seed branch

Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# frozen_string_literal: true

module BetterTogether
# CRUD for Seed records
class SeedsController < ApplicationController
before_action :set_seed, only: %i[show edit update destroy]

# GET /seeds
def index
@seeds = Seed.all
end

# GET /seeds/1
def show; end

# GET /seeds/new
def new
@seed = Seed.new
end

# GET /seeds/1/edit
def edit; end

# POST /seeds
def create
@seed = Seed.new(seed_params)

if @seed.save
redirect_to @seed, notice: 'Seed was successfully created.'
else
render :new, status: :unprocessable_entity
end
end

# PATCH/PUT /seeds/1
def update
if @seed.update(seed_params)
redirect_to @seed, notice: 'Seed was successfully updated.', status: :see_other

Check notice

Code scanning / Brakeman

Possible unprotected redirect. Note

Possible unprotected redirect.
else
render :edit, status: :unprocessable_entity
end
end

# DELETE /seeds/1
def destroy
@seed.destroy!
redirect_to seeds_url, notice: 'Seed was successfully destroyed.', status: :see_other
end

private

# Use callbacks to share common setup or constraints between actions.
def set_seed
@seed = Seed.find(params[:id])
end

# Only allow a list of trusted parameters through.
def seed_params
params.fetch(:seed, {})
end
end
end
2 changes: 1 addition & 1 deletion app/helpers/better_together/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def language_select_field(form: nil, field_name: :locale, selected_locale: I18n.

def locale_options_for_select(selected_locale = I18n.locale)
options_for_select(
I18n.available_locales.map { |locale| [I18n.t("locales.#{locale}", locale:), locale] },
I18n.available_locales.map { |locale| [I18n.t("better_together.languages.#{locale}", locale:), locale] },
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this key

selected_locale
)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

module BetterTogether
# This module conains helper methods for PersonPLatformIntegrations
module PersonPlatformIntegrationsHelper
end
end
6 changes: 6 additions & 0 deletions app/helpers/better_together/seeds_helper.rb
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module BetterTogether
module SeedsHelper # rubocop:todo Style/Documentation
end
end
4 changes: 2 additions & 2 deletions app/helpers/better_together/translatable_fields_helper.rb
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check these keys

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def tab_button(locale, unique_locale_attribute, translation_present) # rubocop:t
type: 'button',
aria: { controls: "#{unique_locale_attribute}-field",
selected: locale.to_s == I18n.locale.to_s }) do
(t("locales.#{locale}") + translation_indicator(translation_present)).html_safe
(t("better_together.languages.#{locale}") + translation_indicator(translation_present)).html_safe
end
end

Expand Down Expand Up @@ -73,7 +73,7 @@ def dropdown_menu(_attribute, locale, unique_locale_attribute, base_url) # ruboc
content_tag(:ul, class: 'dropdown-menu') do
I18n.available_locales.reject { |available_locale| available_locale == locale }.map do |available_locale|
content_tag(:li) do
link_to "AI Translate from #{I18n.t("locales.#{available_locale}")}", '#ai-translate',
link_to "AI Translate from #{I18n.t("better_together.languages.#{available_locale}")}", '#ai-translate',
class: 'dropdown-item',
data: {
'better_together--translation-target' => 'aiTranslate',
Expand Down
Loading
Loading