forked from Gitlink/forgeplus
fix: issue is collaborators
This commit is contained in:
parent
e3df503dd2
commit
efc82b9841
|
@ -26,6 +26,26 @@ class BaseForm
|
|||
raise "项目标识已被占用." if ReversedKeyword.check_exists?(repository_name)
|
||||
end
|
||||
|
||||
def check_password(password)
|
||||
password = strip(password)
|
||||
raise PasswordFormatError, "密码8~16位密码,支持字母数字和符号" unless password =~ CustomRegexp::PASSWORD
|
||||
end
|
||||
|
||||
def check_password_confirmation(password, password_confirmation)
|
||||
password = strip(password)
|
||||
password_confirmation = strip(password_confirmation)
|
||||
|
||||
raise PasswordFormatError, "确认密码为8~16位密码,支持字母数字和符号" unless password_confirmation =~ CustomRegexp::PASSWORD
|
||||
raise PasswordConfirmationError, "两次输入的密码不一致" unless password == password_confirmation
|
||||
end
|
||||
|
||||
def check_verifi_code(verifi_code, code)
|
||||
code = strip(code)
|
||||
# return if code == "123123" # TODO 万能验证码,用于测试
|
||||
raise VerifiCodeError, "验证码已失效" if !verifi_code&.effective?
|
||||
raise VerifiCodeError, "验证码不正确" if verifi_code&.code != code
|
||||
end
|
||||
|
||||
private
|
||||
def strip(str)
|
||||
str.to_s.strip.presence
|
||||
|
|
|
@ -153,6 +153,10 @@ class Issue < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def is_collaborators?
|
||||
self.assigned_to_id.present? ? self.project.member?(self.assigned_to_id) : false
|
||||
end
|
||||
|
||||
def get_issue_tags_name
|
||||
if issue_tags.present?
|
||||
issue_tags.select(:name).uniq.pluck(:name).join(",")
|
||||
|
|
|
@ -5,6 +5,7 @@ json.done_ratio @issue.done_ratio.to_s + "%"
|
|||
json.issue_tags @issue.get_issue_tags
|
||||
json.cannot_edit_tags @cannot_edit_tags
|
||||
json.issue_current_user @issue.author_id == current_user.try(:id)
|
||||
json.assigned_to_id @issue.is_collaborators? ? @issue.assigned_to_id : nil
|
||||
# json.issue_chosen @issue_chosen
|
||||
# json.branches @all_branches
|
||||
json.attachments do
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'zh-CN':
|
||||
activemodel:
|
||||
attributes:
|
||||
projects/create_form:
|
||||
name: 项目名称
|
||||
repository_name: 仓库名称
|
||||
'zh-CN':
|
||||
activemodel:
|
||||
attributes:
|
||||
projects/create_form:
|
||||
name: 项目名称
|
||||
repository_name: 项目标识
|
||||
description: 项目简介
|
Loading…
Reference in New Issue