操作记录记录显示调整,不存在用户仅显示id

This commit is contained in:
xxq250 2024-09-27 11:28:59 +08:00
parent 6574aff205
commit 6924366e02
2 changed files with 5 additions and 4 deletions

View File

@ -40,10 +40,11 @@ class UserAction < ApplicationRecord
end
def opt_user_name
if user&.id == user_id
"--"
user = User.find_by(id: self.user_id)
if user.present?
user&.login
else
User.find_by(id: self.user_id)&.login
"不存用户:#{action_id}"
end
end

View File

@ -17,7 +17,7 @@
<td><%= action.action_name %></td>
<td>
<%= link_to "/#{action.user&.login}", target: '_blank' do %>
<%= overflow_hidden_span action.user&.login, width: 100 %>
<%= overflow_hidden_span action.opt_user_name, width: 100 %>
<% end %></td>
<td>
<%= raw action.action_info %>