Browse Source

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

Regression from f371b32

Fix hashtag links always being lowercase
master^2
Eugen Rochko 4 years ago
committed by GitHub
parent
commit
5e35aa8280
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 8 deletions
  1. +1
    -1
      app/javascript/mastodon/components/status_content.js
  2. +1
    -1
      app/lib/formatter.rb
  3. +2
    -2
      app/services/batched_remove_status_service.rb
  4. +2
    -2
      app/services/fan_out_on_write_service.rb
  5. +2
    -2
      app/services/remove_status_service.rb

+ 1
- 1
app/javascript/mastodon/components/status_content.js View File

@@ -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();


+ 1
- 1
app/lib/formatter.rb View File

@@ -294,7 +294,7 @@ class Formatter
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)


+ 2
- 2
app/services/batched_remove_status_service.rb View File

@@ -80,8 +80,8 @@ class BatchedRemoveStatusService < BaseService
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


+ 2
- 2
app/services/fan_out_on_write_service.rb View File

@@ -72,8 +72,8 @@ class FanOutOnWriteService < BaseService
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



+ 2
- 2
app/services/remove_status_service.rb View File

@@ -124,8 +124,8 @@ class RemoveStatusService < BaseService
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



Loading…
Cancel
Save