File: _event.atom.builder

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (31 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

return unless event.visible_to_user?(current_user)

event = event.present
event_url = event_feed_url(event)

xml.entry do
  xml.id      "tag:#{request.host},#{event.created_at.to_date.iso8601}:#{event.id}"
  xml.link    href: event_url if event_url
  xml.title   truncate(event_feed_title(event), length: 160)
  xml.updated event.updated_at.xmlschema

  # We're deliberately re-using "event.author" here since this data is
  # eager-loaded. This allows us to re-use the user object's Email address,
  # instead of having to run additional queries to figure out what Email to use
  # for the avatar.
  xml.media   :thumbnail, width: "40", height: "40", url: image_url(avatar_icon_for_user(event.author))

  xml.author do
    xml.username event.author_username
    xml.name event.author_name
    xml.email event.author_public_email
  end

  xml.summary(type: "xhtml") do |summary|
    event_summary = event_feed_summary(event)

    summary << event_summary unless event_summary.nil?
  end
end