修改项目成员可以项目的问题
This commit is contained in:
parent
bfbcb350f7
commit
db437eb191
|
@ -3,5 +3,6 @@ module Publicable
|
|||
|
||||
included do
|
||||
scope :visible, -> { where(is_public: true) }
|
||||
scope :is_private, -> {where(is_public: false)}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -100,8 +100,11 @@ class Project < ApplicationRecord
|
|||
end
|
||||
|
||||
def self.list_user_projects(user_id)
|
||||
user_not_show = Project.joins(:members).where("projects.is_public = ? and projects.user_id != ? and members.user_id != ?", false, user_id,user_id).pluck(:id).uniq
|
||||
Project.where.not(id: user_not_show)
|
||||
projects = Project.is_private.select(:id)
|
||||
user_not_show_1 = projects.where(user_id: user_id).pluck(:id).uniq
|
||||
|
||||
user_show_2 = projects.joins(:members).where("members.user_id = ?", user_id).pluck(:id).uniq
|
||||
Project.where.not(id: (user_not_show_1 - user_show_2.uniq))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue