Skip to content
Permalink
Browse files
Exclude deletion section from cache.
  • Loading branch information
YaroslavO committed Jul 20, 2018
1 parent 60f5a82 commit 9b75b83c48faaa989eb2e456772a8abb019a0137
Showing with 24 additions and 28 deletions.
  1. +0 −4 app/helpers/users_helper.rb
  2. +24 −24 app/views/users/show.html.haml
@@ -12,10 +12,6 @@ def show_protips?
!show_comments?
end

def account_deletion?
params[:delete_account].present?
end

def show_comments?
params[:comments].present?
end
@@ -7,32 +7,32 @@
- meta twitter: { image: avatar_url(@user) } if @user.avatar?
- meta og: { image: avatar_url(@user) } if @user.avatar?

- cache_if show_protips? && !account_deletion?, ['v2', @user, current_user] do
.container[@user]
.clearfix
.sm-col.sm-col.sm-col-12.md-col-8
.clearfix.mt0.mb1
.right.mt1
- if current_user&.admin? || account_deletion?
= button_to user_path(@user), method: :delete, data: { confirm: "Deleting your account is permanent! Are you sure?" }, form_class: "diminish inline ml1 mr1 plain" do
.container[@user]
.clearfix
.sm-col.sm-col.sm-col-12.md-col-8
.clearfix.mt0.mb1
.right.mt1
- if current_user&.admin? || params[:delete_account]
= button_to user_path(@user), method: :delete, data: { confirm: "Deleting your account is permanent! Are you sure?" }, form_class: "diminish inline ml1 mr1 plain" do
= icon('trash')
·
- if current_user&.admin?
.inline.diminish.mr1="Last accessed #{time_ago_in_words(@user.last_request_at)} ago"
- else
Deleting your account is permanent! Click the trash can again to continue
·
- elsif current_user == @user
.diminish.inline.ml1.mr1
= link_to delete_account_path do
= icon('trash')
·
- if current_user&.admin?
.inline.diminish.mr1="Last accessed #{time_ago_in_words(@user.last_request_at)} ago"
- else
Deleting your account is permanent! Click the trash can again to continue
·
- elsif current_user == @user
.diminish.inline.ml1.mr1
= link_to delete_account_path do
= icon('trash')

.diminish.inline.ml1.mr1
="Joined #{@user.created_at.to_formatted_s(:explicitly_bold)}"
·
.ml1.mr1.inline[:alternateName]
=link_to @user&.username, profile_path(username: @user.username)
.diminish.inline.ml1.mr1
="Joined #{@user.created_at.to_formatted_s(:explicitly_bold)}"
·
.ml1.mr1.inline[:alternateName]
=link_to @user&.username, profile_path(username: @user.username)

- cache ['user-details', @user, current_user] do
.card.p3{style: "border-top:solid 5px #{@user.color}"}
-if current_user == @user || current_user&.admin?
.clearfix.mb3
@@ -102,6 +102,7 @@
.content.small.px2.mt1{style:"border-left: 3px solid #{@user.color}"}
=sanitize CoderwallFlavoredMarkdown.render_to_html(comment.body)

- cache ['user-sidebar', @user, current_user] do
.sm-col.sm-col.sm-col-12.md-col-4
.clearfix.sm-ml3.mt3.p1
%h5.mt0.mb1
@@ -115,7 +116,6 @@
=number_with_delimiter(@user.protips.sum(:views_count))
Total ProTip Views


-@user.badges.each do |badge|
.dropdown.relative.mr1.mt1
=image_tag badge.path, width: 35, height: 35

0 comments on commit 9b75b83

Please sign in to comment.