diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss index b8587152f..9338cd956 100644 --- a/app/assets/stylesheets/users.scss +++ b/app/assets/stylesheets/users.scss @@ -225,4 +225,6 @@ $sizes: (16, 32, 40, 48, 64, 128, 256); border-bottom-width: 1px !important; width: 150px; } -} \ No newline at end of file +} + +.mod-warnings-clear-form { display: inline; } \ No newline at end of file diff --git a/app/controllers/mod_warning_controller.rb b/app/controllers/mod_warning_controller.rb index 37384fea6..35f3984b1 100644 --- a/app/controllers/mod_warning_controller.rb +++ b/app/controllers/mod_warning_controller.rb @@ -26,7 +26,20 @@ def log if current_user.is_global_moderator || current_user.is_global_admin @warnings = @warnings.or ModWarning.where(user: @user, is_global: true) end - @warnings = @warnings.order(created_at: :desc).all + @warnings = @warnings.all + @warnings = @warnings.map { |w| {type: :warning, value: w} } + + @messages = ThreadFollower.where(user: @user).all.map { |t| t.id - 1 } + @messages = CommentThread.where(post: nil, is_private: true, id: @messages).all + @messages = @messages.filter { |m| m.comments.first.user&.id != @user&.id } + @messages = @messages.map { |m| {type: :message, value: m} } + + print "*"*50 + "\n" + print @messages + print "\n" + "*"*50 + + @entries = @warnings + @messages + @entries = @entries.sort_by { |e| e[:value].created_at }.reverse render layout: 'without_sidebar' end diff --git a/app/views/mod_warning/log.html.erb b/app/views/mod_warning/log.html.erb index d3fa1a26f..e4f4a3db5 100644 --- a/app/views/mod_warning/log.html.erb +++ b/app/views/mod_warning/log.html.erb @@ -6,53 +6,57 @@ <%= render 'shared/user_mod_sidebar', user: @user %>
-

Previously Sent Warnings

+

Previously Sent Messages and Warnings

- - - - - - - - - <% @warnings.each do |w| %> - - - - - - - - <% end %> -
DateTypeFromExcerptStatus
- <%= time_ago_in_words(w.created_at) %> ago - - <% if w.is_suspension %> - <% diff = ((w.suspension_end - w.created_at) / (3600 * 24)).to_i %> - Suspension - length: <%= diff %>d - <% if w.is_global %>network-wide<% end %> - <% else %> - Warning - <% end %> - - <%= user_link w.author %> - + <% @entries.each do |e| %> +
+ <% if e[:type] == :message %> + <% m = e[:value] %> +
+
+ Message +
+
<%= time_ago_in_words(m.created_at) %> ago by <%= user_link m.comments.first.user %>
+
+
+ <%= raw(sanitize(render_markdown(m.comments.first.content), scrubber: scrubber)) %> +
+ <% elsif e[:type] == :warning %> + <% w = e[:value] %> +
+
+ <% if w.suspension_active? %> + <%= form_tag lift_mod_warning_url(@user.id), method: :post, class: 'mod-warnings-clear-form' do %> + <%= submit_tag '(lift)', class: 'link is-red' %> + <% end %> · + Current + <% elsif w.active %> + Unread + <% elsif w.read %> + Read + <% else %> + Lifted + <% end %> +
+
+ <% if w.is_suspension %> + <% diff = ((w.suspension_end - w.created_at) / (3600 * 24)).to_i %> + Suspension + length: <%= diff %>d + <% if w.is_global %> + network-wide + <% end %> + <% else %> + Warning + <% end %> +
+
<%= time_ago_in_words(w.created_at) %> ago by <%= user_link w.author %>
+
+
<%= raw(sanitize(render_markdown(w.body), scrubber: scrubber)) %> -
- <% if w.suspension_active? %> - Current - <%= form_tag lift_mod_warning_url(@user.id), method: :post do %> - <%= submit_tag '(lift)', class: 'link is-red' %> - <% end %> - <% elsif w.active %> - Unread - <% elsif w.read %> - Read - <% else %> - Lifted - <% end %> -
+
+ <% end %> + + <% end %> \ No newline at end of file