Skip to content

Commit

Permalink
Merge branch 'main' into authorization_framework
Browse files Browse the repository at this point in the history
  • Loading branch information
mononoken committed Mar 11, 2024
2 parents 754d826 + df19a14 commit 4f1c7e6
Show file tree
Hide file tree
Showing 34 changed files with 292 additions and 243 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
42 changes: 42 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CodeQL

on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2 changes: 2 additions & 0 deletions .github/workflows/issue-auto-unassign.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Auto-unassign issue

on:
schedule:
# * is a special character in YAML so you have to quote this string
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rubyonrails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
Expand All @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
Expand All @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
# IDE
.idea
.vscode
/.env

# OS
.DS_Store
11 changes: 6 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ GEM
bootstrap_form (5.3.2)
actionpack (>= 6.1)
activemodel (>= 6.1)
brakeman (6.0.1)
brakeman (6.1.2)
racc
builder (3.2.4)
capybara (3.39.2)
addressable
Expand Down Expand Up @@ -138,7 +139,7 @@ GEM
debug (1.8.0)
irb (>= 1.5.0)
reline (>= 0.3.1)
devise (4.9.2)
devise (4.9.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
Expand Down Expand Up @@ -223,7 +224,7 @@ GEM
guard-compat (~> 1.0)
multi_json (~> 1.8)
http_parser.rb (0.8.0)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
importmap-rails (1.2.1)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -297,7 +298,7 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.3)
phonelib (0.8.2)
phonelib (0.8.7)
popper_js (2.11.7)
pry (0.14.2)
coderay (~> 1.1)
Expand Down Expand Up @@ -450,7 +451,7 @@ GEM
unicode-display_width (2.4.2)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
Expand Down
Binary file added app/assets/images/cat.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/dog.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/png/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/red-panda.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/spider.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/controllers/adoptable_pets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def show
@pet = Pet.find(params[:id])
authorize! @pet, with: AdoptablePetPolicy

if current_user
if current_user&.adopter_account
@adoption_application =
AdopterApplication.find_by(
pet_id: @pet.id,
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/matches_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ class MatchesController < ApplicationController
before_action :set_pet, only: %i[create]
before_action :set_match, only: %i[destroy]

before_action :set_pet, only: %i[create]
before_action :set_match, only: %i[destroy]

def create
authorize! context: {organization: @pet.organization}

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/organizations/tasks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def edit
end

def update
@task.next_due_date_in_days = nil unless task_params.dig(:next_due_date_in_days)
@task.next_due_date_in_days = nil unless task_params.dig(:next_due_date_in_days) || task_params.dig(:completed)

respond_to do |format|
if @task.update(task_params)
Expand Down
9 changes: 0 additions & 9 deletions app/javascript/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,4 @@ const application = Application.start()
application.debug = false
window.Stimulus = application

// google map script tag calls this method via callback param when finished loading
// this creates a custom event that is being listened to in the view to build map
// without this google-map controller JS runs before google is available and fails
window.initMap = () => {
console.log('initMap was called');
const event = new Event("MapLoaded", {"bubbles":true, "cancelable":false});
window.dispatchEvent(event)
}

export { application }
52 changes: 0 additions & 52 deletions app/javascript/controllers/google_map_controller.js

This file was deleted.

4 changes: 2 additions & 2 deletions app/models/adopter_foster_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#
# Indexes
#
# index_adopter_profiles_on_adopter_account_id (adopter_account_id)
# index_adopter_profiles_on_location_id (location_id)
# index_adopter_foster_profiles_on_adopter_account_id (adopter_account_id)
# index_adopter_foster_profiles_on_location_id (location_id)
#
# Foreign Keys
#
Expand Down
4 changes: 3 additions & 1 deletion app/views/adoptable_pets/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
</div>
</div>
<div>
<%= link_to 'Become an adopter', new_user_registration_path, class: 'btn btn-primary btn-sm d-none d-md-block' %>
<% unless current_user %>
<%= link_to t('general.become_an_adopter'), new_user_registration_path, class: 'btn btn-primary btn-sm d-none d-md-block' %>
<% end %>
</div>
</div>
</div>
Expand Down
24 changes: 19 additions & 5 deletions app/views/layouts/shared/_navbar.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<nav class="navbar navbar-expand-lg bg-transparent shadow-none px-0 py-3">
<div class="container-fluid px-4">
<%= link_to home_index_path, class: 'navbar-brand' do %>
<%= image_tag('png/logo.png', width: '40px', height: '35px', alt: 'Organization logo',
class: 'pe-2') %>
<%= link_to home_index_path, class: 'navbar-brand fw-bold text-black' do %>
<%= Current.organization.name %>
<% end %>

<div class="d-flex align-items-center order-lg-3">
<div>
<button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-default3" aria-controls="navbar-default3" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler collapsed me-1" type="button" data-bs-toggle="collapse" data-bs-target="#navbar-default3" aria-controls="navbar-default3" aria-expanded="false" aria-label="Toggle navigation">
<span class="icon-bar top-bar mt-0"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
Expand Down Expand Up @@ -74,17 +76,23 @@
<!-- Button -->

<!-- Collapse -->
<div class="collapse navbar-collapse" id="navbar-default3">
<div class="justify-content-end collapse navbar-collapse " id="navbar-default3">
<ul class="navbar-nav">

<li class='nav-item'>
<%= active_link_to 'Adopt', new_user_registration_path, class: 'nav-link' %>
</li>
<li class='nav-item'>
<%= active_link_to 'Get Involved', '#', class: 'nav-link' %>
</li>
<li class='nav-item'>
<%= active_link_to 'About Us', about_us_path, class: 'nav-link' %>
</li>
<li class='nav-item'>
<%= active_link_to 'Partners', partners_path, class: 'nav-link' %>
</li>
<li class="nav-item d-block d-md-none">
<%= active_link_to 'Adopt', new_user_registration_path, class: 'nav-link' %>
<li class="nav-item">
<%= active_link_to 'Donate', donate_path, class: 'nav-link' %>
</li>
<li class="nav-item d-block d-md-none">
<%= active_link_to 'Log In', new_user_session_path, class: 'nav-link' %>
Expand All @@ -93,3 +101,9 @@
</div>
</div>
</nav>
<!-- Demo banner-->
<% if Rails.env.staging? %>
<div class="container-fluid m-0 p-2 text-center bg-danger-soft display-6">
This is a demo site
</div>
<% end %>
Loading

0 comments on commit 4f1c7e6

Please sign in to comment.