Commit b8f5e742 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Show notifications button even if user is not member of a project

Notifications button was unavailable if user wasn't member of the
project, even if protected project is available via group privileges.

Showing disabled button with explanation tool-tip is less confusing.

This closes #2846.
parent 5ffbf5fe
...@@ -88,6 +88,7 @@ class ProjectsController < ApplicationController ...@@ -88,6 +88,7 @@ class ProjectsController < ApplicationController
else else
if current_user if current_user
@membership = @project.project_member_by_id(current_user.id) @membership = @project.project_member_by_id(current_user.id)
@group_member = GroupMember.find_by(user_id: current_user.id)
end end
render :show render :show
......
- return unless @membership - return unless [@membership, @group_member].any?
= form_tag profile_notifications_path, method: :put, remote: true, class: 'inline-form', id: 'notification-form' do - if @membership
= hidden_field_tag :notification_type, 'project' = form_tag profile_notifications_path, method: :put, remote: true, class: 'inline-form', id: 'notification-form' do
= hidden_field_tag :notification_id, @membership.id = hidden_field_tag :notification_type, 'project'
= hidden_field_tag :notification_level = hidden_field_tag :notification_id, @membership.id
%span.dropdown = hidden_field_tag :notification_level
%a.dropdown-new.btn.btn-new#notifications-button{href: '#', "data-toggle" => "dropdown"} %span.dropdown
= icon('bell') %a.dropdown-new.btn.btn-new#notifications-button{href: '#', "data-toggle" => "dropdown"}
= notification_label(@membership) = icon('bell')
= icon('angle-down') = notification_label(@membership)
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown = icon('angle-down')
- Notification.project_notification_levels.each do |level| %ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
= notification_list_item(level, @membership) - Notification.project_notification_levels.each do |level|
= notification_list_item(level, @membership)
- elsif @group_member
.btn.btn-new.disabled#notifications-button
= icon('bell')
= notification_label(@group_member)
= icon('angle-down')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment