Skip to content

Commit

Permalink
Fix non-lowercase hashtags not being picked up by the streaming API (m…
Browse files Browse the repository at this point in the history
…astodon#11508)

Regression from f371b32

Fix hashtag links always being lowercase
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 3551162 commit 18bb9ed
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/javascript/mastodon/components/status_content.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default class StatusContent extends React.PureComponent {
}

onHashtagClick = (hashtag, e) => {
hashtag = hashtag.replace(/^#/, '').toLowerCase();
hashtag = hashtag.replace(/^#/, '');

if (this.context.router && e.button === 0 && !(e.ctrlKey || e.metaKey)) {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion app/lib/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def link_html(url)
end

def hashtag_html(tag)
"<a href=\"#{encode(tag_url(tag.downcase))}\" class=\"mention hashtag\" rel=\"tag\">#<span>#{encode(tag)}</span></a>"
"<a href=\"#{encode(tag_url(tag))}\" class=\"mention hashtag\" rel=\"tag\">#<span>#{encode(tag)}</span></a>"
end

def mention_html(account)
Expand Down
4 changes: 2 additions & 2 deletions app/services/batched_remove_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def unpush_from_public_timelines(status)
end

@tags[status.id].each do |hashtag|
redis.publish("timeline:hashtag:#{hashtag}", payload)
redis.publish("timeline:hashtag:#{hashtag}:local", payload) if status.local?
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", payload)
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", payload) if status.local?
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/services/fan_out_on_write_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ def deliver_to_hashtags(status)
Rails.logger.debug "Delivering status #{status.id} to hashtags"

status.tags.pluck(:name).each do |hashtag|
Redis.current.publish("timeline:hashtag:#{hashtag}", @payload)
Redis.current.publish("timeline:hashtag:#{hashtag}:local", @payload) if status.local?
Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", @payload)
Redis.current.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", @payload) if status.local?
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/services/remove_status_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def remove_from_hashtags
return unless @status.public_visibility?

@tags.each do |hashtag|
redis.publish("timeline:hashtag:#{hashtag}", @payload)
redis.publish("timeline:hashtag:#{hashtag}:local", @payload) if @status.local?
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}", @payload)
redis.publish("timeline:hashtag:#{hashtag.mb_chars.downcase}:local", @payload) if @status.local?
end
end

Expand Down

0 comments on commit 18bb9ed

Please sign in to comment.