修复: 邀请链接跳转用户已加入仓库的提示以及项目申请记录只创建一条

This commit is contained in:
yystopf 2022-06-21 11:18:14 +08:00
parent ba1fa8b685
commit 9221e55752
2 changed files with 3 additions and 3 deletions

View File

@ -31,7 +31,7 @@ class Projects::ProjectInviteLinksController < Projects::BaseController
render_ok
rescue Exception => e
uid_logger_error(e.message)
tip_exception(e.message)
normal_status(-1, e.message)
end

View File

@ -28,11 +28,11 @@ class Projects::LinkJoinService < ApplicationService
raise Error, 'invite_sign必须存在!' if invite_sign.blank?
raise Error, '邀请链接不存在!' unless invite_link.present?
raise Error, '邀请链接已失效!' unless invite_user_in_project
raise Error, '用户已加入该项目!' if project.member?(user.id)
raise Error, '您已是仓库成员' if project.member?(user.id)
end
def create_applied_project!
user.applied_projects.create!(project: project, role: role_value, project_invite_link_id: invite_link&.id)
user.applied_projects.find_or_create_by!(status: 'common', project: project, role: role_value, project_invite_link_id: invite_link&.id)
end
def create_member!