git 更新文件的时候如果邮箱为空问题

dev_forum
jingquan huang 5 years ago
parent 7b476de0ef
commit f7db0a7380

@ -267,7 +267,7 @@ class MyshixunsController < ApplicationController
@content_modified = 1
author_name = current_user.real_name
author_email = current_user.mail
author_email = current_user.git_mail
message = params[:evaluate] == 0 ? "System automatically submitted" : "User submitted"
uid_logger("112233#{author_name}")
uid_logger("112233#{author_email}")
@ -276,7 +276,7 @@ class MyshixunsController < ApplicationController
message: message,
content: content,
author_name: author_name,
author_email: "author_email@email.com")
author_email: author_email)
end
end

@ -30,8 +30,9 @@ module ApplicationHelper
end
# git用户
# git用户命名规则login+"@educoder.net"
def git_username(email)
User.find_by_mail(email)
User.find_by_mail(email) || User.find_by_login(mail.split("@").first)
end
# 不同的类型扩展不同的目录

@ -156,6 +156,9 @@ class User < ApplicationRecord
Token.where(:user_id => id, :action => 'session', :value => value).delete_all
end
def git_mail
mail || "#{login}@educoder.net"
end
# 学号
def student_id

Loading…
Cancel
Save