|
|
@ -72,12 +72,34 @@ module JobStatus |
|
|
|
resource.reference = status_reference |
|
|
|
resource.reference = status_reference |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
new_attributes = args.reverse_merge(status: status, message: nil, payload: nil) |
|
|
|
# Update properties with the language of the user |
|
|
|
resource.update! new_attributes |
|
|
|
# to ensure things like the title are correct |
|
|
|
|
|
|
|
User.execute_as(resource.user) do |
|
|
|
|
|
|
|
resource.attributes = build_status_attributes(args.merge(status: status)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resource.save! |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
protected |
|
|
|
protected |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
|
|
|
# Builds the attributes for updating the status |
|
|
|
|
|
|
|
def build_status_attributes(attributes) |
|
|
|
|
|
|
|
if title |
|
|
|
|
|
|
|
attributes[:payload] ||= {} |
|
|
|
|
|
|
|
attributes[:payload][:title] = title |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
attributes.reverse_merge(message: nil, payload: nil) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
|
|
|
|
# Title of the job status, optional |
|
|
|
|
|
|
|
def title |
|
|
|
|
|
|
|
nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
## |
|
|
|
# Crafts a payload for a redirection result |
|
|
|
# Crafts a payload for a redirection result |
|
|
|
def redirect_payload(path) |
|
|
|
def redirect_payload(path) |
|
|
|