Commit 36d48120 authored by Felipe Artur's avatar Felipe Artur

merge master into issue_3359_3

parents 2674b548 92e18354
Please view this file on the master branch, on stable branches it's out of date. Please view this file on the master branch, on stable branches it's out of date.
v 8.10(unreleased) v 8.10.0(unreleased)
- Add notifications dropdown for groups - Add notifications dropdown for groups
v 8.9.0 (unreleased) v 8.9.0 (unreleased)
......
...@@ -85,6 +85,7 @@ class Dispatcher ...@@ -85,6 +85,7 @@ class Dispatcher
when 'groups:show' when 'groups:show'
shortcut_handler = new ShortcutsNavigation() shortcut_handler = new ShortcutsNavigation()
new NotificationsForm() new NotificationsForm()
new NotificationsDropdown()
when 'groups:group_members:index' when 'groups:group_members:index'
new GroupMembers() new GroupMembers()
new UsersSelect() new UsersSelect()
......
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
margin: 0; margin: 0;
font-size: 24px; font-size: 24px;
font-weight: normal; font-weight: normal;
margin-bottom: 5px; margin-bottom: 10px;
color: #4c4e54; color: #4c4e54;
font-size: 23px; font-size: 23px;
line-height: 1.1; line-height: 1.1;
......
...@@ -48,11 +48,7 @@ ...@@ -48,11 +48,7 @@
.access-request-button { .access-request-button {
@include btn-gray; @include btn-gray;
position: absolute; margin-right: 10px;
right: 16px;
bottom: 32px;
padding: 3px 10px;
text-transform: none; text-transform: none;
background-color: $background-color;
} }
} }
...@@ -74,6 +74,10 @@ class GroupsController < Groups::ApplicationController ...@@ -74,6 +74,10 @@ class GroupsController < Groups::ApplicationController
def edit def edit
end end
def projects
@projects = @group.projects.page(params[:page])
end
def update def update
if Groups::UpdateService.new(@group, current_user, group_params).execute if Groups::UpdateService.new(@group, current_user, group_params).execute
redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated." redirect_to edit_group_path(@group), notice: "Group '#{@group.name}' was successfully updated."
...@@ -100,10 +104,6 @@ class GroupsController < Groups::ApplicationController ...@@ -100,10 +104,6 @@ class GroupsController < Groups::ApplicationController
@shared_projects = GroupProjectsFinder.new(group, only_shared: true).execute(current_user) @shared_projects = GroupProjectsFinder.new(group, only_shared: true).execute(current_user)
end end
def projects
@projects = @group.projects.page(params[:page])
end
def authorize_create_group! def authorize_create_group!
unless can?(current_user, :create_group, nil) unless can?(current_user, :create_group, nil)
return render_404 return render_404
......
...@@ -2,8 +2,6 @@ class NotificationSettingsController < ApplicationController ...@@ -2,8 +2,6 @@ class NotificationSettingsController < ApplicationController
before_action :authenticate_user! before_action :authenticate_user!
def create def create
resource = find_resource
return render_404 unless can_read?(resource) return render_404 unless can_read?(resource)
@notification_setting = current_user.notification_settings_for(resource) @notification_setting = current_user.notification_settings_for(resource)
...@@ -21,12 +19,12 @@ class NotificationSettingsController < ApplicationController ...@@ -21,12 +19,12 @@ class NotificationSettingsController < ApplicationController
private private
def find_resource def resource
resource = @resource ||=
if params[:project].present? if params[:project_id].present?
Project.find(params[:project][:id]) Project.find(params[:project_id])
elsif params[:namespace].present? elsif params[:namespace_id].present?
Group.find(params[:namespace][:id]) Group.find(params[:namespace_id])
end end
end end
......
...@@ -72,6 +72,6 @@ module NotificationsHelper ...@@ -72,6 +72,6 @@ module NotificationsHelper
# Create hidden field to send notification setting source to controller # Create hidden field to send notification setting source to controller
def hidden_setting_source_input(notification_setting) def hidden_setting_source_input(notification_setting)
return unless notification_setting.source_type return unless notification_setting.source_type
hidden_field_tag "#{notification_setting.source_type.downcase}[id]", notification_setting.source_id hidden_field_tag "#{notification_setting.source_type.downcase}_id", notification_setting.source_id
end end
end end
...@@ -15,14 +15,17 @@ ...@@ -15,14 +15,17 @@
%span.visibility-icon.has-tooltip{ data: { container: 'body' }, title: visibility_icon_description(@group) } %span.visibility-icon.has-tooltip{ data: { container: 'body' }, title: visibility_icon_description(@group) }
= visibility_level_icon(@group.visibility_level, fw: false) = visibility_level_icon(@group.visibility_level, fw: false)
= render 'notifications/buttons/notifications', notification_setting: @notification_setting %span.hidden-xs
= render 'shared/notifications/button', notification_setting: @notification_setting
- if current_user
.pull-right
= render 'shared/members/access_request_buttons', source: @group
- if @group.description.present? - if @group.description.present?
.cover-desc.description .cover-desc.description
= markdown(@group.description, pipeline: :description) = markdown(@group.description, pipeline: :description)
- if current_user
= render 'shared/members/access_request_buttons', source: @group
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area
......
...@@ -37,12 +37,14 @@ This means that you can set a different level of notifications per group while s ...@@ -37,12 +37,14 @@ This means that you can set a different level of notifications per group while s
to have a finer level setting per project. to have a finer level setting per project.
Organization like this is suitable for users that belong to different groups but don't have the Organization like this is suitable for users that belong to different groups but don't have the
same need for being notified for every group they are member of. same need for being notified for every group they are member of.
These settings can be configured on group page or user profile notifications dropdown.
#### Project Settings #### Project Settings
Project Settings are at the top level and any setting placed at this level will take precedence of any Project Settings are at the top level and any setting placed at this level will take precedence of any
other setting. other setting.
This is suitable for users that have different needs for notifications per project basis. This is suitable for users that have different needs for notifications per project basis.
These settings can be configured on project page or user profile notifications dropdown.
## Notification events ## Notification events
......
...@@ -13,7 +13,7 @@ describe NotificationSettingsController do ...@@ -13,7 +13,7 @@ describe NotificationSettingsController do
context 'when not authorized' do context 'when not authorized' do
it 'redirects to sign in page' do it 'redirects to sign in page' do
post :create, post :create,
project: { id: project.id }, project_id: project.id,
notification_setting: { level: :participating } notification_setting: { level: :participating }
expect(response).to redirect_to(new_user_session_path) expect(response).to redirect_to(new_user_session_path)
...@@ -40,7 +40,7 @@ describe NotificationSettingsController do ...@@ -40,7 +40,7 @@ describe NotificationSettingsController do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
project: { id: project.id }, project_id: project.id,
notification_setting: { level: :participating } notification_setting: { level: :participating }
expect(response.status).to eq 200 expect(response.status).to eq 200
...@@ -53,7 +53,7 @@ describe NotificationSettingsController do ...@@ -53,7 +53,7 @@ describe NotificationSettingsController do
context 'with custom settings' do context 'with custom settings' do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
project: { id: project.id }, project_id: project.id,
notification_setting: { level: :custom }.merge(custom_events) notification_setting: { level: :custom }.merge(custom_events)
expect(response.status).to eq 200 expect(response.status).to eq 200
...@@ -68,7 +68,7 @@ describe NotificationSettingsController do ...@@ -68,7 +68,7 @@ describe NotificationSettingsController do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
namespace: { id: group.id }, namespace_id: group.id,
notification_setting: { level: :watch } notification_setting: { level: :watch }
expect(response.status).to eq 200 expect(response.status).to eq 200
...@@ -81,7 +81,7 @@ describe NotificationSettingsController do ...@@ -81,7 +81,7 @@ describe NotificationSettingsController do
context 'with custom settings' do context 'with custom settings' do
it 'creates notification setting' do it 'creates notification setting' do
post :create, post :create,
namespace: { id: group.id }, namespace_id: group.id,
notification_setting: { level: :custom }.merge(custom_events) notification_setting: { level: :custom }.merge(custom_events)
expect(response.status).to eq 200 expect(response.status).to eq 200
...@@ -98,7 +98,7 @@ describe NotificationSettingsController do ...@@ -98,7 +98,7 @@ describe NotificationSettingsController do
it 'returns 404' do it 'returns 404' do
post :create, post :create,
project: { id: private_project.id }, project_id: private_project.id,
notification_setting: { level: :participating } notification_setting: { level: :participating }
expect(response.status).to eq(404) expect(response.status).to eq(404)
......
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