Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Bug de pin/unpin #246

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def update
def pin
if @post.unpinned?
@post.pinned!
redirect_to profile_path(current_user), notice: t('.pinned.success')
redirect_to profile_path(current_user.profile.slug), notice: t('.pinned.success')
else
@post.unpinned!
redirect_to profile_path(current_user), notice: t('.unpinned.success')
redirect_to profile_path(current_user.profile.slug), notice: t('.unpinned.success')
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/professional_infos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def new
end

def create
@professional_info = current_user.profile.professional_infos.build(professional_info_params)
@professional_info = current_user.professional_infos.build(professional_info_params)

if @professional_info.save
redirect_to profile_path(current_user.profile), notice: t('.success')
redirect_to profile_path(current_user.profile.slug), notice: t('.success')
else
flash.now[:alert] = t('.error')
render :new, status: :unprocessable_entity
Expand All @@ -22,7 +22,7 @@ def edit; end

def update
if @professional_info.update(professional_info_params)
redirect_to profile_path(current_user.profile), notice: t('.success')
redirect_to profile_path(current_user.profile.slug), notice: t('.success')
else
flash.now[:alert] = t('.error')
render :edit, status: :unprocessable_entity
Expand Down
2 changes: 1 addition & 1 deletion app/views/connections_mailer/notify_follow.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p><%= t('.greeting', recipient: @notification.profile.full_name) %></p>

<p><%= link_to @notification.notifiable.follower.full_name, profile_url(@notification.notifiable.follower) %> <%= t('notifications.started_following_you') %></p>
<p><%= link_to @notification.notifiable.follower.full_name, profile_url(@notification.notifiable.follower.slug) %> <%= t('notifications.started_following_you') %></p>

<p><%= link_to t('click_btn'), @notification.profile %> <%= t('.access_profile') %></p>
<%= t('.regards') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/education_infos/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
</p>
<p class='mt-3'>
<%= education_info.submit t('save_btn'), class:'btn btn-primary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile), class: 'btn btn-secondary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile.slug), class: 'btn btn-secondary' %>
</p>
2 changes: 1 addition & 1 deletion app/views/likes_mailer/notify_like.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
<p><%= t('.most_liked_comment', comment: @most_liked_comment.message) %> <%= link_to @most_liked_comment.post.title, post_url(@most_liked_comment.post) %></p>
<% end %>

<p><%= link_to t('click_btn'), profile_url(@user.profile) %> <%= t('.access_profile') %></p>
<p><%= link_to t('click_btn'), profile_url(@user.profile.slug) %> <%= t('.access_profile') %></p>
<%= t('.regards') %>,
<p>Portfoliorrr</p>
2 changes: 1 addition & 1 deletion app/views/professional_infos/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
</p>
<p class='mt-3'>
<%= professional_info.submit t('save_btn'), class:'btn btn-primary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile), class: 'btn btn-secondary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile.slug), class: 'btn btn-secondary' %>
</p>
2 changes: 1 addition & 1 deletion app/views/profile_job_categories/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
</div>
<div class="mb-3">
<%= f.submit t('save_btn'), class: 'btn btn-primary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile), class: 'btn btn-secondary' %>
<%= link_to t('return_btn'), profile_path(current_user.profile.slug), class: 'btn btn-secondary' %>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/profiles/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div id="fixed">
<div class="mb-3 border-bottom border-dark">
<h2 id="post-list-title"><%= t('.highlight') %></h2>
</div
</div>
<section>
<%= render partial: 'posts/listing', locals: { posts: @posts.pinned } %>
</section>
Expand Down
2 changes: 1 addition & 1 deletion spec/mailer/connections_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<a href=\"#{profile_url(follower.profile)}\">"
expect(mail.body).to include "<a href=\"#{profile_url(follower.profile.slug)}\">"
expect(mail.body).to include 'Danilo Martins</a> começou a seguir você'
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/mailers/likes_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
expect(mail.body).to include "A publicação mais curtida foi <a href=\"#{post_url(post_b)}\">#{post_b.title}</a>"
expect(mail.body).to include "O seu comentário mais curtido foi #{comment.message} na publicação "
expect(mail.body).to include "<a href=\"#{post_url(comment.post)}\">#{comment.post.title}</a>"
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile)
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile.slug)
expect(mail.body).to include 'para acessar seu perfil e continuar interagindo.'
end

Expand All @@ -62,7 +62,7 @@
expect(mail.body).to include "A publicação mais curtida foi <a href=\"#{post_url(post)}\">#{post.title}</a>"
expect(mail.body).not_to include "O seu comentário mais curtido foi #{comment.message} na publicação "
expect(mail.body).not_to include "<a href=\"#{post_url(comment.post)}\">#{comment.post.title}</a>"
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile)
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile.slug)
expect(mail.body).to include 'para acessar seu perfil e continuar interagindo.'
end

Expand All @@ -81,7 +81,7 @@
expect(mail.body).not_to include "A publicação mais curtida foi <a href=\"#{post_url(post)}\">#{post.title}</a>"
expect(mail.body).to include "O seu comentário mais curtido foi #{comment.message} na publicação "
expect(mail.body).to include "<a href=\"#{post_url(comment.post)}\">#{comment.post.title}</a>"
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile)
expect(mail.body).to have_link 'Clique aqui', href: profile_url(user.profile.slug)
expect(mail.body).to include 'para acessar seu perfil e continuar interagindo.'
end
end
Expand Down
Loading