From df6da37b95255236f8ece69f2df6a62bf023010f Mon Sep 17 00:00:00 2001 From: "vilet.yy" Date: Wed, 2 Jun 2021 15:29:00 +0800 Subject: [PATCH] fix: some bug --- app/views/project_trends/_detail.json.jbuilder | 4 ++-- app/views/users/_watch_user_detail.json.jbuilder | 2 +- app/views/users/watch_users.json.jbuilder | 2 +- config/locales/zh-CN.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/project_trends/_detail.json.jbuilder b/app/views/project_trends/_detail.json.jbuilder index 7ffa9f152..75bcf2237 100644 --- a/app/views/project_trends/_detail.json.jbuilder +++ b/app/views/project_trends/_detail.json.jbuilder @@ -12,6 +12,6 @@ if trend.trend_type == "Issue" elsif trend.trend_type == "VersionRelease" json.partial! "version_releases/simple_version_release", locals: {version: trend.trend} else - json.name trend.trend.title - json.created_at format_time(trend.trend.created_at) + json.name trend.trend&.title + json.created_at format_time(trend.trend&.created_at) end diff --git a/app/views/users/_watch_user_detail.json.jbuilder b/app/views/users/_watch_user_detail.json.jbuilder index 80a711626..8c4881bcc 100644 --- a/app/views/users/_watch_user_detail.json.jbuilder +++ b/app/views/users/_watch_user_detail.json.jbuilder @@ -3,7 +3,7 @@ json.format_time target.created_at.strftime("%Y-%m-%d") json.name user.try(:show_real_name) json.login user.try(:login) json.image_url url_to_avatar(user) -json.is_current_user current_user.try(:id) == target.user_id +json.is_current_user current_user.try(:id) == user.id json.is_watch current_user&.watched?(user) diff --git a/app/views/users/watch_users.json.jbuilder b/app/views/users/watch_users.json.jbuilder index b265e2e0a..ed2697f0c 100644 --- a/app/views/users/watch_users.json.jbuilder +++ b/app/views/users/watch_users.json.jbuilder @@ -1,7 +1,7 @@ json.count @watchers_count json.users do json.array! @watchers do |watcher| - json.partial! "/users/watch_user_detail", locals: {target: watcher, user: watcher.watchable} + json.partial! "/users/watch_user_detail", target: watcher, user: watcher.watchable end # json.partial! "/users/watch_user_detail", collection: @watchers, as: :target end \ No newline at end of file diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index c040f9bd1..db1030163 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -15,7 +15,7 @@ zh-CN: 'refused': '已拒绝' 'agreed': '已同意' trend: - Issue: 工单 + Issue: 易修(Issue) PullRequest: 合并请求 VersionRelease: 版本发布 create: 创建了