Skip to content

Commit 7f735cb

Browse files
committed
Show each message's published date
1 parent 4264e07 commit 7f735cb

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

app/decorators/message_decorator.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ def from
88
def first_line
99
body.lines.first&.strip
1010
end
11+
12+
def published_date
13+
published_at.strftime('%Y/%m/%d')
14+
end
1115
end

app/views/messages/_thread.html.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
</svg>
2424
<%= count = message.count_recursively %> <%= count == 1 ? 'message' : 'messages' %>
2525
</span>
26+
<span class="inline-flex items-center gap-1">
27+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
28+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
29+
</svg>
30+
<%= message.published_date %>
31+
</span>
2632
</div>
2733
</div>
2834
</div>
@@ -39,6 +45,7 @@
3945
<span class="px-0.5">[#<%= message.list_seq %>] <%= without_list_prefix(message.subject) %></span>
4046
</span>
4147
<span class="text-gray-500 dark:text-gray-400"><%= message.from %></span>
48+
<span class="text-gray-500 dark:text-gray-400 ml-2"><%= message.published_date %></span>
4249
<% if message.body.present? %>
4350
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1 line-clamp-1"><%= message.first_line %></p>
4451
<% end %>

test/fixtures/messages.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ message1:
66
body: Body1
77
list_id: 1
88
list_seq: 123
9+
published_at: 1995-12-21 05:44:05
910

1011
message2:
1112
subject: Mail2
1213
from: From2
1314
body: Body2
1415
list_id: 2
1516
list_seq: 234
17+
published_at: 1997-07-28 14:51:40

0 commit comments

Comments
 (0)