[Users] Add link for email domain search

This commit is contained in:
Earlopain 2022-12-07 18:40:36 +01:00
parent 2249cb3ebb
commit 598d1f289a
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
3 changed files with 15 additions and 2 deletions

View File

@ -2,4 +2,11 @@ module UsersHelper
def email_sig(user, purpose, expires = nil)
EmailLinkValidator.generate("#{user.id}", purpose, expires)
end
def email_domain_search(email)
return unless email.include?("@")
domain = email.split("@").last
link_to "»", users_path(search: { email_matches: "*@#{domain}" })
end
end

View File

@ -84,7 +84,10 @@
<% if CurrentUser.is_admin? %>
<span>Email</span>
<span><%= user.email %></span>
<span>
<%= user.email %>
<%= email_domain_search(user.email) %>
</span>
<% end %>
<% if CurrentUser.is_moderator? %>

View File

@ -34,7 +34,10 @@
<td><%= link_to user.post_upload_count, posts_path(:tags => "user:#{user.name}") %></td>
<td><%= user.post_deleted_count %></td>
<% if CurrentUser.is_moderator? %>
<td><%= user.email %></td>
<td>
<%= user.email %>
<%= email_domain_search(user.email) %>
</td>
<td><%= link_to_ip(user.last_ip_addr) %></td>
<% end %>
<td><%= link_to user.note_version_count, note_versions_path(:search => {:updater_id => user.id}) %></td>