Split posts with more then 140 characteres in multiple posts instead of hiding content so we take advantage of already existing user posts

This commit is contained in:
Rogerio Chaves 2020-04-26 20:22:20 +02:00
parent b4d92d66e4
commit 333bc8226e
No known key found for this signature in database
GPG Key ID: E6AF5440509B1D94
1 changed files with 17 additions and 17 deletions

View File

@ -1,21 +1,21 @@
<% posts.map(post => { %>
<% if (!post.content.text) return %>
<div class="post">
<div>
<a href="<%= profileUrl(post.author) %>">
<img src="<%= profileImageUrl(post.authorProfile) %>" class="post-profile-pic" />
</a>
<% let text = escapeMarkdown(post.content.text) %>
<% let limit = typeof dont_cut == "undefined" ? 140 : 10000 %>
<% let numPosts = Math.ceil(text.length / limit) %>
<% for (let i = numPosts; i > 0; i--) { %>
<div class="post">
<div>
<a href="<%= profileUrl(post.author) %>">
<img src="<%= profileImageUrl(post.authorProfile) %>" class="post-profile-pic" />
</a>
</div>
<div class="post-content">
<a href="<%= profileUrl(post.author) %>" class="no-link-style">
<b><%= post.authorProfile.name %></b>
</a>
<%- htmlify(text.slice(limit * (i - 1), limit * i)) %>
</div>
</div>
<div class="post-content">
<a href="<%= profileUrl(post.author) %>" class="no-link-style">
<b><%= post.authorProfile.name %></b>
</a>
<% let text = escapeMarkdown(post.content.text) %>
<% if (typeof dont_cut == "undefined") { %>
<% text = text.slice(0, 140) %>
<% if (post.content.text.length > 140) text += "..." %>
<% } %>
<%- htmlify(text) %>
</div>
</div>
<% } %>
<% }) %>