Merge remote-tracking branch 'upstream/pull/5014'

This commit is contained in:
Tom Hughes 2024-07-24 18:24:50 +01:00
commit 58ac035d41
5 changed files with 99 additions and 8 deletions

View file

@ -142,9 +142,6 @@ class UserBlocksController < ApplicationController
if UserBlock::PERIODS.exclude?(@block_period)
flash[:error] = t("user_blocks.filter.block_period")
elsif @user_block && !@user_block.active?
flash[:error] = t("user_blocks.filter.block_expired")
else
@valid_params = true
end

View file

@ -15,7 +15,7 @@
<% end %>
</td>
<td><%= link_to t(".show"), block %></td>
<td><% if current_user and current_user.id == block.creator_id and block.active? %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
<td><% if current_user and current_user.id == block.creator_id %><%= link_to t(".edit"), edit_user_block_path(block) %><% end %></td>
<% if show_revoke_link %>
<td><% if block.active? %><%= link_to t(".revoke"), revoke_user_block_path(block) %><% end %></td>
<% end %>

View file

@ -26,13 +26,12 @@
<dd class="col-sm-9"><div class="richtext text-break"><%= @user_block.reason.to_html %></div></dd>
</dl>
<% if @user_block.ends_at > Time.now.getutc && (current_user&.id == @user_block.creator_id ||
can?(:revoke, UserBlock)) %>
<% if current_user&.id == @user_block.creator_id || can?(:revoke, UserBlock) && @user_block.active? %>
<div>
<% if current_user&.id == @user_block.creator_id %>
<%= link_to t(".edit"), edit_user_block_path(@user_block), :class => "btn btn-outline-primary" %>
<% end %>
<% if can?(:revoke, UserBlock) %>
<% if can?(:revoke, UserBlock) && @user_block.active? %>
<%= link_to t(".revoke"), revoke_user_block_path(@user_block), :class => "btn btn-outline-danger" %>
<% end %>
</div>