-
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 refact/likes-controller
Co-authored-by: Paulo Henrique Meneses <[email protected]>
- Loading branch information
Showing
20 changed files
with
267 additions
and
82 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,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
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,39 +1,35 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<section> | ||
<h2 class="text-center">Convite</h2> | ||
<h2 class="text-center">Convite</h2> | ||
|
||
<div class="col-md-6 offset-md-3"> | ||
<div class="card shadow rounded"> | ||
<div class="card-body"> | ||
<h4 class="text-break text-primary"><%= @invitation.project_title %></h4> | ||
<div class="col-md-6 offset-md-3"> | ||
<div class="card shadow rounded"> | ||
<div class="card-body"> | ||
<h4 class="text-break text-primary"><%= @invitation.project_title %></h4> | ||
|
||
<p class="card-text"><%= @invitation.project_description %></p> | ||
<p class="card-subtitle mb-2 text-muted">Categoria: <%= @invitation.project_category %></p> | ||
<% if @invitation.message.present? %> | ||
<p class="card-subtitle mb-2 text-muted">Mensagem: <%= @invitation.message %></p> | ||
<% end %> | ||
<% if @invitation.expiration_date.present? %> | ||
<p class="card-subtitle mb-2 text-muted">Expira dia: <%= I18n.l(@invitation.expiration_date) %></p> | ||
<% end %> | ||
<p class="card-text"><%= @invitation.project_description %></p> | ||
<p class="card-subtitle mb-2 text-muted">Categoria: <%= @invitation.project_category %></p> | ||
|
||
<% if @invitation.pending? %> | ||
<p class="card-subtitle mb-2 text-muted">Expira dia: <%= I18n.l(@invitation.expiration_date) %></p> | ||
|
||
<div class="btn-group"> | ||
<div> | ||
<%= link_to 'Aceitar', 'http://localhost:4000', method: :patch, class: 'btn btn-primary me-4' %> | ||
</div> | ||
<div> | ||
<%= button_to 'Recusar', decline_invitation_path(@invitation), method: :patch, class: 'btn btn-secondary' %> | ||
</div> | ||
</div> | ||
|
||
<p class="card-subtitle mb-2 text-muted">Mensagem: <%= @invitation.message %></p> | ||
<% end %> | ||
|
||
<p class="card-subtitle mb-2 text-success"><%= 'Aceito' if @invitation.accepted? %></p> | ||
<p class="card-subtitle mb-2 text-danger"><%= 'Expirado' if @invitation.expired? %></p> | ||
<p class="card-subtitle mb-2 text-danger"><%= 'Recusado' if @invitation.declined? %></p> | ||
<p class="card-subtitle mb-2 text-dark"><%= 'Cancelado' if @invitation.cancelled? %></p> | ||
<p class="card-subtitle mb-2 text-info"> <%= 'Processando' if @invitation.processing? %></p> | ||
<% if @invitation.pending? %> | ||
<div class="btn-group"> | ||
<div> | ||
<%= link_to 'Aceitar', 'http://localhost:3000', class: 'btn btn-primary me-4' %> | ||
</div> | ||
<div> | ||
<%= button_to 'Recusar', decline_invitation_path(@invitation), method: :patch, class: 'btn btn-secondary' %> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
<% end %> | ||
|
||
<p class="card-subtitle mb-2 text-success"><%= 'Aceito' if @invitation.accepted? %></p> | ||
<p class="card-subtitle mb-2 text-danger"><%= 'Expirado' if @invitation.expired? %></p> | ||
<p class="card-subtitle mb-2 text-danger"><%= 'Recusado' if @invitation.declined? %></p> | ||
<p class="card-subtitle mb-2 text-dark"><%= 'Cancelado' if @invitation.cancelled? %></p> | ||
<p class="card-subtitle mb-2 text-info"> <%= 'Processando' if @invitation.processing? %></p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
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 %> | ||
<p> | ||
<%= link_to notification.notifiable.user.full_name, | ||
profile_path(notification.notifiable.user.profile) %> | ||
<%= t('notifications.index.commented_on_post') %> | ||
"<%= link_to notification.notifiable.post.title, | ||
post_path(notification.notifiable.post, anchor: "comment_#{notification.notifiable.id}") %>" | ||
<% else %> | ||
<p> | ||
<%= link_to notification.notifiable.user.full_name, profile_path(notification.notifiable.user.profile) %> <%= t('notifications.index.commented_on_your_post') %> | ||
<% 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 | ||
<p><%= link_to notification.notifiable.follower.user.full_name, profile_path(notification.notifiable.follower) %> começou a te seguir |
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,4 @@ | ||
<p>Você recebeu um convite para <%= link_to notification.notifiable.project_title, invitation_path(notification.notifiable) %> | ||
<p> | ||
Você recebeu um convite para | ||
<%= link_to notification.notifiable.project_title, | ||
invitation_path(notification.notifiable) %> |
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,16 @@ | ||
<div class="container d-flex flex-column align-items-center"> | ||
<h2>Notificações</h2> | ||
<h2><%= Notification.model_name.human(count: @notifications.count) %></h2> | ||
<% if @notifications&.any? %> | ||
<% @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> | ||
<% end %> | ||
<% @notifications.each do |notification| %> | ||
<div class="list-group"> | ||
<%= render( | ||
partial: "#{notification.notifiable.class.name.downcase}" , | ||
locals: { notification: notification } | ||
)%> | ||
<%= t('.time_ago', time: time_ago_in_words(notification.notifiable.created_at)) %> | ||
</div> | ||
<% end %> | ||
<% else %> | ||
<p>Nenhuma notificação encontrada</p> | ||
<p><%= t('.no_notifications') %></p> | ||
<% end %> | ||
</div> | ||
</div> |
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,5 @@ | ||
class AddSearchNameToUsers < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :users, :search_name, :string | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.