Find correct group membership.

This commit is contained in:
Douwe Maan 2015-10-18 12:19:30 +02:00
parent 5c4bb6df0d
commit 99b8568ff7
2 changed files with 6 additions and 8 deletions

View file

@ -87,8 +87,7 @@ class ProjectsController < ApplicationController
render 'projects/empty' render 'projects/empty'
else else
if current_user if current_user
@membership = @project.project_member_by_id(current_user.id) @membership = @project.team.find_member(current_user.id)
@group_member = GroupMember.find_by(user_id: current_user.id)
end end
render :show render :show

View file

@ -1,6 +1,5 @@
- return unless [@membership, @group_member].any? - case @membership
- when ProjectMember
- if @membership
= form_tag profile_notifications_path, method: :put, remote: true, class: 'inline', id: 'notification-form' do = form_tag profile_notifications_path, method: :put, remote: true, class: 'inline', id: 'notification-form' do
= hidden_field_tag :notification_type, 'project' = hidden_field_tag :notification_type, 'project'
= hidden_field_tag :notification_id, @membership.id = hidden_field_tag :notification_id, @membership.id
@ -14,8 +13,8 @@
- Notification.project_notification_levels.each do |level| - Notification.project_notification_levels.each do |level|
= notification_list_item(level, @membership) = notification_list_item(level, @membership)
- elsif @group_member - when GroupMember
.btn.btn-new.disabled#notifications-button .btn.btn-new.disabled
= icon('bell') = icon('bell')
= notification_label(@group_member) = notification_label(@membership)
= icon('angle-down') = icon('angle-down')