| @@ -46,7 +46,7 @@ class Api::V1::Issues::JournalsController < Api::V1::BaseController | |||||
| end | end | ||||
| def load_issue | def load_issue | ||||
| @issue = @project.issues.issue_issue.where(project_issues_index: params[:index]).where.not(id: params[:index]).take || Issue.find_by_id(params[:index]) | |||||
| @issue = @project.issues.issue_issue.where(project_issues_index: params[:index]).where.not(id: params[:index]).take || @project.issues.issue_issue.find_by_id(params[:index]) | |||||
| if @issue.blank? | if @issue.blank? | ||||
| render_not_found("疑修不存在!") | render_not_found("疑修不存在!") | ||||
| end | end | ||||
| @@ -70,7 +70,7 @@ class Api::V1::IssuesController < Api::V1::BaseController | |||||
| private | private | ||||
| def load_issue | def load_issue | ||||
| @issue = @project.issues.issue_issue.where(project_issues_index: params[:index]).where.not(id: params[:index]).take || Issue.find_by_id(params[:index]) | |||||
| @issue = @project.issues.issue_issue.where(project_issues_index: params[:index]).where.not(id: params[:index]).take || @project.issues.issue_issue.find_by_id(params[:index]) | |||||
| if @issue.blank? | if @issue.blank? | ||||
| render_not_found("疑修不存在!") | render_not_found("疑修不存在!") | ||||
| end | end | ||||
| @@ -50,7 +50,7 @@ class MarkFilesController < ApplicationController | |||||
| end | end | ||||
| def load_pull_request | def load_pull_request | ||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || PullRequest.find_by_id(params[:id]) | |||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || @project.pull_requests.find_by_id(params[:id]) | |||||
| end | end | ||||
| end | end | ||||
| @@ -295,11 +295,11 @@ class PullRequestsController < ApplicationController | |||||
| private | private | ||||
| def load_pull_request | def load_pull_request | ||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || PullRequest.find_by_id(params[:id]) | |||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || @project.pull_requests.find_by_id(params[:id]) | |||||
| end | end | ||||
| def find_pull_request | def find_pull_request | ||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || PullRequest.find_by_id(params[:id]) | |||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || @project.pull_requests.find_by_id(params[:id]) | |||||
| @issue = @pull_request&.issue | @issue = @pull_request&.issue | ||||
| if @pull_request.blank? | if @pull_request.blank? | ||||
| normal_status(-1, "合并请求不存在") | normal_status(-1, "合并请求不存在") | ||||
| @@ -14,7 +14,7 @@ class ReviewsController < ApplicationController | |||||
| end | end | ||||
| def load_pull_request | def load_pull_request | ||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || PullRequest.find_by_id(params[:id]) | |||||
| @pull_request = @project.pull_requests.where(gitea_number: params[:id]).where.not(id: params[:id]).take || @project.pull_requests.find_by_id(params[:id]) | |||||
| end | end | ||||
| end | end | ||||