Allow moderators to forcibly change the username of other users. This is so mods can change abusive or invalid usernames. * A mod can only change the username of Builder-level users and below. * The user can't change their own name again until one week has passed. * A modaction is logged when a mod changes a user's name. * A dmail is sent to the user notifying them of the change. * The dmail does not send the user an email notification. This is so we don't spam users if their name is changed after they're banned, or if they haven't visited the site in a long time. The rename button is on the user's profile page, and when you hover over the user's name and open the "..." menu.
140 lines
6.1 KiB
Plaintext
140 lines
6.1 KiB
Plaintext
<div class="user-tooltip">
|
|
<div class="user-tooltip-header">
|
|
<%= avatar_icon(class: "user-tooltip-avatar") %>
|
|
|
|
<div class="user-tooltip-header-top">
|
|
<span class="user-tooltip-name"><%= link_to_user @user %></span>
|
|
|
|
<% if @user.is_banned? %>
|
|
<%= link_to "Banned", users_path(search: { is_banned: true }), class: "user-tooltip-badge user-tooltip-badge-banned" %>
|
|
<% elsif @user.is_admin? %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% elsif @user.is_moderator? %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% elsif @user.can_approve_posts? %>
|
|
<%= link_to "Approver", users_path(search: { can_approve_posts: true }), class: "user-tooltip-badge user-tooltip-badge-approver" %>
|
|
<% elsif @user.can_upload_free? %>
|
|
<%= link_to "Contributor", users_path(search: { can_upload_free: true }), class: "user-tooltip-badge user-tooltip-badge-contributor" %>
|
|
<% else %>
|
|
<%= link_to @user.level_string, users_path(search: { level: @user.level }), class: "user-tooltip-badge user-tooltip-badge-#{@user.level_string.downcase}" %>
|
|
<% end %>
|
|
|
|
<% if @user.positive_feedback_count > 0 %>
|
|
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-positive-feedback" do %>
|
|
<%= medal_icon %>
|
|
<span><%= @user.positive_feedback_count %>
|
|
<% end %>
|
|
<% elsif @user.negative_feedback_count > 0 %>
|
|
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-negative-feedback" do %>
|
|
<%= negative_icon %>
|
|
<span><%= @user.negative_feedback_count %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="user-tooltip-header-bottom">
|
|
<%= time_tag @user.created_at.to_date.iso8601, @user.created_at, class: "user-tooltip-created-at" %>
|
|
<% if @user.last_ip_addr.present? && policy(:ip_address).show? %>
|
|
· <%= link_to_ip @user.last_ip_addr, shorten: true, class: "link-plain" %>
|
|
<% end %>
|
|
|
|
<% @user.user_name_change_requests.visible(CurrentUser.user).count.tap do |name_change_count| %>
|
|
<% if name_change_count > 0 %>
|
|
· <%= link_to pluralize(name_change_count, "other name"), user_name_change_requests_path(search: { user_id: @user.id }), class: "link-plain" %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= render PopupMenuComponent.new do |menu| %>
|
|
<% menu.item do %>
|
|
<%= link_to new_dmail_path(dmail: { to_id: @user.id }) do %>
|
|
<%= message_icon %> Send Message
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if !@user.is_gold? %>
|
|
<% menu.item do %>
|
|
<%= link_to new_user_upgrade_path(user_id: @user.id) do %>
|
|
<%= gift_icon %> Gift Upgrade
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(UserFeedback.new(user: @user)).create? %>
|
|
<% menu.item do %>
|
|
<%= link_to new_user_feedback_path(user_feedback: { user_id: @user.id }) do %>
|
|
<%= feedback_icon %> Give Feedback
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(CurrentUser.user).promote? %>
|
|
<% menu.item do %>
|
|
<%= link_to edit_admin_user_path(@user.id) do %>
|
|
<%= promotion_icon %> Promote User
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(Ban.new(user: @user)).create? %>
|
|
<% menu.item do %>
|
|
<%= link_to new_ban_path(ban: { user_id: @user.id }) do %>
|
|
<%= ban_icon %> Ban User
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if policy(UserNameChangeRequest.new(user: @user)).can_rename_user? %>
|
|
<% menu.item do %>
|
|
<%= link_to change_name_user_path(@user) do %>
|
|
<%= feedback_icon %> Rename User
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<ul class="user-tooltip-stats">
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to posts_path(tags: "user:#{@user.name}"), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.post_upload_count) %></div>
|
|
<div class="user-tooltip-stat-name">Uploads</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to post_versions_path(search: { updater_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.post_update_count) %></div>
|
|
<div class="user-tooltip-stat-name">Tag Edits</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to note_versions_path(search: { updater_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.note_update_count) %></div>
|
|
<div class="user-tooltip-stat-name">Note Edits</div>
|
|
<% end %>
|
|
</li>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to posts_path(tags: "ordfav:#{@user.name}"), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.favorite_count) %></div>
|
|
<div class="user-tooltip-stat-name">Favorites</div>
|
|
<% end %>
|
|
</li>
|
|
<% if Danbooru.config.comments_enabled?.to_s.truthy? %>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to comments_path(search: { creator_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.comment_count) %></div>
|
|
<div class="user-tooltip-stat-name">Comments</div>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
<% if Danbooru.config.forum_enabled?.to_s.truthy? %>
|
|
<li class="user-tooltip-stat-item">
|
|
<%= link_to forum_posts_path(search: { creator_id: @user.id }), class: "link-plain" do %>
|
|
<div class="user-tooltip-stat-value"><%= humanized_number(@user.forum_post_count) %></div>
|
|
<div class="user-tooltip-stat-name">Forum Posts</div>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|