can :query, :browse
can :show, [Node, Way, Relation]
can [:index, :show], [OldNode, OldWay, OldRelation]
- can [:show, :new], Note
+ can [:show, :create], Note
can :search, :direction
can [:index, :permalink, :edit, :help, :fixthemap, :offline, :export, :about, :communities, :preview, :copyright, :key, :id], :site
can [:finish, :embed], :export
can [:index, :rss, :show], DiaryEntry
can :index, DiaryComment
can [:index], Note
- can [:new, :create, :update], :password
+ can [:create, :update], :password
can [:index, :show], Redaction
- can [:new, :create, :destroy], :session
+ can [:create, :destroy], :session
can [:index, :show, :data, :georss], Trace
- can [:terms, :new, :create, :save, :suspended, :show, :auth_success, :auth_failure], User
+ can [:terms, :create, :save, :suspended, :show, :auth_success, :auth_failure], User
can [:index, :show, :blocks_on, :blocks_by], UserBlock
end
if Settings.status != "database_offline"
can [:subscribe, :unsubscribe], Changeset
- can [:index, :new, :create, :show, :update, :destroy], :oauth2_application
+ can [:index, :create, :show, :update, :destroy], :oauth2_application
can [:index, :destroy], :oauth2_authorized_application
- can [:new, :show, :create, :destroy], :oauth2_authorization
+ can [:show, :create, :destroy], :oauth2_authorization
can [:update, :destroy], :account
can [:show], :dashboard
- can [:new, :create, :subscribe, :unsubscribe], DiaryEntry
+ can [:create, :subscribe, :unsubscribe], DiaryEntry
can :update, DiaryEntry, :user => user
can [:create], DiaryComment
can [:make_friend, :remove_friend], Friendship
- can [:new, :create, :reply, :show, :inbox, :outbox, :muted, :mark, :unmute, :destroy], Message
+ can [:create, :reply, :show, :inbox, :outbox, :muted, :mark, :unmute, :destroy], Message
can [:close, :reopen], Note
can [:show, :update], :preference
can :update, :profile
- can [:new, :create], Report
- can [:mine, :new, :create, :update, :destroy], Trace
+ can :create, Report
+ can [:mine, :create, :update, :destroy], Trace
can [:account, :go_public], User
can [:index, :create, :destroy], UserMute
can [:hide, :unhide], [DiaryEntry, DiaryComment]
can [:index, :show, :resolve, :ignore, :reopen], Issue
can :create, IssueComment
- can [:new, :create, :update, :destroy], Redaction
- can [:new, :create, :revoke_all], UserBlock
+ can [:create, :update, :destroy], Redaction
+ can [:create, :revoke_all], UserBlock
can :update, UserBlock, :creator => user
can :update, UserBlock, :revoker => user
can :update, UserBlock, :active? => true
@show_user_name = true
@show_creator_name = true
- render :partial => "blocks" if turbo_frame_request_id == "pagination"
+ render :partial => "page" if turbo_frame_request_id == "pagination"
end
def show
@show_user_name = false
@show_creator_name = true
- render :partial => "blocks" if turbo_frame_request_id == "pagination"
+ render :partial => "page" if turbo_frame_request_id == "pagination"
end
##
@show_user_name = true
@show_creator_name = false
- render :partial => "blocks" if turbo_frame_request_id == "pagination"
+ render :partial => "page" if turbo_frame_request_id == "pagination"
end
private
users = users.where(:status => @params[:status]) if @params[:status]
users = users.where(:creation_ip => @params[:ip]) if @params[:ip]
- @users_count = users.count
+ @users_count = users.limit(501).count
+ @users_count = I18n.t("count.at_least_pattern", :count => 500) if @users_count > 500
+
@users, @newer_users_id, @older_users_id = get_page_items(users, :limit => 50)
render :partial => "page" if turbo_frame_request_id == "pagination"
</div>
<% end -%>
<% elsif params[:bbox] %>
- <p class="mx-3"><%= t(params[:max_id] ? ".no_more_area" : ".empty_area") %></p>
+ <p class="mx-3"><%= params[:max_id] ? t(".no_more_area") : t(".empty_area") %></p>
<% elsif params[:display_name] %>
- <p class="mx-3"><%= t(params[:max_id] ? ".no_more_user" : ".empty_user") %></p>
+ <p class="mx-3"><%= params[:max_id] ? t(".no_more_user") : t(".empty_user") %></p>
<% else %>
- <p class="mx-3"><%= t(params[:max_id] ? ".no_more" : ".empty") %></p>
+ <p class="mx-3"><%= params[:max_id] ? t(".no_more") : t(".empty") %></p>
<% end %>
<% else %>
<p><%= t ".empty" %></p>
<% end %>
+
+<% if can?(:create, Redaction) %>
+ <div>
+ <%= link_to t(".new"), new_redaction_path, :class => "btn btn-outline-primary" %>
+ </div>
+<% end %>
<%= link_to t(".edit"), edit_redaction_path(@redaction), :class => "btn btn-outline-primary" %>
<% end %>
<% if can?(:destroy, Redaction) %>
- <%= link_to t(".destroy"), @redaction, :method => "delete", :class => "btn btn-outline-danger", :remote => true, :data => { :confirm => t(".confirm") } %>
+ <%= link_to t(".destroy"), @redaction, :class => "btn btn-outline-danger", :data => { :turbo => true, :turbo_method => "DELETE", :turbo_confirm => t(".confirm") } %>
<% end %>
</div>
<% end %>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks" %>
+<%= render :partial => "page" %>
<% else %>
<p><%= t ".empty", :name => @user.display_name %></p>
<% end %>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks" %>
+<%= render :partial => "page" %>
<% else %>
<p><%= t ".empty", :name => @user.display_name %></p>
<% end %>
<% end %>
<% unless @user_blocks.empty? %>
-<%= render :partial => "blocks" %>
+<%= render :partial => "page" %>
<% else %>
<p><%= t ".empty" %></p>
<% end %>
doesnt_have_role: "The user does not have role %{role}."
not_revoke_admin_current_user: "Cannot revoke administrator role from current user."
grant:
- title: Confirm role granting
- heading: Confirm role granting
are_you_sure: "Are you sure you want to grant the role `%{role}' to the user `%{name}'?"
- confirm: "Confirm"
revoke:
- title: Confirm role revoking
- heading: Confirm role revoking
are_you_sure: "Are you sure you want to revoke the role `%{role}' from the user `%{name}'?"
- confirm: "Confirm"
user_blocks:
model:
non_moderator_update: "Must be a moderator to create or update a block."
not_revoked: "(not revoked)"
show: "Show"
edit: "Edit"
- blocks:
+ page:
display_name: "Blocked User"
creator_name: "Creator"
reason: "Reason for block"
empty: "No redactions to show."
heading: "List of Redactions"
title: "List of Redactions"
+ new: "New Redaction"
new:
heading: "Enter Information for New Redaction"
title: "Creating New Redaction"
# create an empty redaction
redaction = create(:redaction)
- delete redaction_path(:id => redaction)
+ delete redaction_path(redaction)
assert_redirected_to(redactions_path)
end
redaction = create(:redaction)
create(:old_node, :redaction => redaction)
- delete redaction_path(:id => redaction)
+ delete redaction_path(redaction)
assert_redirected_to(redaction_path(redaction))
assert_match(/^Redaction is not empty/, flash[:error])
end
def test_delete_non_moderator
session_for(create(:user))
- delete redaction_path(:id => create(:redaction))
+ delete redaction_path(create(:redaction))
assert_redirected_to :controller => "errors", :action => "forbidden"
end
def test_edit
redaction = create(:redaction)
- get edit_redaction_path(:id => redaction)
+ get edit_redaction_path(redaction)
assert_redirected_to login_path(:referer => edit_redaction_path(redaction))
end
def test_edit_moderator
session_for(create(:moderator_user))
- get edit_redaction_path(:id => create(:redaction))
+ get edit_redaction_path(create(:redaction))
assert_response :success
end
def test_edit_non_moderator
session_for(create(:user))
- get edit_redaction_path(:id => create(:redaction))
+ get edit_redaction_path(create(:redaction))
assert_redirected_to :controller => "errors", :action => "forbidden"
end
redaction = create(:redaction)
- put redaction_path(:id => redaction, :redaction => { :title => "Foo", :description => "Description here." })
+ put redaction_path(redaction, :redaction => { :title => "Foo", :description => "Description here." })
assert_redirected_to(redaction_path(redaction))
end
redaction = create(:redaction)
- put redaction_path(:id => redaction, :redaction => { :title => "Foo", :description => "" })
+ put redaction_path(redaction, :redaction => { :title => "Foo", :description => "" })
assert_response :success
assert_template :edit
end
redaction = create(:redaction)
- put redaction_path(:id => redaction, :redaction => { :title => "Foo", :description => "Description here." })
+ put redaction_path(redaction, :redaction => { :title => "Foo", :description => "Description here." })
assert_redirected_to :controller => "errors", :action => "forbidden"
end
end
--- /dev/null
+require "application_system_test_case"
+
+class RedactionDestroyTest < ApplicationSystemTestCase
+ test "fails to delete nonempty redaction" do
+ redaction = create(:redaction, :title => "Some-unwanted-data-redaction")
+ create(:old_node, :redaction => redaction)
+
+ sign_in_as create(:moderator_user)
+ visit redaction_path(redaction)
+ assert_text "Some-unwanted-data-redaction"
+
+ accept_alert do
+ click_on "Remove this redaction"
+ end
+ assert_text "Redaction is not empty"
+ assert_text "Some-unwanted-data-redaction"
+ end
+
+ test "deletes empty redaction" do
+ redaction = create(:redaction, :title => "No-unwanted-data-redaction")
+
+ sign_in_as create(:moderator_user)
+ visit redaction_path(redaction)
+ assert_text "No-unwanted-data-redaction"
+
+ accept_alert do
+ click_on "Remove this redaction"
+ end
+ assert_text "Redaction destroyed"
+ assert_text "List of Redactions"
+ assert_no_text "No-unwanted-data-redaction"
+ end
+end