This commit is contained in:
yystopf 2023-02-24 10:24:57 +08:00
parent 267279df2d
commit 35bb8fbc11
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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