Skip to content

Commit

Permalink
Add message created / updated ago in words (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrock-adam authored Nov 17, 2024
1 parent 2b3565d commit 555b0a8
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# outboxer_published_messages_deleter: bin/outboxer_published_messages_deleter
# outboxer_publisher: bin/outboxer_publisher
# outboxer_app: bundle exec rerun "rackup -p 4567"
outboxer_publisher_1: bin/outboxer_publisher
outboxer_sidekiq_publisher_1: bin/outboxer_sidekiq_publisher
Empty file modified bin/outboxer_publisher
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions bin/outboxer_sidekiq_publisher
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Outboxer::Publisher.publish(
when 'Event'
EventCreatedJob.perform_async({ 'id' => message[:messageable_id] })

logger.info "Outboxer published message #{message[:id]} for "\
"#{message[:messageable_type]}::#{message[:messageable_id]}"
logger.info "Outboxer published message id=#{message[:id]} "\
"messageable=#{message[:messageable_type]}/#{message[:messageable_id]}"\
end
end
1 change: 1 addition & 0 deletions lib/outboxer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
require_relative "outboxer/publishers"

module Outboxer

end
4 changes: 2 additions & 2 deletions lib/outboxer/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def time_ago_in_words(time)
id: 'Id',
status: 'Status',
messageable: 'Messageable',
created_at: 'Created At',
updated_at: 'Updated At',
created_at: 'Created',
updated_at: 'Updated',
updated_by_publisher_name: 'Updated By',
}

Expand Down
12 changes: 8 additions & 4 deletions lib/outboxer/web/views/message.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@
<td><%= message[:status] %></td>
</tr>
<tr>
<th scope="row">Created At</th>
<td><%= message[:created_at].in_time_zone(denormalised_query_params[:time_zone]) %></td>
<th scope="row">Created</th>
<td title="<%= message[:created_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(message[:created_at]) %> ago
</td>
</tr>
<tr>
<th scope="row">Updated At</th>
<td><%= message[:updated_at].in_time_zone(denormalised_query_params[:time_zone]) %></td>
<th scope="row">Updated</th>
<td title="<%= message[:updated_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(message[:updated_at]) %> ago
</td>
</tr>
<tr>
<th scope="row">Updated By</th>
Expand Down
10 changes: 5 additions & 5 deletions lib/outboxer/web/views/messages.erb
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@
<td><%= message[:status] %></td>
<td>
<a href="<%= outboxer_path("/message/#{message[:id]}/messageable#{normalised_query_string}") %>" class="custom-link">
<%= message[:messageable_type] %>::<%= message[:messageable_id] %>
<%= message[:messageable_type] %>/<%= message[:messageable_id] %>
</a>
</td>
<td>
<%= message[:created_at] %>
<td title="<%= message[:created_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(message[:created_at]) %> ago
</td>
<td>
<%= message[:updated_at] %>
<td title="<%= message[:updated_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(message[:updated_at]) %> ago
</td>
<td>
<% if message[:updated_by_publisher_id].present? && message[:updated_by_publisher_name].present? %>
Expand Down
4 changes: 2 additions & 2 deletions lib/outboxer/web/views/publisher.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@
<td><%= publisher[:id] %></td>
</tr>
<tr>
<th scope="row">Created At</th>
<th scope="row">Created</th>
<td title="<%= publisher[:created_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(publisher[:created_at]) %> ago
</td>
</tr>
<tr>
<th scope="row">Updated At</th>
<th scope="row">Updated</th>
<td title="<%= publisher[:updated_at].in_time_zone(denormalised_query_params[:time_zone]) %>">
<%= time_ago_in_words(publisher[:updated_at]) %> ago
</td>
Expand Down

0 comments on commit 555b0a8

Please sign in to comment.