diff --git a/app/controllers/project_trends_controller.rb b/app/controllers/project_trends_controller.rb index 66702608d..f283d05f7 100644 --- a/app/controllers/project_trends_controller.rb +++ b/app/controllers/project_trends_controller.rb @@ -3,7 +3,7 @@ class ProjectTrendsController < ApplicationController before_action :check_project_public def index - project_trends = @project.project_trends.preload(:user, trend: :user) + project_trends = @project.project_trends.preload(:user, trend: :user, project: :owner) check_time = params[:time] #时间的筛选 check_type = params[:type] #动态类型的筛选,目前已知的有 Issue, PullRequest, Version diff --git a/app/views/project_trends/_detail.json.jbuilder b/app/views/project_trends/_detail.json.jbuilder index 75bcf2237..04de10f6a 100644 --- a/app/views/project_trends/_detail.json.jbuilder +++ b/app/views/project_trends/_detail.json.jbuilder @@ -6,6 +6,13 @@ json.user_name trend.user.try(:show_real_name) json.user_login trend.user.login json.user_avatar url_to_avatar(trend.user) json.action_time time_from_now(trend.created_at) +json.project do + json.owner do + json.partial! 'users/user_simple', locals: {user: trend&.project&.owner} + end + json.identifier trend&.project&.identifier + json.description trend&.project&.description +end if trend.trend_type == "Issue" json.partial! "issues/simple_issue_item", locals: {issue: trend.trend}