Improved error handling.

This commit is contained in:
Martin Edenhofer 2016-01-02 17:10:12 +01:00
parent 7360985c21
commit d25cd7da59
3 changed files with 7 additions and 5 deletions

View file

@ -141,6 +141,7 @@ class Index extends App.ControllerContent
groupSelection(group_id, placeholder, 'search') groupSelection(group_id, placeholder, 'search')
content.find('.js-searchTermList').append(placeholder) content.find('.js-searchTermList').append(placeholder)
if channel.options && channel.options.sync && channel.options.sync.search
for item in channel.options.sync.search for item in channel.options.sync.search
placeholderAdd(item.term, item.group_id, 'search') placeholderAdd(item.term, item.group_id, 'search')

View file

@ -121,7 +121,7 @@ class Channel::Driver::Twitter
counter = 0 counter = 0
@tweet.client.search(search[:term], result_type: result_type).collect { |tweet| @tweet.client.search(search[:term], result_type: result_type).collect { |tweet|
break if search[:limit] && search[:limit] <= counter break if @sync[:limit] && @sync[:limit] <= counter
break if Ticket::Article.find_by(message_id: tweet.id) break if Ticket::Article.find_by(message_id: tweet.id)
@tweet.to_group(tweet, search[:group_id], @channel) @tweet.to_group(tweet, search[:group_id], @channel)
@ -141,7 +141,7 @@ class Channel::Driver::Twitter
counter = 0 counter = 0
@tweet.client.mentions_timeline.each { |tweet| @tweet.client.mentions_timeline.each { |tweet|
break if @sync[:mentions][:limit] && @sync[:mentions][:limit] <= counter break if @sync[:limit] && @sync[:limit] <= counter
break if Ticket::Article.find_by(message_id: tweet.id) break if Ticket::Article.find_by(message_id: tweet.id)
@tweet.to_group(tweet, @sync[:mentions][:group_id], @channel) @tweet.to_group(tweet, @sync[:mentions][:group_id], @channel)
@ -160,7 +160,7 @@ class Channel::Driver::Twitter
counter = 0 counter = 0
@tweet.client.direct_messages.each { |tweet| @tweet.client.direct_messages.each { |tweet|
break if @sync[:direct_messages][:limit] && @sync[:direct_messages][:limit] <= counter break if @sync[:limit] && @sync[:limit] <= counter
break if Ticket::Article.find_by(message_id: tweet.id) break if Ticket::Article.find_by(message_id: tweet.id)
@tweet.to_group(tweet, @sync[:direct_messages][:group_id], @channel) @tweet.to_group(tweet, @sync[:direct_messages][:group_id], @channel)

View file

@ -69,6 +69,7 @@ class ExternalCredential::Twitter
oauth_token_secret: access_token.secret, oauth_token_secret: access_token.secret,
}, },
sync: { sync: {
limit: 20,
search: [], search: [],
mentions: {}, mentions: {},
direct_messages: {} direct_messages: {}