From a9db42a956fb045131b06ba434a74189c96ad651 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Wed, 16 Mar 2016 11:18:09 +0100 Subject: [PATCH] Validations for local profiles --- Dockerfile | 2 ++ app/helpers/stream_entries_helper.rb | 2 +- app/models/account.rb | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f569dbea9..7c0e81afb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,3 +13,5 @@ ADD Gemfile.lock /mastodon/Gemfile.lock RUN bundle install --deployment --without test --without development ADD . /mastodon + +VOLUME ['/mastodon/public/system'] diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index 60955a0a7..5adb09f77 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -25,7 +25,7 @@ module StreamEntriesHelper status.mentions.each { |m| mention_hash[m.acct] = m } coder = HTMLEntities.new - auto_link(coder.encode(status.text), link: :urls, html: { target: '_blank', rel: 'nofollow' }).gsub(Account::MENTION_RE) do |m| + auto_link(coder.encode(status.text), link: :urls, html: { rel: 'nofollow noopener' }).gsub(Account::MENTION_RE) do |m| account = mention_hash[Account::MENTION_RE.match(m)[1]] "#{m.split('@').first}@#{account.acct}" end.html_safe diff --git a/app/models/account.rb b/app/models/account.rb index 7577d7bd8..b3917e6e8 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -12,6 +12,10 @@ class Account < ActiveRecord::Base has_attached_file :header, styles: { medium: '700x335#' } validates_attachment_content_type :header, content_type: /\Aimage\/.*\Z/ + # Local user profile validations + validates :display_name, length: { maximum: 30 }, if: 'local?' + validates :note, length: { maximum: 124 }, if: 'local?' + # Timelines has_many :stream_entries, inverse_of: :account has_many :statuses, inverse_of: :account