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
else
if current_user
@membership = @project.project_member_by_id(current_user.id)
@group_member = GroupMember.find_by(user_id: current_user.id)
end
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
= form_tag profile_notifications_path, method: :put, remote: true, class: 'inline-form', id: 'notification-form' do
= hidden_field_tag :notification_type, 'project'
= hidden_field_tag :notification_id, @membership.id
= hidden_field_tag :notification_level
......@@ -12,3 +13,9 @@
%ul.dropdown-menu.dropdown-menu-right.project-home-dropdown
- 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