Browse Source

Merge branch 'pre_trustie_server' into trustie_server

pull/342/head
xxq250 3 years ago
parent
commit
58354dc944
2 changed files with 24 additions and 2 deletions
  1. +23
    -2
      app/controllers/issues_controller.rb
  2. +1
    -0
      config/routes.rb

+ 23
- 2
app/controllers/issues_controller.rb View File

@@ -1,12 +1,12 @@
class IssuesController < ApplicationController
before_action :require_login, except: [:index, :show, :index_chosen]
before_action :require_login, except: [:index, :show, :index_chosen, :index_to_name]
before_action :require_profile_completed, only: [:create]
before_action :load_project
before_action :set_user
before_action :check_menu_authorize, except: [:index_chosen]
before_action :check_issue_permission
before_action :operate_issue_permission, only:[:create, :update, :destroy, :clean, :series_update, :copy]
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue]
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue, :index_to_name]

before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :close_issue, :lock_issue]
before_action :check_token_enough, :find_atme_receivers, only: [:create, :update]
@@ -49,6 +49,27 @@ class IssuesController < ApplicationController
@issue_chosen = issue_left_chosen(@project, nil)
end

def index_to_name
issues_index = params[:index].map(&:to_i)
exit_index = []
issues_result = @project.issues.where(project_issues_index:issues_index).map{ |e|
exit_index << e.project_issues_index
{
id:e.id,
project_issues_index:e.project_issues_index,
subject:e.subject
}
}
not_exit = issues_index - exit_index
not_exit.map{|e|
issues_result << {id: nil,
project_issues_index:e,
subject: nil}
}
render json: issues_result
end

def commit_issues
issues = @project.issues.issue_issue.includes(:user,:tracker)
issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user))


+ 1
- 0
config/routes.rb View File

@@ -574,6 +574,7 @@ Rails.application.routes.draw do
get :index_chosen
post :clean
post :series_update
get :index_to_name
end
member do
post :copy


Loading…
Cancel
Save