mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
DataOutputAgent should not override events
in each event
This fixes #1963.
This commit is contained in:
parent
b12fe2c80a
commit
652eb4418f
2 changed files with 23 additions and 3 deletions
|
@ -246,9 +246,7 @@ module Agents
|
|||
|
||||
source_events = sort_events(latest_events(), 'events_list_order')
|
||||
|
||||
interpolation_context.stack do
|
||||
interpolation_context['events'] = source_events
|
||||
|
||||
interpolate_with('events' => source_events) do
|
||||
items = source_events.map do |event|
|
||||
interpolated = interpolate_options(options['template']['item'], event)
|
||||
interpolated['guid'] = {'_attributes' => {'isPermaLink' => 'false'},
|
||||
|
|
|
@ -324,6 +324,28 @@ describe Agents::DataOutputAgent do
|
|||
|
||||
expect(content['title']).to eq('XKCD comics as a feed (XKCD)')
|
||||
end
|
||||
|
||||
context "with event with \"events\"" do
|
||||
before do
|
||||
agent.sources.first.create_event payload: {
|
||||
'site_title' => 'XKCD',
|
||||
'url' => 'http://imgs.xkcd.com/comics/comicX.png',
|
||||
'title' => 'Comic X',
|
||||
'date' => '',
|
||||
'hovertext' => 'Hovertext for Comic X',
|
||||
'events' => 'Events!'
|
||||
}
|
||||
agent.options['template']['item']['events_data'] = "{{ events }}"
|
||||
agent.save!
|
||||
end
|
||||
|
||||
it "can access the value without being overridden" do
|
||||
content, status, content_type = agent.receive_web_request({ 'secret' => 'secret2' }, 'get', 'application/json')
|
||||
expect(status).to eq(200)
|
||||
|
||||
expect(content['items'].first['events_data']).to eq('Events!')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "with a specified icon" do
|
||||
|
|
Loading…
Add table
Reference in a new issue