openSUSE/open-build-service

View on GitHub
src/api/app/models/history_element/review.rb

Summary

Maintainability
A
15 mins
Test Coverage
B
86%
module HistoryElement
  class Review < HistoryElement::Base
    self.description = 'Review was updated'
    self.abstract_class = true

    def review
      ::Review.find(op_object_id)
    end

    def request
      review.bs_request
    end

    def review=(review)
      self.op_object_id = review.id
    end

    def render_xml(builder)
      attributes = { who: user.login, when: created_at.strftime('%Y-%m-%dT%H:%M:%S') }
      builder.history(attributes) do
        builder.description!(description)
        builder.comment!(comment) if comment.present?
      end
    end
  end
end