Fixed small twitter ui/usability issues.
This commit is contained in:
parent
e54f3f99a8
commit
383eee4db9
2 changed files with 23 additions and 11 deletions
|
@ -211,6 +211,8 @@ class AccountEdit extends App.ControllerModal
|
||||||
)
|
)
|
||||||
|
|
||||||
addSearchTerm = =>
|
addSearchTerm = =>
|
||||||
|
params = @getParams()
|
||||||
|
@searchTerms = params.search || []
|
||||||
@searchTerms.push
|
@searchTerms.push
|
||||||
term: ''
|
term: ''
|
||||||
group_id: ''
|
group_id: ''
|
||||||
|
@ -219,6 +221,8 @@ class AccountEdit extends App.ControllerModal
|
||||||
|
|
||||||
removeSearchTerm = (event) =>
|
removeSearchTerm = (event) =>
|
||||||
index = $(event.currentTarget).attr('data-index')
|
index = $(event.currentTarget).attr('data-index')
|
||||||
|
params = @getParams()
|
||||||
|
@searchTerms = params.search || []
|
||||||
@searchTerms.splice(index, 1)
|
@searchTerms.splice(index, 1)
|
||||||
renderSearchTerms()
|
renderSearchTerms()
|
||||||
|
|
||||||
|
@ -249,13 +253,7 @@ class AccountEdit extends App.ControllerModal
|
||||||
content.find('.js-directMessagesGroup').replaceWith createGroupSelection(@channel.options.sync.direct_messages.group_id, 'direct_messages')
|
content.find('.js-directMessagesGroup').replaceWith createGroupSelection(@channel.options.sync.direct_messages.group_id, 'direct_messages')
|
||||||
content
|
content
|
||||||
|
|
||||||
onClosed: =>
|
getParams: =>
|
||||||
return if !@isChanged
|
|
||||||
@isChanged = false
|
|
||||||
@load()
|
|
||||||
|
|
||||||
onSubmit: (e) =>
|
|
||||||
@formDisable(e)
|
|
||||||
params = @formParams()
|
params = @formParams()
|
||||||
search = []
|
search = []
|
||||||
position = 0
|
position = 0
|
||||||
|
@ -269,12 +267,21 @@ class AccountEdit extends App.ControllerModal
|
||||||
position += 1
|
position += 1
|
||||||
else
|
else
|
||||||
search.push params.search
|
search.push params.search
|
||||||
|
params.search = search
|
||||||
if params.track_retweets
|
if params.track_retweets
|
||||||
params.track_retweets = true
|
params.track_retweets = true
|
||||||
else
|
else
|
||||||
params.track_retweets = false
|
params.track_retweets = false
|
||||||
params.search = search
|
params
|
||||||
@channel.options.sync = params
|
|
||||||
|
onClosed: =>
|
||||||
|
return if !@isChanged
|
||||||
|
@isChanged = false
|
||||||
|
@load()
|
||||||
|
|
||||||
|
onSubmit: (e) =>
|
||||||
|
@formDisable(e)
|
||||||
|
@channel.options.sync = @getParams()
|
||||||
@ajax(
|
@ajax(
|
||||||
id: 'channel_twitter_update'
|
id: 'channel_twitter_update'
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
|
|
|
@ -222,6 +222,8 @@ returns
|
||||||
if sync['search']
|
if sync['search']
|
||||||
hashtags = []
|
hashtags = []
|
||||||
sync['search'].each do |item|
|
sync['search'].each do |item|
|
||||||
|
next if item['term'].blank?
|
||||||
|
next if item['group_id'].blank?
|
||||||
hashtags.push item['term']
|
hashtags.push item['term']
|
||||||
end
|
end
|
||||||
filter[:track] = hashtags.join(',')
|
filter[:track] = hashtags.join(',')
|
||||||
|
@ -253,7 +255,7 @@ returns
|
||||||
next if @stream_client.tweet_limit_reached(tweet, 2)
|
next if @stream_client.tweet_limit_reached(tweet, 2)
|
||||||
|
|
||||||
# check if it's mention
|
# check if it's mention
|
||||||
if sync['mentions'] && sync['mentions']['group_id'] != ''
|
if sync['mentions'] && sync['mentions']['group_id'].present?
|
||||||
hit = false
|
hit = false
|
||||||
if tweet.user_mentions
|
if tweet.user_mentions
|
||||||
tweet.user_mentions.each do |user|
|
tweet.user_mentions.each do |user|
|
||||||
|
@ -272,6 +274,8 @@ returns
|
||||||
if sync['search'] && tweet.hashtags
|
if sync['search'] && tweet.hashtags
|
||||||
hit = false
|
hit = false
|
||||||
sync['search'].each do |item|
|
sync['search'].each do |item|
|
||||||
|
next if item['term'].blank?
|
||||||
|
next if item['group_id'].blank?
|
||||||
tweet.hashtags.each do |hashtag|
|
tweet.hashtags.each do |hashtag|
|
||||||
next if item['term'] !~ /^#/
|
next if item['term'] !~ /^#/
|
||||||
if item['term'].sub(/^#/, '') == hashtag.text
|
if item['term'].sub(/^#/, '') == hashtag.text
|
||||||
|
@ -290,7 +294,8 @@ returns
|
||||||
hit = false
|
hit = false
|
||||||
body = tweet.text
|
body = tweet.text
|
||||||
sync['search'].each do |item|
|
sync['search'].each do |item|
|
||||||
next if item['term'] =~ /^#/
|
next if item['term'].blank?
|
||||||
|
next if item['group_id'].blank?
|
||||||
if body =~ /#{item['term']}/
|
if body =~ /#{item['term']}/
|
||||||
hit = item
|
hit = item
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue