Skip to content

Commit

Permalink
Add request HistoryElement for deleted state
Browse files Browse the repository at this point in the history
This fixes openSUSE#3074
  • Loading branch information
Manuel Schnitzer committed May 5, 2017
1 parent 4ffb4de commit ab2b04c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/app/models/bs_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ def change_state(opts)
history = HistoryElement::RequestReopened
when "new" then
history = HistoryElement::RequestReopened
when "deleted" then
history = HistoryElement::RequestDeleted
else
raise RuntimeError, "Unhandled state #{opts[:newstate]} for history"
end
Expand Down
10 changes: 10 additions & 0 deletions src/api/app/models/history_element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ def description
end
end

class HistoryElement::RequestDeleted < HistoryElement::Request
def color
'red'
end

def description
'Request got deleted'
end
end

class HistoryElement::Review < ::HistoryElement::Base
self.description = 'Review was updated'
self.abstract_class = true
Expand Down
4 changes: 4 additions & 0 deletions src/api/spec/factories/history_elements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
factory :history_element_request_revoked, class: 'HistoryElement::RequestRevoked' do
type { 'HistoryElement::RequestRevoked' }
end

factory :history_element_request_deleted, class: 'HistoryElement::RequestDeleted' do
type { 'HistoryElement::RequestDeleted' }
end
end

0 comments on commit ab2b04c

Please sign in to comment.