Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix non-lowercase hashtags not being picked up by the streaming API #11508

Merged
merged 1 commit into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -294,7 +294,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