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 = =>
|
||||
params = @getParams()
|
||||
@searchTerms = params.search || []
|
||||
@searchTerms.push
|
||||
term: ''
|
||||
group_id: ''
|
||||
|
@ -219,6 +221,8 @@ class AccountEdit extends App.ControllerModal
|
|||
|
||||
removeSearchTerm = (event) =>
|
||||
index = $(event.currentTarget).attr('data-index')
|
||||
params = @getParams()
|
||||
@searchTerms = params.search || []
|
||||
@searchTerms.splice(index, 1)
|
||||
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
|
||||
|
||||
onClosed: =>
|
||||
return if !@isChanged
|
||||
@isChanged = false
|
||||
@load()
|
||||
|
||||
onSubmit: (e) =>
|
||||
@formDisable(e)
|
||||
getParams: =>
|
||||
params = @formParams()
|
||||
search = []
|
||||
position = 0
|
||||
|
@ -269,12 +267,21 @@ class AccountEdit extends App.ControllerModal
|
|||
position += 1
|
||||
else
|
||||
search.push params.search
|
||||
params.search = search
|
||||
if params.track_retweets
|
||||
params.track_retweets = true
|
||||
else
|
||||
params.track_retweets = false
|
||||
params.search = search
|
||||
@channel.options.sync = params
|
||||
params
|
||||
|
||||
onClosed: =>
|
||||
return if !@isChanged
|
||||
@isChanged = false
|
||||
@load()
|
||||
|
||||
onSubmit: (e) =>
|
||||
@formDisable(e)
|
||||
@channel.options.sync = @getParams()
|
||||
@ajax(
|
||||
id: 'channel_twitter_update'
|
||||
type: 'POST'
|
||||
|
|
|
@ -222,6 +222,8 @@ returns
|
|||
if sync['search']
|
||||
hashtags = []
|
||||
sync['search'].each do |item|
|
||||
next if item['term'].blank?
|
||||
next if item['group_id'].blank?
|
||||
hashtags.push item['term']
|
||||
end
|
||||
filter[:track] = hashtags.join(',')
|
||||
|
@ -253,7 +255,7 @@ returns
|
|||
next if @stream_client.tweet_limit_reached(tweet, 2)
|
||||
|
||||
# check if it's mention
|
||||
if sync['mentions'] && sync['mentions']['group_id'] != ''
|
||||
if sync['mentions'] && sync['mentions']['group_id'].present?
|
||||
hit = false
|
||||
if tweet.user_mentions
|
||||
tweet.user_mentions.each do |user|
|
||||
|
@ -272,6 +274,8 @@ returns
|
|||
if sync['search'] && tweet.hashtags
|
||||
hit = false
|
||||
sync['search'].each do |item|
|
||||
next if item['term'].blank?
|
||||
next if item['group_id'].blank?
|
||||
tweet.hashtags.each do |hashtag|
|
||||
next if item['term'] !~ /^#/
|
||||
if item['term'].sub(/^#/, '') == hashtag.text
|
||||
|
@ -290,7 +294,8 @@ returns
|
|||
hit = false
|
||||
body = tweet.text
|
||||
sync['search'].each do |item|
|
||||
next if item['term'] =~ /^#/
|
||||
next if item['term'].blank?
|
||||
next if item['group_id'].blank?
|
||||
if body =~ /#{item['term']}/
|
||||
hit = item
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue