comparison src/lib/Shared.luan @ 106:15cf43dd144c

handle reply to deleted
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 03 Sep 2025 07:58:46 -0600
parents 0fc454beff08
children
comparison
equal deleted inserted replaced
105:62d6725b4db0 106:15cf43dd144c
109 function Shared.post_html(post) 109 function Shared.post_html(post)
110 local author_id = post.author_id 110 local author_id = post.author_id
111 local user = current_user() or error() 111 local user = current_user() or error()
112 local author = get_user_by_id(author_id) 112 local author = get_user_by_id(author_id)
113 local id = post.id 113 local id = post.id
114 local reply = post.reply 114 local reply_id = post.reply
115 reply = reply and get_post_by_id(reply) 115 local reply = reply_id and get_post_by_id(reply_id)
116 %> 116 %>
117 <div post="<%=id%>" author="<%=author.id%>" id="p<%=id%>" fix> 117 <div post="<%=id%>" author="<%=author.id%>" id="p<%=id%>" fix>
118 <div who> 118 <div who>
119 <span author><%=author.name_html()%></span> 119 <span author><%=author.name_html()%></span>
120 <span right> 120 <span right>
124 </div> 124 </div>
125 <% if reply ~= nil then %> 125 <% if reply ~= nil then %>
126 <div quote> 126 <div quote>
127 <blockquote><%= html_encode(reply.content) %></blockquote> 127 <blockquote><%= html_encode(reply.content) %></blockquote>
128 <div><a when href="#p<%=reply.id%>"><%=reply.date%></a></div> 128 <div><a when href="#p<%=reply.id%>"><%=reply.date%></a></div>
129 </div>
130 <% elseif reply_id ~= nil then %>
131 <div quote>
132 <span deleted>Message deleted</span>
129 </div> 133 </div>
130 <% end %> 134 <% end %>
131 <div text><%= html_encode(post.content) %></div> 135 <div text><%= html_encode(post.content) %></div>
132 </div> 136 </div>
133 <% 137 <%