Add Users::RegistrationPolicy#update?
This commit is contained in:
parent
d91def8c34
commit
f7e1c85791
3 changed files with 20 additions and 4 deletions
7
app/policies/users/registration_policy.rb
Normal file
7
app/policies/users/registration_policy.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Users::RegistrationPolicy < ApplicationPolicy
|
||||||
|
def update?
|
||||||
|
!account&.user.nil?
|
||||||
|
end
|
||||||
|
end
|
|
@ -6,10 +6,12 @@
|
||||||
"#{:active if tab == :profile}" %>
|
"#{:active if tab == :profile}" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if policy(%i[users registration]).edit? %>
|
||||||
<%= link_to translate(:credentials, scope: %i[nav_tabs settings]),
|
<%= link_to translate(:credentials, scope: %i[nav_tabs settings]),
|
||||||
edit_user_registration_path,
|
edit_user_registration_path,
|
||||||
class: 'list-group-item list-group-item-action ' \
|
class: 'list-group-item list-group-item-action ' \
|
||||||
"#{:active if tab == :credentials}" %>
|
"#{:active if tab == :credentials}" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if policy(%i[settings account_telegram_contact]).index? %>
|
<% if policy(%i[settings account_telegram_contact]).index? %>
|
||||||
<%= link_to translate(:telegram_contacts, scope: %i[nav_tabs settings]),
|
<%= link_to translate(:telegram_contacts, scope: %i[nav_tabs settings]),
|
||||||
|
|
7
spec/policies/users/registration_policy_spec.rb
Normal file
7
spec/policies/users/registration_policy_spec.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe Users::RegistrationPolicy do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Reference in a new issue