Skip to content

Commit

Permalink
Updates API templates for issue, project and user
Browse files Browse the repository at this point in the history
  • Loading branch information
dkastl committed Nov 18, 2024
1 parent 09fdd68 commit 9cdc7b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/views/issues/show.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ api.issue do
api.user(:id => journal.user_id, :name => journal.user.name) unless journal.user.nil?
api.notes journal.notes
api.created_on journal.created_on
api.updated_on journal.updated_on
api.updated_by(:id => journal.updated_by.id, :name => journal.updated_by.name) unless journal.updated_by.nil?
api.private_notes journal.private_notes
api.array :details do
journal.visible_details.each do |detail|
Expand Down
1 change: 1 addition & 0 deletions app/views/projects/index.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
api.name project.name
api.identifier project.identifier
api.description project.description
api.homepage project.homepage
api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
api.status project.status
api.is_public project.is_public?
Expand Down
6 changes: 6 additions & 0 deletions app/views/users/index.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ api.array :users, api_meta(:total_count => @user_count, :offset => @offset, :lim
api.passwd_changed_on user.passwd_changed_on
api.avatar_url gravatar_url(user.mail, {rating: nil, size: nil, default: Setting.gravatar_default}) if Setting.gravatar_enabled?
api.twofa_scheme user.twofa_scheme
api.status user.status

if user.geom
api.geojson (params[:format] == "json") ? user.geojson : user.geojson.to_json
else
api.geojson nil
end

api.auth_source do
api.id user.auth_source.id
api.name user.auth_source.name
end if include_in_api_response?('auth_source') && user.auth_source.present?

render_api_custom_values user.visible_custom_field_values, api
end
end
Expand Down
5 changes: 5 additions & 0 deletions app/views/users/show.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ api.user do

render_api_custom_values @user.visible_custom_field_values, api

api.auth_source do
api.id @user.auth_source.id
api.name @user.auth_source.name
end if User.current.admin? && include_in_api_response?('auth_source') && @user.auth_source.present?

api.array :groups do |groups|
@user.groups.each do |group|
api.group :id => group.id, :name => group.name
Expand Down

0 comments on commit 9cdc7b5

Please sign in to comment.