Skip to content
Snippets Groups Projects
Commit 31a2d440 authored by Taico Aerts's avatar Taico Aerts
Browse files

Allow user profiles to be empty

When a user profile is effectively empty (when rendered, it does not
contain any actual visible text), also display the quiet enigma text.
parent 2cc8475c
No related branches found
No related tags found
2 merge requests!51Upgrade to latest qpixel,!50Update to latest codidact changes
......@@ -37,7 +37,8 @@
<%= f.text_field :username, class: 'form-element', autocomplete: 'off' %>
</div>
<%= render 'shared/body_field', f: f, field_name: :profile_markdown, field_label: 'Profile', post: current_user %>
<%= render 'shared/body_field', f: f, field_name: :profile_markdown, field_label: 'Profile', post: current_user,
min_length: 0 %>
<div class="post-preview"></div>
......
......
......@@ -44,10 +44,11 @@
<% end %>
</p>
<% if @user.profile.nil? || @user.profile.blank? %>
<% effective_profile = raw(sanitize(@user.profile&.strip || '', scrubber: scrubber)) %>
<% if effective_profile.blank? %>
<p class="is-lead">A quiet enigma. We don't know anything about <span dir="ltr"><%= rtl_safe_username(@user) %></span> yet.</p>
<% else %>
<%= raw(sanitize(@user.profile, scrubber: scrubber)) %>
<%= effective_profile %>
<% end %>
</div>
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment