From 35bb8fbc1113b845b8a99010be95ba3136d4c12b Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 24 Feb 2023 10:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/issues_controller.rb | 2 +- app/models/issue.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/v1/issues_controller.rb b/app/controllers/api/v1/issues_controller.rb index acf92e834..1f155c5ea 100644 --- a/app/controllers/api/v1/issues_controller.rb +++ b/app/controllers/api/v1/issues_controller.rb @@ -2,7 +2,6 @@ class Api::V1::IssuesController < Api::V1::BaseController before_action :require_login, except: [:index, :show] before_action :require_public_and_member_above, only: [:index, :show, :create, :update, :destroy] before_action :require_operate_above, only: [:batch_update, :batch_destroy] - before_action :check_issue_operate_permission, only: [:update, :destroy] def index IssueTag.init_data(@project.id) unless $redis_cache.hget("project_init_issue_tags", @project.id) @@ -19,6 +18,7 @@ class Api::V1::IssuesController < Api::V1::BaseController end before_action :load_issue, only: [:show, :update, :destroy] + before_action :check_issue_operate_permission, only: [:update, :destroy] def show @user_permission = current_user.present? && current_user.logged? && (@project.member?(current_user) || current_user.admin? || @issue.user == current_user) diff --git a/app/models/issue.rb b/app/models/issue.rb index 3efaac03a..fa25c06a6 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -73,8 +73,8 @@ class Issue < ApplicationRecord has_many :issue_participants, dependent: :destroy has_many :participants, through: :issue_participants has_many :show_participants, -> {joins(:issue_participants).where.not(issue_participants: {participant_type: "atme"}).distinct}, through: :issue_participants, source: :participant - has_many :show_assigners, -> {joins(:issue_assigners).order("issue_assigners.created_at desc").limit(5)}, through: :issue_assigners, source: :assigner - has_many :show_issue_tags, -> {joins(:issue_tags_relates).order("issue_tags_relates.created_at desc").limit(3)}, through: :issue_tags_relates, source: :issue_tag + has_many :show_assigners, -> {joins(:issue_assigners).order("issue_assigners.created_at desc").distinct.limit(5)}, through: :issue_assigners, source: :assigner + has_many :show_issue_tags, -> {joins(:issue_tags_relates).order("issue_tags_relates.created_at desc").distinct.limit(3)}, through: :issue_tags_relates, source: :issue_tag has_many :comment_journals, -> {where.not(notes: nil)}, class_name: "Journal", :as => :journalized has_many :operate_journals, -> {where(notes: nil)}, class_name: "Journal", :as => :journalized