Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main > Staging #664

Merged
merged 32 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cba742c
Bump carrierwave from 2.2.4 to 2.2.5
dependabot[bot] Nov 29, 2023
57d7482
Add slack notification only for tests
saenom Feb 13, 2024
0db928f
Merge pull request #651 from bitzesty/add-slack-notification
saenom Feb 13, 2024
e340936
Increase password minimum length to 14 characters
TheDancingClown Feb 13, 2024
a0fb022
Merge pull request #653 from bitzesty/password-length
TheDancingClown Feb 13, 2024
db243a1
Add min password to views
TheDancingClown Feb 13, 2024
3799387
Merge pull request #654 from bitzesty/password
matthewford Feb 13, 2024
5c5cd56
Merge pull request #627 from bitzesty/dependabot/bundler/carrierwave-…
matthewford Feb 13, 2024
b4e4660
Bump follow-redirects from 1.15.3 to 1.15.5
dependabot[bot] Feb 13, 2024
5b517b5
Bump puma from 5.6.7 to 5.6.8
dependabot[bot] Feb 13, 2024
40fc166
Merge pull request #657 from bitzesty/dependabot/bundler/puma-5.6.8
matthewford Feb 13, 2024
8cc0a90
Bump nokogiri from 1.15.5 to 1.16.2
dependabot[bot] Feb 13, 2024
dfe38e4
Merge pull request #655 from bitzesty/dependabot/npm_and_yarn/follow-…
matthewford Feb 13, 2024
c059ba5
Merge pull request #656 from bitzesty/dependabot/bundler/nokogiri-1.16.2
matthewford Feb 13, 2024
8edd4b5
Adds new links to assessors dashboard
TheDancingClown Feb 16, 2024
ed868dc
Adds target _blank to nomination table links
TheDancingClown Feb 16, 2024
55a55be
Add page params when viewing nominations
TheDancingClown Feb 16, 2024
0c77f22
Adds search and page params to user navigation
TheDancingClown Feb 16, 2024
d10730f
Adds search and page params to admin lieutenant paths
TheDancingClown Feb 16, 2024
deed886
Pass search params in admin group leader paths
TheDancingClown Feb 16, 2024
fa7e8e4
Pass search params to admin assessor paths
TheDancingClown Feb 16, 2024
fe1b964
Pass search params to admin admins paths
TheDancingClown Feb 16, 2024
6ed0799
Adds guard for search params
TheDancingClown Feb 16, 2024
8675b1a
Merge pull request #659 from bitzesty/new-tab-nominations
TheDancingClown Feb 16, 2024
ca717c7
Merge pull request #658 from bitzesty/assessor-dashboard
TheDancingClown Feb 16, 2024
6c4ea01
Merge branch 'main' into page-params
TheDancingClown Feb 16, 2024
42eb511
Merge pull request #660 from bitzesty/page-params
TheDancingClown Feb 16, 2024
6ada51d
Assessor dashboard copy change
TheDancingClown Feb 19, 2024
f022c3a
Merge pull request #661 from bitzesty/na-copy
TheDancingClown Feb 19, 2024
4046f76
Adds assessment status
TheDancingClown Feb 19, 2024
d8ac708
Update app/views/assessor/form_answers/_list_body.html.slim
TheDancingClown Feb 21, 2024
c856cea
Merge pull request #662 from bitzesty/assessor-status
TheDancingClown Feb 21, 2024
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
40 changes: 40 additions & 0 deletions .github/workflows/slack_notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Check for tests or deployment results
on:
workflow_run:
workflows: ["CI"]
types: [completed]

jobs:
notify-slack:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- name: Extract Slack ID for author
id: extract_slack_id
run: |
#!/bin/bash
# user_string="johndoe:U12345678, janedoe:U87654321, alice:U98765432"
user_string="${{ vars.SLACK_USER_IDS }}"
suid=""

IFS=", " read -r -a users <<< "$user_string"
for user in "${users[@]}"; do
IFS=':' read -r github_username slack_user_id <<< "$user"
if [ "$github_username" == "${{github.actor}}" ]; then
suid="$slack_user_id"
break
fi
done

echo "::set-output name=suid::$suid"
- name: tests
uses: ravsamhq/notify-slack-action@v2
if: ${{ github.event.workflow_run.head_branch != 'main' && github.event.workflow_run.head_branch != 'staging' && github.event.workflow_run.head_branch != 'production' }}
with:
status: ${{ github.event.workflow_run.conclusion }}
notification_title: "Tests ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>"
message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <{repo_url}|{repo}>"
footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>"
mention_users: ${{ steps.extract_slack_id.outputs.suid }}
mention_users_when: "failure,warnings"
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ gem 'prawn-table'
gem 'nokogiri'

# Uploads
gem 'carrierwave', '~> 2.2.2'
gem 'carrierwave', '~> 2.2.5'
gem 'google-cloud-storage', '~> 1.34.1'
gem 'carrierwave-google-storage', github: "bitzesty/carrierwave-google-storage", ref: 'c706a21c6c25045cae2e39bcab5bf594af0bcf46'
gem 'vigilion', '~> 1.0.4', github: 'vigilion/vigilion-ruby', ref: '7d6a7e5'
Expand Down Expand Up @@ -124,7 +124,7 @@ gem 'nilify_blanks'
gem 'curb', '0.9.10'

# Web server
gem 'puma', '~> 5.6.7'
gem 'puma', '~> 5.6.8'

# Performance & Error reporting
gem 'appsignal'
Expand Down
17 changes: 10 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
carrierwave (2.2.4)
carrierwave (2.2.5)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
addressable (~> 2.6)
Expand Down Expand Up @@ -426,10 +426,12 @@ GEM
nilify_blanks (1.4.0)
activerecord (>= 4.0.0)
activesupport (>= 4.0.0)
nio4r (2.6.1)
nokogiri (1.15.5-arm64-darwin)
nio4r (2.7.0)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-darwin)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
notifications-ruby-client (5.4.0)
jwt (>= 1.5, < 3)
Expand Down Expand Up @@ -473,7 +475,7 @@ GEM
psych (5.1.1.1)
stringio
public_suffix (5.0.4)
puma (5.6.7)
puma (5.6.8)
nio4r (~> 2.0)
pundit (1.1.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -756,6 +758,7 @@ GEM
PLATFORMS
arm64-darwin-21
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
active_hash
Expand All @@ -767,7 +770,7 @@ DEPENDENCIES
bootstrap-sass (~> 3.4)
browser (= 2.4.0)
capybara (~> 3.39)
carrierwave (~> 2.2.2)
carrierwave (~> 2.2.5)
carrierwave-google-storage!
ckeditor
codeclimate_circle_ci_coverage
Expand Down Expand Up @@ -815,7 +818,7 @@ DEPENDENCIES
prawn
prawn-table
pry-byebug
puma (~> 5.6.7)
puma (~> 5.6.8)
pundit (~> 1.1)
pusher (= 0.15.2)
rack-canonical-host
Expand Down
16 changes: 13 additions & 3 deletions app/controllers/admin/admins_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class Admin::AdminsController < Admin::UsersController
before_action :find_resource, except: [:index, :new, :create, :login_as_assessor, :login_as_user, :console]
before_action :permit_search_params, except: [:index]

def index
params[:search] ||= AdminSearch::DEFAULT_SEARCH
params[:search].permit!
Expand All @@ -21,7 +23,7 @@ def create
authorize @resource, :create?

@resource.save
location = @resource.persisted? ? admin_admins_path : nil
location = @resource.persisted? ? admin_admins_path(search: params[:search], page: params[:page]) : nil
respond_with :admin, @resource, location: location
end

Expand All @@ -34,14 +36,18 @@ def update
@resource.update_without_password(resource_params)
end

respond_with :admin, @resource, location: admin_admins_path
respond_with :admin,
@resource,
location: admin_admins_path(search: params[:search], page: params[:page])
end

def destroy
authorize @resource, :destroy?
@resource.soft_delete!

respond_with :admin, @resource, location: admin_admins_path
respond_with :admin,
@resource,
location: admin_admins_path(search: params[:search], page: params[:page])
end

# NOTE: debug abilities for Admin - BEGIN
Expand Down Expand Up @@ -80,4 +86,8 @@ def resource_params
:first_name,
:last_name)
end

def permit_search_params
params[:search].permit! if params[:search].present?
end
end
17 changes: 14 additions & 3 deletions app/controllers/admin/assessors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Admin::AssessorsController < Admin::UsersController
before_action :permit_search_params, except: [:index]

def index
params[:search] ||= AssessorSearch::DEFAULT_SEARCH
params[:search].permit!
Expand All @@ -21,7 +23,7 @@ def create
authorize @resource, :create?

@resource.save
location = @resource.persisted? ? admin_assessors_path : nil
location = @resource.persisted? ? admin_assessors_path(search: params[:search], page: params[:page]) : nil
respond_with :admin, @resource, location: location, notice: "User has been successfully added."
end

Expand All @@ -34,14 +36,19 @@ def update
@resource.update_without_password(resource_params)
end

respond_with :admin, @resource, location: admin_assessors_path, notice: "User has been updated."
respond_with :admin,
@resource,
location: admin_assessors_path(search: params[:search], page: params[:page]),
notice: "User has been updated."
end

def destroy
authorize @resource, :destroy?
@resource.soft_delete!

respond_with :admin, @resource, location: admin_assessors_path
respond_with :admin,
@resource,
location: admin_assessors_path(search: params[:search], page: params[:page])
end

private
Expand All @@ -59,4 +66,8 @@ def resource_params
:first_name,
:last_name)
end

def permit_search_params
params[:search].permit! if params[:search].present?
end
end
12 changes: 10 additions & 2 deletions app/controllers/admin/group_leaders_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Admin::GroupLeadersController < Admin::UsersController
before_action :permit_search_params, except: [:index]

def index
params[:search] ||= GroupLeaderSearch::DEFAULT_SEARCH
params[:search].permit!
Expand All @@ -20,15 +22,17 @@ def update

respond_with :admin,
@resource,
location: admin_group_leaders_path,
location: admin_group_leaders_path(search: params[:search], page: params[:page]),
notice: "User has been successfully updated."
end

def destroy
authorize @resource, :destroy?
@resource.soft_delete!

respond_with :admin, @resource, location: admin_group_leaders_path
respond_with :admin,
@resource,
location: admin_group_leaders_path(search: params[:search], page: params[:page])
end

private
Expand All @@ -45,4 +49,8 @@ def resource_params
:first_name,
:last_name)
end

def permit_search_params
params[:search].permit! if params[:search].present?
end
end
16 changes: 12 additions & 4 deletions app/controllers/admin/lieutenants_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Admin::LieutenantsController < Admin::UsersController
before_action :permit_search_params, except: [:index]

def index
params[:search] ||= LieutenantSearch::DEFAULT_SEARCH
params[:search].permit!
Expand Down Expand Up @@ -30,7 +32,7 @@ def create
authorize @resource, :create?

@resource.save
location = @resource.persisted? ? admin_lieutenants_path : nil
location = @resource.persisted? ? admin_lieutenants_path(search: params[:search], page: params[:page]) : nil
respond_with :admin,
@resource,
location: location,
Expand All @@ -48,7 +50,7 @@ def update

respond_with :admin,
@resource,
location: admin_lieutenants_path,
location: admin_lieutenants_path(search: params[:search], page: params[:page]),
notice: "User has been successfully updated."
end

Expand All @@ -60,15 +62,17 @@ def restore

respond_with :admin,
@resource,
location: admin_lieutenants_path,
location: admin_lieutenants_path(search: params[:search], page: params[:page]),
notice: "User has been successfully restored."
end

def destroy
authorize @resource, :destroy?
@resource.soft_delete!

respond_with :admin, @resource, location: admin_lieutenants_path
respond_with :admin,
@resource,
location: admin_lieutenants_path(search: params[:search], page: params[:page])
end

private
Expand All @@ -87,4 +91,8 @@ def resource_params
:role,
:ceremonial_county_id)
end

def permit_search_params
params[:search].permit! if params[:search].present?
end
end
14 changes: 9 additions & 5 deletions app/controllers/admin/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class Admin::UsersController < Admin::BaseController
respond_to :html
before_action :find_resource, except: [:index, :new, :create, :deleted, :restore]
before_action :permit_search_params, except: [:index]

def index
params[:search] ||= UserSearch::DEFAULT_SEARCH
params[:search].permit!

authorize User, :index?

@search = UserSearch.new(User.all).search(params[:search])
Expand All @@ -28,7 +28,7 @@ def create
authorize @resource, :create?

@resource.save
location = @resource.persisted? ? admin_users_path : nil
location = @resource.persisted? ? admin_users_path(search: params[:search], page: params[:page]) : nil
respond_with :admin, @resource, location: location
end

Expand All @@ -41,7 +41,7 @@ def update
@resource.update_without_password(resource_params)
end

respond_with :admin, @resource, location: admin_users_path
respond_with :admin, @resource, location: admin_users_path(search: params[:search], page: params[:page])
end

def resend_confirmation_email
Expand All @@ -50,7 +50,7 @@ def resend_confirmation_email
@resource.send_confirmation_instructions
flash[:success] = "Confirmation instructions were successfully sent to #{@resource.decorate.full_name} (#{@resource.email})"
respond_with :admin, @resource,
location: admin_users_path
location: admin_users_path(search: params[:search], page: params[:page])
end

def unlock
Expand All @@ -59,7 +59,7 @@ def unlock
@resource.unlock_access!
flash[:success] = "User #{@resource.decorate.full_name} (#{@resource.email}) successfully unlocked!"
respond_with :admin, @resource,
location: edit_admin_user_path(@resource)
location: edit_admin_user_path(@resource, search: params[:search], page: params[:page])
end

def log_in
Expand Down Expand Up @@ -88,4 +88,8 @@ def resource_params
:password_confirmation
)
end

def permit_search_params
params[:search].permit! if params[:search].present?
end
end
13 changes: 11 additions & 2 deletions app/controllers/assessor/form_answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def index

scope = current_assessor.applications_scope(
params[:year].to_s == "all_years" ? nil : @award_year
).eligible_for_assessor
).includes(:assessor_assignments).eligible_for_assessor

if search_params[:query].blank? && category_picker.show_award_tabs_for_assessor?
scope = scope.where(award_type: category_picker.current_award_type)
Expand Down Expand Up @@ -95,13 +95,17 @@ def show
def edit
authorize resource, :edit?

unless assessor_assignment.status
assessor_assignment.update(status: "viewed")
end

@form = resource.award_form.decorate(answers: HashWithIndifferentAccess.new(resource.document))
end

private

def resource
@form_answer ||= current_assessor.applications_scope(@award_year).find(params[:id]).decorate
@form_answer ||= current_assessor.applications_scope(@award_year).includes(:assessor_assignments).find(params[:id]).decorate
end

def category_picker
Expand All @@ -120,4 +124,9 @@ def resolve_layout
"application-assessor"
end
end

def assessor_assignment
AssessorAssignment.find_by(assessor_id: current_assessor.id, form_answer_id: resource.id) ||
resource.assessor_assignments.build(assessor: current_assessor, award_year: @award_year)
end
end
Loading
Loading