Skip to content

Commit

Permalink
Merge pull request #33 from slickage/board-last-post-avatar
Browse files Browse the repository at this point in the history
feat(helpers/proxy_conversion): load board last post user avatar
  • Loading branch information
akinsey authored Nov 15, 2024
2 parents 72e7857 + 1741f4e commit 015ac7f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/epochtalk_server_web/helpers/proxy_conversion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,22 @@ defmodule EpochtalkServerWeb.Helpers.ProxyConversion do
)
|> join(:left, [b], m in "smf_messages", on: b.id_last_msg == m.id_msg)
|> join(:left, [b, m], t in "smf_topics", on: m.id_topic == t.id_topic)
|> select([b, m, t], %{
|> join(:left, [b, m, t], u in "smf_members", on: m.id_member == u.id_member)
|> join(:left, [b, m, t, u], a in "smf_attachments",
on: m.id_member == a.id_member and a.attachmentType == 1
)
|> select([b, m, t, u, a], %{
id: b.id_board,
last_post_created_at: m.posterTime * 1000,
last_post_position: t.numReplies,
last_post_username: m.posterName,
last_post_avatar:
fragment(
"if(? <>'',concat('https://bitcointalk.org/avatars/',?),ifnull(concat('https://bitcointalk.org/useravatars/',?),''))",
u.avatar,
u.avatar,
a.filename
),
last_thread_created_at: t.id_member_started,
last_thread_id: t.id_topic,
last_thread_post_count: t.numReplies,
Expand Down

0 comments on commit 015ac7f

Please sign in to comment.