about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/salmon_controller.rb2
-rw-r--r--app/controllers/api/subscriptions_controller.rb8
-rw-r--r--app/controllers/api_controller.rb2
-rw-r--r--app/controllers/auth/registrations_controller.rb4
-rw-r--r--app/controllers/oauth/applications_controller.rb2
-rw-r--r--app/controllers/xrd_controller.rb4
-rw-r--r--app/models/account.rb6
-rw-r--r--app/models/application_record.rb3
-rw-r--r--app/models/favourite.rb2
-rw-r--r--app/models/follow.rb2
-rw-r--r--app/models/mention.rb2
-rw-r--r--app/models/status.rb2
-rw-r--r--app/models/stream_entry.rb2
-rw-r--r--app/models/user.rb2
14 files changed, 23 insertions, 20 deletions
diff --git a/app/controllers/api/salmon_controller.rb b/app/controllers/api/salmon_controller.rb
index b15aefee9..329b258a4 100644
--- a/app/controllers/api/salmon_controller.rb
+++ b/app/controllers/api/salmon_controller.rb
@@ -4,7 +4,7 @@ class Api::SalmonController < ApiController
 
   def update
     ProcessInteractionService.new.(request.body.read, @account)
-    render nothing: true, status: 201
+    head 201
   end
 
   private
diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb
index 91b987ce4..e923b9b66 100644
--- a/app/controllers/api/subscriptions_controller.rb
+++ b/app/controllers/api/subscriptions_controller.rb
@@ -4,9 +4,9 @@ class Api::SubscriptionsController < ApiController
 
   def show
     if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic'], params['hub.verify_token'])
-      render text: HTMLEntities.new.encode(params['hub.challenge']), status: 200
+      render plain: HTMLEntities.new.encode(params['hub.challenge']), status: 200
     else
-      render nothing: true, status: 404
+      head 404
     end
   end
 
@@ -15,9 +15,9 @@ class Api::SubscriptionsController < ApiController
 
     if @account.subscription(api_subscription_url(@account.id)).verify(body, request.headers['HTTP_X_HUB_SIGNATURE'])
       ProcessFeedService.new.(body, @account)
-      render nothing: true, status: 201
+      head 201
     else
-      render nothing: true, status: 202
+      head 202
     end
   end
 
diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb
index 35f1e62c5..8a2712476 100644
--- a/app/controllers/api_controller.rb
+++ b/app/controllers/api_controller.rb
@@ -1,6 +1,6 @@
 class ApiController < ApplicationController
   protect_from_forgery with: :null_session
-  skip_before_filter :verify_authenticity_token
+  skip_before_action :verify_authenticity_token
 
   protected
 
diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb
index ad0fd4437..8472edc69 100644
--- a/app/controllers/auth/registrations_controller.rb
+++ b/app/controllers/auth/registrations_controller.rb
@@ -11,8 +11,8 @@ class Auth::RegistrationsController < Devise::RegistrationsController
   end
 
   def configure_sign_up_params
-    devise_parameter_sanitizer.for(:sign_up) do |u|
-      u.permit(:email, :password, :password_confirmation, account_attributes: [:username])
+    devise_parameter_sanitizer.permit(:sign_up) do |u|
+      u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation)
     end
   end
 
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index 4614ef2f7..47935bf7c 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -1,5 +1,5 @@
 class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
-  before_filter :authenticate_user!
+  before_action :authenticate_user!
 
   def index
     @applications = current_user.oauth_applications
diff --git a/app/controllers/xrd_controller.rb b/app/controllers/xrd_controller.rb
index fa67b2baa..1e39a3e4c 100644
--- a/app/controllers/xrd_controller.rb
+++ b/app/controllers/xrd_controller.rb
@@ -1,5 +1,5 @@
 class XrdController < ApplicationController
-  before_filter :set_format
+  before_action :set_format
 
   def host_meta
     @webfinger_template = "#{webfinger_url}?resource={uri}"
@@ -10,7 +10,7 @@ class XrdController < ApplicationController
     @canonical_account_uri = "acct:#{@account.username}@#{Rails.configuration.x.local_domain}"
     @magic_key = pem_to_magic_key(@account.keypair.public_key)
   rescue ActiveRecord::RecordNotFound
-    render nothing: true, status: 404
+    head 404
   end
 
   private
diff --git a/app/models/account.rb b/app/models/account.rb
index f61f4c765..cc050dfa3 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -1,10 +1,10 @@
-class Account < ActiveRecord::Base
+class Account < ApplicationRecord
   include Targetable
 
   # Local users
   has_one :user, inverse_of: :account
-  validates :username, uniqueness: { scope: :domain, case_sensitive: false }, if:     'local?'
-  validates :username, uniqueness: { scope: :domain, case_sensitive: true },  unless: 'local?'
+  validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: false }, if:     'local?'
+  validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true },  unless: 'local?'
 
   # Avatar upload
   has_attached_file :avatar, styles: { large: '300x300#', medium: '96x96#', small: '48x48#' }, default_url: 'avatars/missing.png'
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
new file mode 100644
index 000000000..10a4cba84
--- /dev/null
+++ b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+  self.abstract_class = true
+end
diff --git a/app/models/favourite.rb b/app/models/favourite.rb
index 46310a5ff..6032e539c 100644
--- a/app/models/favourite.rb
+++ b/app/models/favourite.rb
@@ -1,4 +1,4 @@
-class Favourite < ActiveRecord::Base
+class Favourite < ApplicationRecord
   include Streamable
 
   belongs_to :account, inverse_of: :favourites
diff --git a/app/models/follow.rb b/app/models/follow.rb
index 94263b1a7..456e2c4f4 100644
--- a/app/models/follow.rb
+++ b/app/models/follow.rb
@@ -1,4 +1,4 @@
-class Follow < ActiveRecord::Base
+class Follow < ApplicationRecord
   include Streamable
 
   belongs_to :account
diff --git a/app/models/mention.rb b/app/models/mention.rb
index 9fefa657a..b39fa2cbb 100644
--- a/app/models/mention.rb
+++ b/app/models/mention.rb
@@ -1,4 +1,4 @@
-class Mention < ActiveRecord::Base
+class Mention < ApplicationRecord
   belongs_to :account, inverse_of: :mentions
   belongs_to :status
 
diff --git a/app/models/status.rb b/app/models/status.rb
index 7ea92df2c..14a698aae 100644
--- a/app/models/status.rb
+++ b/app/models/status.rb
@@ -1,4 +1,4 @@
-class Status < ActiveRecord::Base
+class Status < ApplicationRecord
   include Paginable
   include Streamable
 
diff --git a/app/models/stream_entry.rb b/app/models/stream_entry.rb
index 2972d94f6..165f62f20 100644
--- a/app/models/stream_entry.rb
+++ b/app/models/stream_entry.rb
@@ -1,4 +1,4 @@
-class StreamEntry < ActiveRecord::Base
+class StreamEntry < ApplicationRecord
   include Paginable
 
   belongs_to :account, inverse_of: :stream_entries
diff --git a/app/models/user.rb b/app/models/user.rb
index a80efb50d..71e310cc8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,4 +1,4 @@
-class User < ActiveRecord::Base
+class User < ApplicationRecord
   devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
 
   belongs_to :account, inverse_of: :user