• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AgileVentures / WebsiteOne / #233

pending completion
#233

push

semaphore

web-flow
add last_github_update to project list (#3838)

* add last_github_update to project list

* add test for display of last_github_update

* test for display of last_github_update

4929 of 5374 relevant lines covered (91.72%)

14.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/app/controllers/application_controller.rb
1
# frozen_string_literal: true
2

3
require 'custom_errors'
1✔
4
class ApplicationController < ActionController::Base
1✔
5
  protect_from_forgery with: :exception
1✔
6
  helper_method :static_page_path
1✔
7

8
  before_action :set_user_id
1✔
9
  before_action :get_next_scrum, :store_location, unless: -> { request.xhr? }
441✔
10
  before_action :configure_permitted_parameters, if: :devise_controller?
1✔
11
  after_action :user_activity
1✔
12

13
  # use_vanity :current_user
14

15
  include ApplicationHelper
1✔
16
  include CustomErrors
1✔
17

18
  protected
1✔
19

20
  def configure_permitted_parameters
1✔
21
    devise_parameter_sanitizer.permit(:account_update, keys: %i(
30✔
22
                                        first_name last_name email bio password
23
                                        password_confirmation current_password
24
                                        display_email display_profile display_hire_me
25
                                        receive_mailings status
26
                                      ))
27

28
    modify_user_signup_params
30✔
29
  end
30

31
  def after_sign_in_path_for(resource)
1✔
32
    if resource.sign_in_count <= 1
13✔
33
      stored_location_for(resource) || '/getting-started'
13✔
34
    else
35
      stored_location_for(resource) || request.env['omniauth.origin'] || session[:previous_url] || root_path
×
36
    end
37
  end
38

39
  # see Settings.yml for privileged user
40
  #
41
  def check_privileged
1✔
42
    raise ::AgileVentures::AccessDenied.new(current_user, request) unless current_user.is_privileged?
×
43
  end
44

45
  rescue_from ::AgileVentures::AccessDenied do |_exception|
1✔
46
    render file: "#{Rails.root}/public/403.html", status: 403, layout: false
×
47
  end
48

49
  private
1✔
50

51
  def request_path_blacklisted?
1✔
52
    paths = [
53
      user_session_path,
168✔
54
      new_user_registration_path,
55
      new_user_password_path,
56
      destroy_user_session_path,
57
      "#{edit_user_password_path}.*"
58
    ]
59

60
    paths.any? { |path| request.original_fullpath =~ /#{path}/ }
938✔
61
  end
62

63
  def get_next_scrum
1✔
64
    @next_event = Event.next_occurrence(:Scrum) if Features.get_next_scrum.enabled
219✔
65
  end
66

67
  def store_location
1✔
68
    # store last url - this is needed for post-login redirect to whatever the user last visited.
69
    session[:previous_url] = request.original_fullpath if request.get? && !request_path_blacklisted?
219✔
70
  end
71

72
  def user_activity
1✔
73
    current_user.try :touch
209✔
74
  end
75

76
  def show_deactivated_message_and_redirect_to_root
1✔
77
    flash[:alert] = 'User is deactivated.'
1✔
78
    redirect_to root_path
1✔
79
  end
80

81
  def modify_user_signup_params
1✔
82
    devise_parameter_sanitizer.permit(:sign_up) do |user_signup_params|
30✔
83
      user_signup_params.permit(:receive_mailings)
×
84
      user_signup_params[:receive_mailings] = user_signup_params[:receive_mailings] == '1'
×
85
      user_signup_params.permit!
×
86
    end
87
  end
88

89
  # set current_user.id to a cookie to allow google analytics to access current_user var
90

91
  def set_user_id
1✔
92
    cookies[:user_id] = current_user.id if current_user
220✔
93
  end
94
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc