-
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 fix/traducoes
- Loading branch information
Showing
55 changed files
with
600 additions
and
153 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
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
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,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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
<p><%= I18n.t('notifications.new_follower_mail', follower_name: @notification.notifiable.follower.full_name) %></p> | ||
<p><%= @notification.notifiable.follower.full_name %> <%= t('notifications.started_following_you') %></p> |
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 +1,11 @@ | ||
<p><%= link_to notification.notifiable.user.full_name, profile_path(notification.notifiable.user.profile) %> comentou em sua publicação | ||
<% if notification.notifiable.post.user == current_user %> | ||
<%= notification.notifiable.user.full_name %> | ||
<%= t('notifications.commented_on_your_post') %> | ||
<%= notification.notifiable.post.title %> | ||
<% else %> | ||
<%= notification.notifiable.user.full_name %> | ||
<%= t('notifications.commented_on_post') %> | ||
<%= link_to notification.notifiable.post.title, | ||
post_path(notification.notifiable.post, | ||
anchor: "comment_#{notification.notifiable.id}") %> | ||
<% 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 +1 @@ | ||
<p><%= link_to notification.notifiable.follower.user.full_name, profile_path(notification.notifiable.follower) %> começou a te seguir | ||
<%= notification.notifiable.follower.full_name %> <%= t('notifications.started_following_you') %> |
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 +1 @@ | ||
<p>Você recebeu um convite para <%= link_to notification.notifiable.project_title, invitation_path(notification.notifiable) %> | ||
<%= t('notifications.new_invitation_to') %> <%= notification.notifiable.project_title %> |
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,5 +1,5 @@ | ||
<% if notification.notifiable.likeable.is_a?Post %> | ||
<p><%= link_to notification.notifiable.user.full_name, profile_path(notification.notifiable.user.profile) %> curtiu sua publicação | ||
<%= notification.notifiable.user.full_name %> <%= t('notifications.liked_your_post') %> | ||
<% else %> | ||
<p><%= link_to notification.notifiable.user.full_name, profile_path(notification.notifiable.user.profile) %> curtiu seu comentário | ||
<%= notification.notifiable.user.full_name %> <%= t('notifications.liked_your_comment') %> | ||
<% 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 +1 @@ | ||
<p><%= notification.notifiable.user.full_name %> fez uma <%= link_to 'publicação', post_path(notification.notifiable) %> | ||
<%= notification.notifiable.user.full_name %> <%= t('notifications.published_a_new_post') %> |
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,16 +1,18 @@ | ||
<div class="container d-flex flex-column align-items-center"> | ||
<h2>Notificações</h2> | ||
<% if @notifications&.any? %> | ||
<h2><%= Notification.model_name.human(count: 2) %></h2> | ||
<% if @notifications.any? %> | ||
<ul class="list-group list-group-action"> | ||
<% @notifications.each do |notification| %> | ||
<div class="list-group"> | ||
<%= render( | ||
partial: "#{notification.notifiable.class.name.downcase}" , | ||
locals: { notification: notification } | ||
)%> | ||
há <%= distance_of_time_in_words_to_now(notification.notifiable.created_at) %></p> | ||
</div> | ||
<li class="list-group-item <%= 'list-group-item-primary' if notification.seen? %> "> | ||
<%= button_to notification_path(notification), method: :patch, class: 'btn btn-link' do %> | ||
<%= render( partial: "#{notification.notifiable.class.name.downcase}", | ||
locals: { notification: notification } ) %> | ||
<%= t('notifications.time_ago', time: time_ago_in_words(notification.notifiable.created_at)) %> | ||
<% end %> | ||
</li> | ||
<% end %> | ||
</ul> | ||
<% else %> | ||
<p>Nenhuma notificação encontrada</p> | ||
<p><%= t('notifications.no_notification') %></p> | ||
<% end %> | ||
</div> | ||
</div> |
Oops, something went wrong.