<%= f.form_group :needs_view do %>
<%= f.check_box :needs_view %>
<% end %>
+
+ <%= f.primary %>
<% else %>
<div class="alert alert-info">
<% if @user_block.active? %>
<%= hidden_field_tag "user_block_period", 0 %>
<%= hidden_field_tag "user_block[needs_view]", false %>
- <% end %>
- <%= f.primary %>
+ <% if @user_block.active? %>
+ <%= f.submit t(".revoke"), :class => "btn btn-danger" %>
+ <% else %>
+ <%= f.primary %>
+ <% end %>
+ <% end %>
<% end %>
title: "Editing block on %{name}"
heading_html: "Editing block on %{name}"
period: "How long, starting now, the user will be blocked from the API for."
+ revoke: "Revoke block"
filter:
block_period: "The blocking period must be one of the values selectable in the drop-down list."
create:
assert_select "textarea#user_block_reason", :count => 1
assert_select "select#user_block_period", :count => 0
assert_select "input#user_block_needs_view[type='checkbox']", :count => 0
+ assert_select "input[type='submit'][value='Update block']", :count => 0
assert_select "input#user_block_period[type='hidden']", :count => 1
assert_select "input#user_block_needs_view[type='hidden']", :count => 1
- assert_select "input[type='submit'][value='Update block']", :count => 1
+ assert_select "input[type='submit'][value='Revoke block']", :count => 1
end
# Login as the block creator
assert_select "textarea#user_block_reason", :count => 1
assert_select "select#user_block_period", :count => 1
assert_select "input#user_block_needs_view[type='checkbox']", :count => 1
+ assert_select "input[type='submit'][value='Update block']", :count => 1
assert_select "input#user_block_period[type='hidden']", :count => 0
assert_select "input#user_block_needs_view[type='hidden']", :count => 0
- assert_select "input[type='submit'][value='Update block']", :count => 1
+ assert_select "input[type='submit'][value='Revoke block']", :count => 0
end
# We should get an error if the user doesn't exist
assert_no_field "Needs view"
fill_in "Reason", :with => "Revoking 0-hour blocks works"
- click_on "Update block"
+ click_on "Revoke block"
assert_text(/Revoker:\s+#{Regexp.escape other_moderator_user.display_name}/)
assert_text(/Status:\s+Ended/)
assert_text(/Reason for block:\s+Revoking 0-hour blocks works/)