Skip to content

Commit

Permalink
Merge branch 'GO-196/user_select_boxes'
Browse files Browse the repository at this point in the history
  • Loading branch information
stage-rl committed Sep 22, 2023
2 parents 1b1aef9 + 4597530 commit 670b3e8
Show file tree
Hide file tree
Showing 23 changed files with 213 additions and 299 deletions.
9 changes: 5 additions & 4 deletions app/components/admin/boxes/boxes_list_row_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<div class="self-stretch p-6 border-b border-gray-200 justify-start items-center gap-4 inline-flex">
<div class="flex justify-start items-start flex-grow-0 flex-shrink-0 w-[45px] gap-2">
<div class="flex justify-center items-center relative overflow-hidden gap-1.5 px-2 py-1 rounded-md bg-<%= @box.color %>-100 border border-<%= @box.color %>-400">
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-<%= @box.color %>-600"><%= @box.short_name || @box.name[0] %></p>
</div>
<%= render Common::BoxLabelComponent.new(@box) %>
</div>
<div class="grow shrink basis-0 flex-col justify-start items-start gap-1 inline-flex">
<div class="text-center text-gray-900 text-lg font-medium leading-loose">
Expand All @@ -16,7 +14,10 @@
<%= link_to edit_admin_tenant_box_path(@box.tenant, @box), data: { turbo_frame: :modal } do %>
<%= render Common::EditButtonComponent.new %>
<% end %>
<%= button_to admin_tenant_box_path(@box.tenant, @box), method: :delete do %>
<%= button_to admin_tenant_box_path(@box.tenant, @box),
method: :delete,
disabled: @box == Current.box,
data: { turbo_confirm: "Naozaj odstrániť schránku #{@box.name} ?"} do %>
<%= render Common::DeleteButtonComponent.new %>
<% end %>
</div>
Expand Down
33 changes: 33 additions & 0 deletions app/components/common/box_label_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<%# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %>
<%# If color values are changed, adjust the color list below !!!!!!!!! %>
<%# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %>
<div class="flex justify-center items-center relative overflow-hidden gap-1.5 px-2 py-1 rounded-md bg-<%= @box.color %>-100 border border-<%= @box.color %>-400">
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-<%= @box.color %>-600"><%= @box.short_name || @box.name[0] %></p>
</div>
<%# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %>
<%# Necessary to generate proper CSS for dynamically generated colors %>
<%# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %>
<%# !!!!!! Change values here, if values in template change !!!!!! %>
<%# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! %>
<%# class="bg-slate-100 border border-slate-400 text-slate-600" %>
<%# class="bg-gray-100 border border-gray-400 text-gray-600" %>
<%# class="bg-zinc-100 border border-zinc-400 text-zinc-600" %>
<%# class="bg-neutral-100 border border-neutral-400 text-neutral-600" %>
<%# class="bg-stone-100 border border-stone-400 text-stone-600" %>
<%# class="bg-red-100 border border-red-400 text-red-600" %>
<%# class="bg-orange-100 border border-orange-400 text-orange-600" %>
<%# class="bg-amber-100 border border-amber-400 text-amber-600" %>
<%# class="bg-yellow-100 border border-yellow-400 text-yellow-600" %>
<%# class="bg-lime-100 border border-lime-400 text-lime-600" %>
<%# class="bg-green-100 border border-green-400 text-green-600" %>
<%# class="bg-emerald-100 border border-emerald-400 text-emerald-600" %>
<%# class="bg-teal-100 border border-teal-400 text-teal-600" %>
<%# class="bg-cyan-100 border border-cyan-400 text-cyan-600" %>
<%# class="bg-sky-100 border border-sky-400 text-sky-600" %>
<%# class="bg-blue-100 border border-blue-400 text-blue-600" %>
<%# class="bg-indigo-100 border border-indigo-400 text-indigo-600" %>
<%# class="bg-violet-100 border border-violet-400 text-violet-600" %>
<%# class="bg-purple-100 border border-purple-400 text-purple-600" %>
<%# class="bg-fuchsia-100 border border-fuchsia-400 text-fuchsia-600" %>
<%# class="bg-pink-100 border border-pink-400 text-pink-600" %>
<%# class="bg-rose-100 border border-rose-400 text-rose-600" %>
7 changes: 7 additions & 0 deletions app/components/common/box_label_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Common
class BoxLabelComponent < ViewComponent::Base
def initialize(box)
@box = box
end
end
end
15 changes: 15 additions & 0 deletions app/components/layout/box_list_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<%= tag.turbo_frame id:'box-list', class:"flex-col self-stretch" do %>
<% @boxes.each do |box| %>
<%= link_to select_box_path(box), class:"flex justify-between items-center self-stretch flex-grow-0 flex-shrink-0 px-4 py-2", data: { turbo_frame: "_top" } do %>
<div class="flex justify-start items-center flex-grow-0 flex-shrink-0 relative gap-3">
<div class="justify-start w-16">
<%= render Common::BoxLabelComponent.new(box) %>
</div>
<p class="flex-grow-0 flex-shrink-0 text-base font-medium text-left text-gray-900"><%= box.name %></p>
</div>
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-1.5 px-1.5 py-0.5 rounded-md bg-gray-50 border border-gray-300">
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-gray-600"><%= box.messages.where(read: false).size %></p>
</div>
<% end %>
<% end %>
<% end %>
5 changes: 5 additions & 0 deletions app/components/layout/box_list_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Layout::BoxListComponent < ViewComponent::Base
def initialize(boxes)
@boxes = boxes
end
end
29 changes: 29 additions & 0 deletions app/components/layout/box_selector_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div class="relative" data-controller="dropdown"
data-dropdown-active-target="#dropdown-button"
data-dropdown-active-class="bg-gray-50"
data-dropdown-invisible-class="opacity-0 scale-95"
data-dropdown-visible-class="opacity-100 scale-100"
data-dropdown-entering-class="ease-out duration-100"
data-dropdown-enter-timeout="100"
data-dropdown-leaving-class="ease-in duration-75"
data-dropdown-leave-timeout="75"
>
<div id="dropdown-button" data-action="click->dropdown#toggle click@window->dropdown#hide" role="button" data-dropdown-target="button" tabindex="0" class="inline-block select-none">
<button type="button" class="flex items-center gap-2" aria-expanded="false" aria-haspopup="true">
<div class="flex justify-start items-center relative gap-3 py-1.5 pl-8 rounded-md bg-white">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class=" w-5 h-5 relative" preserveAspectRatio="xMidYMid meet">
<path d="M15.8333 9.16667H4.16667M15.8333 9.16667C16.2754 9.16667 16.6993 9.34226 17.0118 9.65482C17.3244 9.96738 17.5 10.3913 17.5 10.8333V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V10.8333C2.5 10.3913 2.67559 9.96738 2.98816 9.65482C3.30072 9.34226 3.72464 9.16667 4.16667 9.16667M15.8333 9.16667V7.5C15.8333 7.05797 15.6577 6.63405 15.3452 6.32149C15.0326 6.00893 14.6087 5.83333 14.1667 5.83333M4.16667 9.16667V7.5C4.16667 7.05797 4.34226 6.63405 4.65482 6.32149C4.96738 6.00893 5.39131 5.83333 5.83333 5.83333M14.1667 5.83333V4.16667C14.1667 3.72464 13.9911 3.30072 13.6785 2.98816C13.366 2.67559 12.942 2.5 12.5 2.5H7.5C7.05797 2.5 6.63405 2.67559 6.32149 2.98816C6.00893 3.30072 5.83333 3.72464 5.83333 4.16667V5.83333M14.1667 5.83333H5.83333" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<% if Current.box %>
<%= render Common::BoxLabelComponent.new(Current.box) %>
<p class="text-base text-left text-gray-900"><%= Current.box.name %></p>
<% else %>
<p class=" text-base text-left text-gray-900">Všetky schránky</p>
<% end %>
</div>
</button>
</div>
<div data-dropdown-target="menu" class="z-50 absolute transform transition hidden opacity-0 scale-95" >
<%= render Layout::BoxSelectorPopupComponent.new %>
</div>
</div>
2 changes: 2 additions & 0 deletions app/components/layout/box_selector_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class Layout::BoxSelectorComponent < ViewComponent::Base
end
28 changes: 28 additions & 0 deletions app/components/layout/box_selector_popup_component.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<div class="flex flex-col justify-start items-start w-[360px] gap-px py-0.5 rounded-lg bg-white border border-gray-300" style="box-shadow: 1px 1px 4px 0 rgba(0,0,0,0.1);">
<%= link_to select_all_boxes_path, class:"flex justify-between items-center self-stretch flex-grow-0 flex-shrink-0 px-4 py-2" do %>
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-[29px]">
<p class="flex-grow-0 flex-shrink-0 text-base font-medium text-left text-gray-900">Všetky schránky</p>
</div>
<div class="flex justify-center items-center flex-grow-0 flex-shrink-0 relative overflow-hidden gap-1.5 px-1.5 py-0.5 rounded-md bg-gray-50 border border-gray-300">
<p class="flex-grow-0 flex-shrink-0 text-sm text-left text-gray-600"><%= @all_unread_messages&.count %></p>
</div>
<% end %>
<div class="flex justify-start items-center self-stretch flex-grow-0 flex-shrink-0 relative">
<svg width="360" height="1" viewBox="0 0 360 1" fill="none" xmlns="http://www.w3.org/2000/svg" class="flex-grow" preserveAspectRatio="xMidYMid meet">
<line y1="0.5" x2="360" y2="0.5" stroke="#E5E7EB"></line>
</svg>
</div>
<%= form_with url: search_boxes_path, class:"flex justify-start items-center self-stretch flex-grow-0 flex-shrink-0 gap-2 p-4 border-t-0 border-r-0 border-b border-l-0 border-gray-200" do |form| %>
<div class="flex w-full items-center rounded-md shadow-sm ring-1 ring-inset ring-gray-300 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600">
<div class="p-2">
<%= render Icons::SearchComponent.new %>
</div>
<%= tag.turbo_frame id:'box-search-results' %>
<%= form.search_field :name_search, value: params[:name_search], placeholder: "Vyhľadaj schránku",
oninput: "this.form.requestSubmit()",
onreset: "this.form.requestSubmit()",
class: "block w-full flex-1 border-0 bg-transparent py-1.5 pl-1 text-gray-900 placeholder:text-gray-400 focus:ring-0 sm:text-sm sm:leading-6" %>
</div>
<% end %>
<%= render Layout::BoxListComponent.new(@boxes) %>
</div>
6 changes: 6 additions & 0 deletions app/components/layout/box_selector_popup_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Layout::BoxSelectorPopupComponent < ViewComponent::Base
def initialize
@boxes = Current.tenant.boxes.where.not(boxes: { id: nil }) || []
@all_unread_messages = Pundit.policy_scope(Current.user, Message).where(read:false) if Current.user
end
end
48 changes: 23 additions & 25 deletions app/components/message_threads_table_row_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@
<div class="flex justify-stretch items-center gap-4 pt-1 pb-[30px] rounded-full">
<%= check_box_tag('message_thread_ids[]', @message_thread.id) %>
<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 512 512" class=<%= "invisible" if @message_thread.all_read %>><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"/></svg>
<div class="flex flex-col justify-start items-start pr-[7px]">
<div class="flex justify-center items-center gap-1.5 px-2 py-1 rounded-md bg-yellow-50 border border-yellow-300">
<p class="text-sm text-left text-yellow-700">GO</p>
</div>
<div class="flex flex-col justify-start items-start pr-[7px]">
<%= render Common::BoxLabelComponent.new(@message_thread.box) %>
</div>
</div>
<%= link_to @message_thread, class:"flex justify-stretch overflow-clip items-center grow gap-2" do %>
<div class="flex flex-col truncate justify-start items-stretch grow gap-1">
<p title="<%= @message_thread.title%>" class="truncate text-lg text-gray-900 <%="font-semibold" unless @message_thread.all_read %>"><%= @message_thread.title %></p>
<p class="text-base text-left text-gray-500"><%= @message_thread.with_whom %></p>
</div>
<div class="flex flex-wrap truncate justify-start items-start gap-1">
<% @message_thread.tags.each do |tag| %>
<% if tag.visible %>
<div class="flex truncate justify-center items-center gap-1.5 px-2 py-1 rounded-md bg-gray-50 border border-gray-300">
<p class="truncate text-sm text-left text-gray-600"><%= tag.name %></p>
</div>
<%= link_to @message_thread, class:"flex justify-stretch overflow-clip items-center grow gap-2" do %>
<div class="flex flex-col truncate justify-start items-stretch grow gap-1">
<p title="<%= @message_thread.title%>" class="truncate text-lg text-gray-900 <%="font-semibold" unless @message_thread.all_read %>"><%= @message_thread.title %></p>
<p class="text-base text-left text-gray-500"><%= @message_thread.with_whom %></p>
</div>
<div class="flex flex-wrap truncate justify-start items-start gap-1">
<% @message_thread.tags.each do |tag| %>
<% if tag.visible %>
<div class="flex truncate justify-center items-center gap-1.5 px-2 py-1 rounded-md bg-gray-50 border border-gray-300">
<p class="truncate text-sm text-left text-gray-600"><%= tag.name %></p>
</div>
<% end %>
<% end %>
<% end %>
</div>
<div class="flex justify-end items-center gap-2">
<p class="whitespace-nowrap text-lg text-center text-gray-900"><%= l @message_thread.last_message_delivered_at, :format => :long %></p>
</div>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 " preserveAspectRatio="xMidYMid meet">
<path d="M9 5L16 12L9 19" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<% end %>
</div>
</div>
<div class="flex justify-end items-center gap-2">
<p class="whitespace-nowrap text-lg text-center text-gray-900"><%= l @message_thread.last_message_delivered_at, :format => :long %></p>
</div>
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 " preserveAspectRatio="xMidYMid meet">
<path d="M9 5L16 12L9 19" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<% end %>
</div>
10 changes: 1 addition & 9 deletions app/components/t_w/top_navigation_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<div class="flex justify-stretch items-center grow h-16 relative gap-4 px-4 bg-white border-t-0 border-r-0 border-b border-l-0 border-gray-200">
<div class="todo flex flex-col justify-center items-start gap-2">
<div class="flex justify-start items-center relative gap-3 px-3 py-1.5 rounded-md bg-white">
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class=" w-5 h-5 relative" preserveAspectRatio="xMidYMid meet">
<path d="M15.8333 9.16667H4.16667M15.8333 9.16667C16.2754 9.16667 16.6993 9.34226 17.0118 9.65482C17.3244 9.96738 17.5 10.3913 17.5 10.8333V15.8333C17.5 16.2754 17.3244 16.6993 17.0118 17.0118C16.6993 17.3244 16.2754 17.5 15.8333 17.5H4.16667C3.72464 17.5 3.30072 17.3244 2.98816 17.0118C2.67559 16.6993 2.5 16.2754 2.5 15.8333V10.8333C2.5 10.3913 2.67559 9.96738 2.98816 9.65482C3.30072 9.34226 3.72464 9.16667 4.16667 9.16667M15.8333 9.16667V7.5C15.8333 7.05797 15.6577 6.63405 15.3452 6.32149C15.0326 6.00893 14.6087 5.83333 14.1667 5.83333M4.16667 9.16667V7.5C4.16667 7.05797 4.34226 6.63405 4.65482 6.32149C4.96738 6.00893 5.39131 5.83333 5.83333 5.83333M14.1667 5.83333V4.16667C14.1667 3.72464 13.9911 3.30072 13.6785 2.98816C13.366 2.67559 12.942 2.5 12.5 2.5H7.5C7.05797 2.5 6.63405 2.67559 6.32149 2.98816C6.00893 3.30072 5.83333 3.72464 5.83333 4.16667V5.83333M14.1667 5.83333H5.83333" stroke="#9CA3AF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
<p class=" text-base text-left text-gray-900">Všetky schránky</p>
</div>
</div>
<%= render Layout::BoxSelectorComponent.new %>
<svg width="1" height="64" viewBox="0 0 1 64" fill="none" xmlns="http://www.w3.org/2000/svg" class="todo " preserveAspectRatio="xMidYMid meet">
<line x1="0.5" y1="2.18557e-8" x2="0.499997" y2="64" stroke="#E5E7EB"></line>
</svg>
Expand All @@ -28,7 +21,6 @@
<% end %>
<%= f.search_field :q, value: params[:q], placeholder: 'Vyhľadaj správu', class: 'pl-10 text-base text-left text-gray-900 placeholder-gray-400', style: 'width: 100%' %>
<% end %>

</div>
</div>
<svg width="1" height="64" viewBox="0 0 1 64" fill="none" xmlns="http://www.w3.org/2000/svg" class=" " preserveAspectRatio="xMidYMid meet">
Expand Down
25 changes: 23 additions & 2 deletions app/controllers/boxes_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class BoxesController < ApplicationController
before_action :load_box, only: [:show, :sync]
before_action :load_box, only: %i[show sync select]

def index
authorize Box
Expand All @@ -12,10 +12,31 @@ def show

def sync
authorize @box, policy_class: BoxPolicy
raise ActionController::MethodNotAllowed.new('Not authorized') unless policy_scope(Box).exists?(@box.id)
raise ActionController::MethodNotAllowed.new("Not authorized") unless policy_scope(Box).exists?(@box.id)
Govbox::SyncBoxJob.perform_later(@box)
end

def select
authorize @box
session[:box_id] = @box.id
redirect_to request.referrer
end

def select_all
authorize Box
# TODO: Chceme to takto? nil = vsetky Alebo chceme pridavat inu variablu pre tento stav?
session[:box_id] = nil
redirect_to request.referrer
end

def search
authorize(Box)
@boxes = policy_scope(Box)
.where(tenant_id: Current.tenant.id)
.where("unaccent(name) ILIKE unaccent(?) OR unaccent(short_name) ILIKE unaccent(?)", "%#{params[:name_search]}%", "%#{params[:name_search]}%")
.order(:name)
end

private

def load_box
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/concerns/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ def clean_session
session[:user_id] = nil
session[:login_expires_at] = nil
session[:tenant_id] = nil
session[:box_id] = nil
end

def load_current_user
Current.user = User.find(session[:user_id]) if session[:user_id]
Current.tenant = Tenant.find(session[:tenant_id]) if session[:tenant_id]
Current.box ||= Current.tenant&.boxes&.first
Current.box = Current.tenant.boxes.find(session[:box_id]) if session[:box_id]
end

def valid_session?(session)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/message_drafts_imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def create
end

def upload_new
@box = Current.box if Current.box
@box = Current.tenant.boxes.first if Current.tenant.boxes.count == 1
authorize MessageDraftsImport
end

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/message_threads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def index
cursor = MessageThreadCollection.init_cursor(search_params[:cursor])

@message_threads, @next_cursor = MessageThreadCollection.all(
scope: message_thread_policy_scope.includes(:tags),
scope: message_thread_policy_scope.includes(:tags, :box),
search_permissions: search_permissions,
query: search_params[:q],
no_visible_tags: search_params[:no_visible_tags] == '1' && Current.user.admin?,
Expand Down Expand Up @@ -63,6 +63,7 @@ def message_thread_policy_scope

def search_permissions
result = { tenant_id: Current.tenant }
result[:box_id] = Current.box if Current.box
result[:tag_ids] = policy_scope(Tag).pluck(:id) unless Current.user.admin?
result
end
Expand Down
1 change: 1 addition & 0 deletions app/models/box.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Box < ApplicationRecord

has_many :folders, dependent: :destroy
has_many :message_threads, through: :folders, extend: MessageThreadsExtensions, dependent: :destroy
has_many :messages, through: :message_threads
has_many :message_drafts_imports, dependent: :destroy

before_destroy ->(box) { EventBus.publish(:box_destroyed, box.id) }
Expand Down
1 change: 1 addition & 0 deletions app/models/message_thread.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class MessageThread < ApplicationRecord
has_and_belongs_to_many :tags
belongs_to :folder
has_one :box, through: :folder
has_many :messages, dependent: :destroy do
def find_or_create_by_uuid!(uuid:)
end
Expand Down
Loading

0 comments on commit 670b3e8

Please sign in to comment.