Skip to content

Commit

Permalink
Fixes #25656 - Foreman redirects to logout page
Browse files Browse the repository at this point in the history
  • Loading branch information
glekner authored and ohadlevy committed May 2, 2019
1 parent 5579da3 commit ef73d68
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/registries/menu/item.rb
Expand Up @@ -23,7 +23,7 @@ def initialize(name, options)
end

def to_hash
{type: :item, name: @caption || @name, url: url} if authorized?
{type: :item, html_options: @html_options, name: @caption || @name, url: url} if authorized?
end

def url
Expand Down
2 changes: 1 addition & 1 deletion app/registries/menu/loader.rb
Expand Up @@ -16,7 +16,7 @@ def self.load
:url_hash => {:controller => '/users', :action => 'edit', :id => Proc.new { User.current.id }}
menu.item :logout,
:caption => N_('Log Out'),
:html => {:method => :post},
:html => {:'data-method' => :post},
:url_hash => {:controller => '/users', :action => 'logout'}
end
end
Expand Down
8 changes: 4 additions & 4 deletions test/unit/menu_manager_test.rb
Expand Up @@ -51,13 +51,13 @@ def menu_hash
:name => "User",
:icon => "fa-icon",
:children =>
[{:type => :item, :name => "Item", :url => "some url"},
{:type => :item, :name => "Item 2", :url => "some url"},
{:type => :item, :name => "Test Items", :url => "some url"}]},
[{:type => :item, :html_options => {}, :name => "Item", :url => "some url"},
{:type => :item, :html_options => {}, :name => "Item 2", :url => "some url"},
{:type => :item, :html_options => {}, :name => "Test Items", :url => "some url"}]},
{:type => :sub_menu,
:name => "User",
:icon => "fa-icon",
:children => [{:type => :item, :name => "Item 3", :url => "some url"}]}]
:children => [{:type => :item, :html_options => {}, :name => "Item 3", :url => "some url"}]}]
end

def create_nested_menu
Expand Down
Expand Up @@ -42,6 +42,7 @@ const UserDropdowns = ({
onClick={() => {
changeActiveMenu({ title: 'User' });
}}
{...item.html_options}
>
{__(item.name)}
</MenuItem>
Expand Down

0 comments on commit ef73d68

Please sign in to comment.