Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
xxq250 2023-11-15 08:45:17 +08:00
commit 5541002dab
3 changed files with 4 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class Journal < ApplicationRecord
belongs_to :reply_journal, class_name: 'Journal', foreign_key: :reply_id, optional: true belongs_to :reply_journal, class_name: 'Journal', foreign_key: :reply_id, optional: true
has_many :journal_details, :dependent => :delete_all has_many :journal_details, :dependent => :delete_all
has_many :attachments, as: :container, dependent: :destroy has_many :attachments, as: :container, dependent: :destroy
has_many :first_ten_children_journals, -> { order(created_on: :asc).limit(10)}, class_name: 'Journal', foreign_key: :parent_id has_many :first_ten_children_journals, -> { order(created_on: :asc).limit(20)}, class_name: 'Journal', foreign_key: :parent_id
has_many :children_journals, class_name: 'Journal', foreign_key: :parent_id, dependent: :destroy has_many :children_journals, class_name: 'Journal', foreign_key: :parent_id, dependent: :destroy
scope :journal_includes, ->{includes(:user, :journal_details, :attachments)} scope :journal_includes, ->{includes(:user, :journal_details, :attachments)}

View File

@ -48,7 +48,7 @@ class Api::V1::Issues::Journals::ListService < ApplicationService
@queried_journals = @queried_journals.where(notes: nil) @queried_journals = @queried_journals.where(notes: nil)
end end
@queried_journals = @queried_journals.includes(:journal_details, :user, :attachments, first_ten_children_journals: [:parent_journal, :reply_journal]) @queried_journals = @queried_journals.includes(:journal_details, :user, :attachments, :children_journals)
@queried_journals = @queried_journals.reorder("journals.#{sort_by} #{sort_direction}").distinct @queried_journals = @queried_journals.reorder("journals.#{sort_by} #{sort_direction}").distinct
@queried_journals @queried_journals

View File

@ -3,8 +3,8 @@ owner_common = $redis_cache.hgetall("v2-owner-common:#{project_common["owner_id"
json.id item[0] json.id item[0]
json.score item[1] json.score item[1]
json.name project_common["name"] json.name project_common["name"]
if project_common['identifier'].include?("/") if project_common['identifier'].to_s.include?("/")
json.identifier project_common["identifier"].split('/')[1] json.identifier project_common["identifier"].to_s.split('/')[1]
json.owner do json.owner do
json.id nil json.id nil
json.type 'User' json.type 'User'