Compare commits

..

33 Commits

Author SHA1 Message Date
Eugen Rochko
5322654945 Merge branch 'master' into skylight 2017-04-19 19:24:31 +02:00
Eugen Rochko
fcaa6ec4a6 Don't link robots.txt 2017-04-19 18:34:20 +02:00
Eugen Rochko
910ae09426 Merge branch 'master' into skylight 2017-04-19 17:48:44 +02:00
Eugen Rochko
9a97beb3a5 Merge branch 'master' into skylight 2017-04-16 23:33:35 +02:00
Eugen Rochko
1ebcdf84b5 Merge branch 'master' into skylight 2017-04-13 22:28:33 +02:00
Eugen Rochko
791c0edfe8 Merge branch 'master' into skylight 2017-04-13 22:22:26 +02:00
Eugen Rochko
17c2ba7366 Merge branch 'master' into skylight 2017-04-13 21:55:13 +02:00
Eugen Rochko
f4ab6b9f2c Merge branch 'master' into skylight 2017-04-12 21:12:07 +02:00
Eugen Rochko
f63ccd8787 Change deploy 2017-04-12 18:25:34 +02:00
Eugen Rochko
7a1903cdf7 Merge branch 'master' into skylight 2017-04-12 11:28:37 +02:00
Eugen Rochko
4142036f2b Merge branch 'master' into skylight 2017-04-09 21:02:59 +02:00
Eugen Rochko
24656a9f8f Merge branch 'master' into skylight 2017-04-09 19:14:08 +02:00
Eugen Rochko
47910f57da Merge branch 'master' into skylight 2017-04-09 15:01:17 +02:00
Eugen Rochko
2a4499bb23 Merge branch 'master' into skylight 2017-04-08 22:27:03 +02:00
Eugen Rochko
e258d05848 Merge branch 'master' into skylight 2017-04-08 13:27:04 +02:00
Eugen Rochko
7c81c0f7cb Merge branch 'master' into skylight 2017-04-08 13:24:25 +02:00
Eugen Rochko
1ec81ccec0 Merge branch 'master' into skylight 2017-04-07 13:09:25 +02:00
Eugen Rochko
3fa8505769 Merge branch 'master' into skylight 2017-04-07 12:25:10 +02:00
Eugen Rochko
011bcbf21f Merge branch 'feature-ox-fix' into skylight 2017-04-07 11:09:29 +02:00
Eugen Rochko
6164662e1f Force UTF8 encoding on generated XML 2017-04-07 11:05:36 +02:00
Eugen Rochko
ed4d2d8a69 Merge branch 'master' into skylight 2017-04-07 05:59:59 +02:00
Eugen Rochko
453c15ab76 Merge branch 'master' into skylight 2017-04-07 00:06:58 +02:00
Eugen Rochko
2dc2003b99 Disable prepared_statements in production to allow use of pgbouncer 2017-04-06 20:50:13 +02:00
Eugen Rochko
4d1217d8f9 Merge branch 'master' into skylight 2017-04-06 20:50:05 +02:00
Eugen Rochko
0468256ab0 Merge branch 'master' into skylight 2017-04-06 02:27:36 +02:00
Eugen Rochko
634110d8bd Move ProcessingWorker/SalmonWorker into pull queue 2017-04-06 00:21:00 +02:00
Eugen Rochko
40d390e85d Merge branch 'master' into skylight 2017-04-05 21:44:22 +02:00
Eugen Rochko
31e086de0e Merge branch 'master' into skylight 2017-04-05 20:00:21 +02:00
Eugen Rochko
196e44b30b Merge branch 'master' into skylight 2017-04-05 14:29:51 +02:00
Eugen Rochko
945e5bf9cc Merge branch 'master' into skylight 2017-04-05 13:34:46 +02:00
Eugen Rochko
a24d55eed8 Add sidekiq-skylight 2017-04-05 02:36:06 +02:00
Eugen Rochko
7f7a67a7c1 Merge branch 'master' into skylight 2017-04-05 02:34:54 +02:00
Eugen Rochko
300bc70123 Add Skylight 2017-04-04 22:32:22 +02:00
17 changed files with 37 additions and 99 deletions

View File

@@ -36,8 +36,7 @@ OTP_SECRET=
# E-mail configuration
# Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers
# If you want to use an SMTP server without authentication (e.g local Postfix relay)
# then set SMTP_AUTH_METHOD to 'none' and *comment* SMTP_LOGIN and SMTP_PASSWORD.
# Leaving them blank is not enough for authentication method 'none'.
# then set SMTP_AUTH_METHOD to 'none' and leave SMTP_LOGIN and SMTP_PASSWORD blank
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
SMTP_LOGIN=

View File

@@ -1,7 +1,5 @@
language: ruby
cache: bundler
dist: trusty
sudo: required
notifications:
email: false
@@ -26,9 +24,8 @@ bundler_args: --without development production --retry=3 --jobs=3
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo add-apt-repository -y ppa:mc3man/trusty-media
- sudo apt-get -qq update
- sudo apt-get -qq install g++-4.8 ffmpeg
- sudo apt-get -qq install g++-4.8
install:
- nvm install
- npm install -g yarn

View File

@@ -62,6 +62,9 @@ gem 'react-rails'
gem 'browserify-rails'
gem 'autoprefixer-rails'
gem 'skylight'
gem 'sidekiq-skylight'
group :development, :test do
gem 'rspec-rails'
gem 'pry-rails'

View File

@@ -401,6 +401,9 @@ GEM
connection_pool (~> 2.2, >= 2.2.0)
rack-protection (>= 1.5.0)
redis (~> 3.2, >= 3.2.1)
sidekiq-skylight (0.2.0)
sidekiq (>= 3.3.0)
skylight (>= 0.5.2)
sidekiq-unique-jobs (5.0.0)
sidekiq (>= 4.0)
thor
@@ -414,6 +417,8 @@ GEM
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
skylight (1.2.0)
activesupport (>= 3.0.0)
slop (3.6.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
@@ -532,10 +537,12 @@ DEPENDENCIES
ruby-oembed
sass-rails (~> 5.0)
sidekiq
sidekiq-skylight
sidekiq-unique-jobs
simple-navigation
simple_form
simplecov
skylight
sprockets-rails
statsd-instrument
twitter-text

View File

@@ -35,10 +35,6 @@ const es = {
"column.community": "Historia local",
"column.public": "Historia federada",
"column.notifications": "Notificaciones",
"column.blocks": "Usuarios bloqueados",
"column.favourites": "Favoritos",
"column.follow_requests": "Solicitudes para seguirte",
"column.mutes": "Usuarios silenciados",
"tabs_bar.compose": "Redactar",
"tabs_bar.home": "Inicio",
"tabs_bar.mentions": "Menciones",
@@ -60,8 +56,6 @@ const es = {
"navigation_bar.blocks": "Usuarios bloqueados",
"navigation_bar.info": "Información adicional",
"navigation_bar.logout": "Cerrar sesión",
"navigation_bar.follow_requests": "Solicitudes para seguirte",
"navigation_bar.mutes": "Usuarios silenciados",
"reply_indicator.cancel": "Cancelar",
"search.placeholder": "Buscar",
"search.account": "Cuenta",

View File

@@ -11,32 +11,28 @@ const nl = {
"status.sensitive_warning": "Gevoelige inhoud",
"status.sensitive_toggle": "Klik om te zien",
"video_player.toggle_sound": "Geluid in-/uitschakelen",
"account.mention": "Vermeld @{name}",
"account.mention": "@{name} vermelden",
"account.edit_profile": "Profiel bewerken",
"account.unblock": "Deblokkeer @{name}",
"account.unblock": "@{name} deblokkeren",
"account.unfollow": "Ontvolgen",
"account.block": "Blokkeer @{name}",
"account.block": "@{name} blokkeren",
"account.follow": "Volgen",
"account.posts": "Berichten",
"account.follows": "Volgt",
"account.followers": "Volgers",
"account.follows_you": "Volgt jou",
"account.requested": "Wacht op goedkeuring",
"account.mute": "Negeer @{name}",
"account.unmute": "Negeer @{name} niet meer",
"account.report": "Rapporteer @{name}",
"account.mute": "@{name} negeren",
"account.unmute": "@{name} niet meer negeren",
"account.report": "Report @{name}",
"getting_started.heading": "Beginnen",
"getting_started.about_addressing": "Je kunt mensen volgen als je hun gebruikersnaam en het domein van hun server kent. Voer hiervoor het e-mailachtige adres in het zoekveld in.",
"getting_started.about_shortcuts": "Als de gezochte gebruiker op hetzelfde domein zit als jijzelf, is invoeren van de gebruikersnaam genoeg. Dat geldt ook als je mensen in toots wilt vermelden.",
"getting_started.open_source_notice": "Mastodon is open-sourcesoftware. Je kunt bijdragen of problemen melden op GitHub via {github}. {apps}.",
"getting_started.apps": "Er zijn meerdere apps beschikbaar",
"column.home": "Jouw tijdlijn",
"column.community": "Lokale tijdlijn",
"column.public": "Globale tijdlijn",
"column.notifications": "Meldingen",
"column.favourites": "Favorieten",
"column.blocks": "Geblokkeerde gebruikers",
"column.mutes": "Genegeerde gebruikers",
"tabs_bar.compose": "Schrijven",
"tabs_bar.home": "Jouw tijdlijn",
"tabs_bar.mentions": "Vermeldingen",
@@ -48,7 +44,7 @@ const nl = {
"compose_form.spoiler": "Tekst achter waarschuwing verbergen",
"compose_form.spoiler_placeholder": "Waarschuwingstekst",
"compose_form.private": "Als privé markeren",
"compose_form.privacy_disclaimer": "Jouw privétoot wordt afgeleverd aan de vermelde gebruikers op {domains}. Vertrouw jij {domainsCount, plural, one {die server} other {die servers}}? Het privé plaatsen van toots werkt alleen op Mastodon-servers. Wanneer {domains} {domainsCount, plural, one {geen Mastodon-server is} other {geen Mastodon-servers zijn}}, dan wordt er niet aangegeven dat de toot privé is, waardoor het kan worden geboost of op een andere manier zichtbaar wordt gemaakt voor mensen waarvoor het niet was bedoeld.",
"compose_form.privacy_disclaimer": "Jouw privétoot wordt afgeleverd aan de vermelde gebruikers op {domains}. Vertrouw jij {domainsCount, plural, one {that server} andere {those servers}}? Het privé plaatsen van toots werkt alleen op Mastodon-servers. Als {domains} {domainsCount, plural, een {is not a Mastodon instance} andere {are not Mastodon instances}}, dan wordt er niet aangegeven dat de toot besloten is, waardoor het kan worden geboost of op een andere manier zichtbaar wordt gemaakt voor mensen waarvoor het niet was bedoeld.",
"compose_form.unlisted": "Niet op openbare tijdlijnen tonen",
"navigation_bar.edit_profile": "Profiel bewerken",
"navigation_bar.preferences": "Voorkeuren",
@@ -59,7 +55,6 @@ const nl = {
"navigation_bar.blocks": "Geblokkeerde gebruikers",
"navigation_bar.mutes": "Genegeerde gebruikers",
"navigation_bar.logout": "Afmelden",
"navigation_bar.favourites": "Favorieten",
"reply_indicator.cancel": "Annuleren",
"search.placeholder": "Zoeken",
"search.account": "Account",

View File

@@ -8,7 +8,7 @@ class Account < ApplicationRecord
# Local users
has_one :user, inverse_of: :account
validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: 'local?'
validates :username, presence: true, format: { with: /\A[a-z0-9_]+\z/i, message: 'only letters, numbers and underscores' }, uniqueness: { scope: :domain, case_sensitive: false }, length: { maximum: 30 }, if: 'local?'
validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?'
# Avatar upload

View File

@@ -106,18 +106,13 @@ class MediaAttachment < ApplicationRecord
end
def set_type_and_extension
if file.blank?
self.type = :unknown
else
self.type = VIDEO_MIME_TYPES.include?(file_content_type) ? :video : :image
extension = appropriate_extension
extension = Paperclip::Interpolations.content_type_extension(file, :original)
basename = Paperclip::Interpolations.basename(file, :original)
file.instance_write :file_name, [basename, extension].delete_if(&:empty?).join('.')
end
def appropriate_extension
mime_type = MIME::Types[file.content_type]
extensions_for_mime_type = mime_type.empty? ? [] : mime_type.first.extensions
original_extension = Paperclip::Interpolations.extension(file, :original)
extensions_for_mime_type.include?(original_extension) ? original_extension : extensions_for_mime_type.first
end
end

View File

@@ -29,7 +29,7 @@ class Status < ApplicationRecord
validates :uri, uniqueness: true, unless: 'local?'
validates :text, presence: true, unless: 'reblog?'
validates_with StatusLengthValidator
validates :reblog, uniqueness: { scope: :account }, if: 'reblog?'
validates :reblog, uniqueness: { scope: :account, message: 'of status already exists' }, if: 'reblog?'
default_scope { order('id desc') }

View File

@@ -3,7 +3,7 @@
class ProcessingWorker
include Sidekiq::Worker
sidekiq_options backtrace: true
sidekiq_options queue: 'pull', backtrace: true
def perform(account_id, body)
ProcessFeedService.new.call(body, Account.find(account_id))

View File

@@ -3,7 +3,7 @@
class SalmonWorker
include Sidekiq::Worker
sidekiq_options backtrace: true
sidekiq_options queue: 'pull', backtrace: true
def perform(account_id, body)
ProcessInteractionService.new.call(body, Account.find(account_id))

View File

@@ -1,12 +0,0 @@
en:
activerecord:
errors:
models:
account:
attributes:
username:
invalid: only letters, numbers and underscores
status:
attributes:
reblog:
taken: of status already exists

View File

@@ -1,12 +0,0 @@
ja:
activerecord:
errors:
models:
account:
attributes:
username:
invalid: アルファベット・数値・アンダーバー(_)で入力してください
status:
attributes:
reblog:
taken: のブーストはすでに存在します

View File

@@ -1,14 +1,12 @@
# frozen_string_literal: true
lock '3.8.0'
set :repo_url, ENV.fetch('REPO', 'https://github.com/tootsuite/mastodon.git')
set :branch, ENV.fetch('BRANCH', 'master')
set :application, 'mastodon'
set :repo_url, 'https://github.com/tootsuite/mastodon.git'
set :branch, 'skylight'
set :rbenv_type, :user
set :rbenv_ruby, File.read('.ruby-version').strip
set :migration_role, :app
set :conditional_migrate, true
append :linked_files, '.env.production', 'public/robots.txt'
append :linked_dirs, 'vendor/bundle', 'node_modules', 'public/system'
append :linked_files, '.env.production'
append :linked_dirs, 'vendor/bundle', 'public/system'

View File

@@ -7,11 +7,7 @@ module Paperclip
def make
num_frames = identify('-format %n :file', file: file.path).to_i
unless options[:style] == :original && num_frames > 1
tmp_file = Paperclip::TempfileFactory.new.generate(attachment.instance.file_file_name)
tmp_file << file.read
return tmp_file
end
return file unless options[:style] == :original && num_frames > 1
final_file = Paperclip::Transcoder.make(file, options, attachment)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

View File

@@ -1,27 +1,5 @@
require 'rails_helper'
RSpec.describe MediaAttachment, type: :model do
describe 'animated gif conversion' do
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('avatar.gif')) }
it 'sets type to gifv' do
expect(media.type).to eq 'gifv'
end
it 'converts original file to mp4' do
expect(media.file_content_type).to eq 'video/mp4'
end
end
describe 'non-animated gif non-conversion' do
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.gif')) }
it 'sets type to image' do
expect(media.type).to eq 'image'
end
it 'leaves original file as-is' do
expect(media.file_content_type).to eq 'image/gif'
end
end
end