-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Feature: Enable setting up Project visibility and Requesting acce…
…ss to a project (#595) * Adding ability to setup project visibility on project creation, ability for user to request access or cancel request, ability for admins to accept/reject access requests Signed-off-by: Vanessa Fotso <[email protected]> * Notifications: Slack notification and SMTP Enhancement (#594) * Enable users with permissions to set up private slack channel for their projects/components and enable each user to set up direct slack notifications Signed-off-by: Vanessa Fotso <[email protected]> * Switch notifying users about error delivering slack notifications to logging the errors in the app logs Signed-off-by: Vanessa Fotso <[email protected]> * optimize user_mailer and associated views code Signed-off-by: Vanessa Fotso <[email protected]> * optimized the smtp notification workflow and updated to also notify users when membership updated or revoked Signed-off-by: Vanessa Fotso <[email protected]> * Refactored the slack workflow and updated to cover the review use case Signed-off-by: Vanessa Fotso <[email protected]> * Only project/component admins should be able to add/edit slackchannels Signed-off-by: Vanessa Fotso <[email protected]> * logic to determine which slack channel(s) should be notified Signed-off-by: Vanessa Fotso <[email protected]> * Setting default url for action mailer Signed-off-by: Vanessa Fotso <[email protected]> --------- Signed-off-by: Vanessa Fotso <[email protected]> * SMTP notifications when access request denied Signed-off-by: Vanessa Fotso <[email protected]> * changed position of sortable icon Signed-off-by: Vanessa Fotso <[email protected]> * Enabled smtp notification when requesting access to project Signed-off-by: Vanessa Fotso <[email protected]> * Enable admins to update project's visibility, send slack notification for visibility changed, use badge to convey info Signed-off-by: Vanessa Fotso <[email protected]> * Adding filter to display only discoverable projects on the list Signed-off-by: Vanessa Fotso <[email protected]> * Project access request spec Signed-off-by: Vanessa Fotso <[email protected]> * fixing spec Signed-off-by: Vanessa Fotso <[email protected]> * Updated project's page filter and added request notification Signed-off-by: Vanessa Fotso <[email protected]> * fix bug from merge Signed-off-by: Vanessa Fotso <[email protected]> * Fix the filter for Show my projects to show all projects I am a member of regardless of wether it is discoverable or not Signed-off-by: Vanessa Fotso <[email protected]> * Temp fix for new chrome update Signed-off-by: Vanessa Fotso <[email protected]> --------- Signed-off-by: Vanessa Fotso <[email protected]>
- Loading branch information
1 parent
1043403
commit a3c1abe
Showing
29 changed files
with
687 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
|
||
## | ||
# Controller for managing request to access a specific project. | ||
# | ||
class ProjectAccessRequestsController < ApplicationController | ||
def create | ||
@project = Project.find(params[:project_id]) | ||
@access_request = ProjectAccessRequest.new(user: current_user, project: @project) | ||
|
||
if @access_request.save | ||
flash.notice = 'Your request for access has been sent.' | ||
if Settings.smtp.enabled | ||
send_smtp_notification(UserMailer, 'request_access', @access_request.user, @access_request.project) | ||
end | ||
else | ||
flash.alert = @access_request.errors.full_messages.to_sentence | ||
end | ||
redirect_to root_path | ||
end | ||
|
||
def destroy | ||
@access_request = ProjectAccessRequest.find(params[:id]) | ||
if @access_request.destroy | ||
if current_user.can_admin_project?(@access_request.project) | ||
if Settings.smtp.enabled | ||
send_smtp_notification(UserMailer, 'reject_access', @access_request.user, @access_request.project) | ||
end | ||
flash.notice = "Sucessfully denied #{@access_request.user.name}'s request to access project." | ||
else | ||
flash.notice = "Your request to access #{@access_request.project.name} has been cancelled." | ||
end | ||
else | ||
flash.alert = @access_request.errors.full_messages.to_sentence | ||
end | ||
|
||
redirect_back(fallback_location: root_path) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.