-
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/admin-rules-report
- Loading branch information
Showing
66 changed files
with
1,198 additions
and
302 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
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,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
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,9 @@ | ||
class PostInterestNotificationJob < ApplicationJob | ||
queue_as :default | ||
|
||
def perform(comment) | ||
post = comment.post | ||
users = post.comments.map(&:user).uniq.excluding(comment.user, post.user) | ||
users.each { |user| Notification.create!(profile: user.profile, notifiable: comment) } | ||
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,13 @@ | ||
class InvitationRequestInfo | ||
attr_accessor :id, :status, :created_at, :project_title, :project_description, :project_category, :project_id | ||
|
||
def initialize(invitation_request:, project:) | ||
@id = invitation_request.id | ||
@status = invitation_request.status | ||
@created_at = invitation_request.created_at | ||
@project_id = project.id | ||
@project_title = project.title | ||
@project_description = project.description | ||
@project_category = project.category | ||
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
class Notification < ApplicationRecord | ||
belongs_to :profile | ||
belongs_to :notifiable, polymorphic: true | ||
|
||
enum status: { unseen: 0, seen: 5, clicked: 10 } | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class Project | ||
attr_accessor :id, :title, :description, :category | ||
|
||
def initialize(id:, title:, description:, category:) | ||
@id = id | ||
@title = title | ||
@description = description | ||
@category = category | ||
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.