Skip to content

Commit

Permalink
Merge pull request #156 from motohiro-mm/fix/allow_even_if_remark_use…
Browse files Browse the repository at this point in the history
…r_nil

remarkがあってもuserが削除できるように修正
  • Loading branch information
motohiro-mm authored Oct 24, 2024
2 parents 58449bd + 6995f97 commit 5b00891
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/assets/images/user_icons/user_nil.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/views/remarks/_comment.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="border-b border-dashed border-orange-950/10">
<div id="remark_<%= remark.id %>" class="w-full mt-1 mb-2 pb-3 hover:bg-orange-100 rounded-lg">
<div class="flex items-center my-2 pt-2">
<%= image_tag "user_icons/#{remark.user.icon}", class: 'icon mr-2' %>
<%= render 'remarks/user_icon', remark: %>
<span class="text-sm">
<%= l remark.created_at, format: :long %>
</span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/remarks/_proposal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div id="remark_<%= remark.id %>" class="w-full flex justify-between items-center hover:bg-orange-100 rounded-lg">
<%= link_to edit_meeting_room_remark_path(remark.meeting_room, remark), class: 'w-5/6 z-0' do %>
<div class="flex justify-start items-center ml-2 my-3 font-bold text-wrap">
<%= image_tag "user_icons/#{remark.user.icon}", class: 'icon mr-2' %>
<%= render 'remarks/user_icon', remark: %>
<%= remark.content %>
</div>
<div class="text-center flex-shrink-0">
Expand Down
5 changes: 5 additions & 0 deletions app/views/remarks/_user_icon.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if remark.user.nil? %>
<%= image_tag 'user_icons/user_nil.svg', class: 'icon mr-2' %>
<% else %>
<%= image_tag "user_icons/#{remark.user.icon}", class: 'icon mr-2' %>
<% end %>
11 changes: 11 additions & 0 deletions db/migrate/20241024054119_change_column_to_null.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

class ChangeColumnToNull < ActiveRecord::Migration[7.2]
def up
change_column_null :remarks, :user_id, true
end

def down
change_column_null :remarks, :user_id, false
end
end
4 changes: 2 additions & 2 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b00891

Please sign in to comment.