-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/super-seed
- Loading branch information
Showing
110 changed files
with
2,521 additions
and
377 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,12 @@ | ||
module Comments | ||
class LikesController < LikesController | ||
before_action :set_likeable | ||
|
||
private | ||
|
||
def set_likeable | ||
@likeable = Comment.find(params[:comment_id]) | ||
@post = @likeable.post | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class InvitationRequestsController < ApplicationController | ||
before_action :authenticate_user!, only: %i[index] | ||
|
||
def index | ||
invitation_requests = current_user.invitation_requests | ||
@error = false | ||
@invitation_request_infos = [] | ||
|
||
begin | ||
@invitation_request_infos = InvitationRequestService::InvitationRequest.send(invitation_requests) | ||
rescue StandardError | ||
return @error = true | ||
end | ||
|
||
return @invitation_request_infos if params[:filter].blank? | ||
|
||
@invitation_request_infos.filter! { |request| request.status == params[:filter] } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module Posts | ||
class LikesController < LikesController | ||
before_action :set_likeable | ||
|
||
private | ||
|
||
def set_likeable | ||
@likeable = Post.find(params[:post_id]) | ||
@post = @likeable | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
class SettingsController < ApplicationController | ||
before_action :authenticate_user! | ||
before_action :redirect_unauthorized_access, only: %i[index] | ||
|
||
def index; end | ||
|
||
def deactivate_profile | ||
current_user.profile.inactive! | ||
sign_out current_user | ||
redirect_to root_path, alert: t('deactivate_profile') | ||
end | ||
|
||
def delete_account | ||
current_user.delete_user_data | ||
redirect_to root_path, notice: t('delete_account') | ||
end | ||
|
||
def change_privacy | ||
@profile = current_user.profile | ||
if @profile.public_profile? | ||
@profile.private_profile! | ||
else | ||
@profile.public_profile! | ||
end | ||
redirect_to profile_settings_path(@profile), notice: t('.success') | ||
end | ||
|
||
def work_unavailable | ||
@profile = current_user.profile | ||
@profile.unavailable! | ||
redirect_to profile_settings_path(@profile), notice: t('.success') | ||
end | ||
|
||
def open_to_work | ||
@profile = current_user.profile | ||
@profile.open_to_work! | ||
redirect_to profile_settings_path(@profile), notice: t('.success') | ||
end | ||
|
||
private | ||
|
||
def redirect_unauthorized_access | ||
@profile = Profile.find(params[:profile_id]) | ||
return if current_user == @profile.user | ||
|
||
redirect_to root_path, alert: t('alerts.unauthorized') | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module InvitationRequestsHelper | ||
def css_color_class(status) | ||
class_hash = { processing: 'text-secondary', | ||
pending: 'text-info', | ||
accepted: 'text-success', | ||
refused: 'text-danger', | ||
error: 'text-warning', | ||
aborted: 'text-danger-emphasis' } | ||
class_hash[status] || '' | ||
end | ||
|
||
def invitation_request_filter_options | ||
InvitationRequest.statuses.keys.map do |status| | ||
[InvitationRequest.human_attribute_name("status.#{status}"), status] | ||
end | ||
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
Oops, something went wrong.