-
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 pull request #201 from TreinaDev/feat/marcar-notificacoes-como-…
…lida Feat/marcar notificacoes como lida
- Loading branch information
Showing
24 changed files
with
206 additions
and
63 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
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 |
---|---|---|
@@ -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,11 +1,11 @@ | ||
<% 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}") %>" | ||
<% if notification.notifiable.post.user == current_user %> | ||
<%= notification.notifiable.user.full_name %> | ||
<%= t('notifications.commented_on_your_post') %> | ||
<%= notification.notifiable.post.title %> | ||
<% else %> | ||
<p> | ||
<%= link_to notification.notifiable.user.full_name, profile_path(notification.notifiable.user.profile) %> <%= t('notifications.index.commented_on_your_post') %> | ||
<% end %> | ||
<%= 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,4 +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><%= 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 } | ||
)%> | ||
<%= t('.time_ago', time: time_ago_in_words(notification.notifiable.created_at)) %> | ||
</div> | ||
<% end %> | ||
<h2><%= Notification.model_name.human(count: 2) %></h2> | ||
<% if @notifications.any? %> | ||
<ul class="list-group list-group-action"> | ||
<% @notifications.each do |notification| %> | ||
<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><%= t('.no_notifications') %></p> | ||
<p><%= t('notifications.no_notification') %></p> | ||
<% end %> | ||
</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 AddStatusToNotifications < ActiveRecord::Migration[7.1] | ||
def change | ||
add_column :notifications, :status, :integer, default: 0 | ||
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,5 @@ | ||
class RemoveReadFromNotifications < ActiveRecord::Migration[7.1] | ||
def change | ||
remove_column :notifications, :read, :boolean | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
expect(mail.subject).to include 'Alguém seguiu seu perfil' | ||
expect(mail.to).to eq [followed_profile.email] | ||
expect(mail.from).to eq ['[email protected]'] | ||
expect(mail.body).to include 'Danilo Martins te seguiu' | ||
expect(mail.body).to include 'Danilo Martins começou a seguir você' | ||
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
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.