kibigo! 8 years ago
commit b323e00bf3
  1. 2
      app/javascript/packs/public.js
  2. 6
      app/lib/feed_manager.rb
  3. 2
      app/models/account.rb
  4. 5
      app/services/post_status_service.rb
  5. 5
      app/services/reblog_service.rb
  6. 2
      app/views/settings/profiles/show.html.haml

@ -87,7 +87,7 @@ function main() {
delegate(document, '.account_note', 'input', ({ target }) => { delegate(document, '.account_note', 'input', ({ target }) => {
const noteCounter = document.querySelector('.note-counter'); const noteCounter = document.querySelector('.note-counter');
if (noteCounter) { if (noteCounter) {
noteCounter.textContent = 160 - length(target.value); noteCounter.textContent = 500 - length(target.value);
} }
}); });
} }

@ -95,6 +95,12 @@ class FeedManager
end end
def filter_from_home?(status, receiver_id) def filter_from_home?(status, receiver_id)
# extremely violent filtering code BEGIN
#filter_string = 'e'
#reggie = Regexp.new(filter_string)
#return true if reggie === status.content || reggie === status.spoiler_text
# extremely violent filtering code END
return true if status.reply? && status.in_reply_to_id.nil? return true if status.reply? && status.in_reply_to_id.nil?
check_for_mutes = [status.account_id] check_for_mutes = [status.account_id]

@ -60,7 +60,7 @@ class Account < ApplicationRecord
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? } validates :username, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? }
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? } validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? } validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
validates :note, length: { maximum: 160 }, if: -> { local? && will_save_change_to_note? } validates :note, length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
# Timelines # Timelines
has_many :stream_entries, inverse_of: :account, dependent: :destroy has_many :stream_entries, inverse_of: :account, dependent: :destroy

@ -36,7 +36,10 @@ class PostStatusService < BaseService
LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text? LinkCrawlWorker.perform_async(status.id) unless status.spoiler_text?
DistributionWorker.perform_async(status.id) DistributionWorker.perform_async(status.id)
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
unless /👁$/.match?(status.content)
Pubsubhubbub::DistributionWorker.perform_async(status.stream_entry.id)
end
if options[:idempotency].present? if options[:idempotency].present?
redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id) redis.setex("idempotency:status:#{account.id}:#{options[:idempotency]}", 3_600, status.id)

@ -20,7 +20,10 @@ class ReblogService < BaseService
reblog = account.statuses.create!(reblog: reblogged_status, text: '') reblog = account.statuses.create!(reblog: reblogged_status, text: '')
DistributionWorker.perform_async(reblog.id) DistributionWorker.perform_async(reblog.id)
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id) unless /👁$/.match?(reblogged_status.content)
Pubsubhubbub::DistributionWorker.perform_async(reblog.stream_entry.id)
end
if reblogged_status.local? if reblogged_status.local?
NotifyService.new.call(reblog.reblog.account, reblog) NotifyService.new.call(reblog.reblog.account, reblog)

@ -6,7 +6,7 @@
.fields-group .fields-group
= f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', count: 30 - @account.display_name.size).html_safe = f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', count: 30 - @account.display_name.size).html_safe
= f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', count: 160 - @account.note.size).html_safe = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', count: 500 - @account.note.size).html_safe
= f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar') = f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar')
= f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header') = f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header')

Loading…
Cancel
Save