- before_action :require_user
- before_action :check_permission, only: [:index, :show, :resolve,:open,:ignore,:comment]
- before_action :find_issue, only: [:show, :resolve, :reopen, :ignore]
- before_action :get_user_role, only: [:show, :index]
-
- def index
- # If search
- if params[:search_by_user]
- @find_user = User.find_by_display_name(params[:search_by_user])
- if @find_user
- @issues = Issue.where(reported_user_id: @find_user.id, issue_type: @user_role).order(:status)
- else
- @issues = Issue.where(issue_type: @user_role).order(:status)
- notice = t('issues.index.search.user_not_found')
- end
-
- if @find_user !=nil and @issues.first == nil
- @issues = Issue.where(issue_type: @user_role).order(:status)
- notice = t('issues.index.search.issues_not_found')
- end
-
- if notice
- redirect_to issues_path, notice: notice
- end
-
- else
- @issues = Issue.where(issue_type: @user_role).order(:status)
- end
- end