Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorBenjamin Neff <benjamin@coding4coffee.ch>2022-07-16 19:17:06 +0300
committerBenjamin Neff <benjamin@coding4coffee.ch>2022-07-20 22:26:58 +0300
commitb5a46cf7bbd5e9a857e26443a40b5b1a6b696cb1 (patch)
tree3ecc4170d8d4e6d1b490561ee883b858d4c25894 /app
parent2d38a24a8688b3db5e8cba90e81a0eccd8086474 (diff)
Fix deprecation warnings for rails 6.0
Diffstat (limited to 'app')
-rw-r--r--app/controllers/people_controller.rb3
-rw-r--r--app/controllers/users_controller.rb6
-rw-r--r--app/models/invitation_code.rb9
-rw-r--r--app/models/user.rb6
-rw-r--r--app/models/user/connecting.rb2
5 files changed, 13 insertions, 13 deletions
diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index f03036e10..f7d4a49a4 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -15,8 +15,7 @@ class PeopleController < ApplicationController
respond_to :json, :only => [:index, :show]
rescue_from ActiveRecord::RecordNotFound do
- render :file => Rails.root.join('public', '404').to_s,
- :format => :html, :layout => false, :status => 404
+ render file: Rails.root.join("public/404.html").to_s, format: :html, layout: false, status: :not_found
end
rescue_from Diaspora::AccountClosed do
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 99a0297a0..f129ecb05 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -34,7 +34,7 @@ class UsersController < ApplicationController
def update_privacy_settings
privacy_params = params.fetch(:user).permit(:strip_exif)
- if current_user.update_attributes(strip_exif: privacy_params[:strip_exif])
+ if current_user.update(strip_exif: privacy_params[:strip_exif])
flash[:notice] = t("users.update.settings_updated")
else
flash[:error] = t("users.update.settings_not_updated")
@@ -199,7 +199,7 @@ class UsersController < ApplicationController
end
def change_language(user_data)
- if @user.update_attributes(user_data)
+ if @user.update(user_data)
I18n.locale = @user.language
flash.now[:notice] = t("users.update.language_changed")
else
@@ -229,7 +229,7 @@ class UsersController < ApplicationController
end
def change_settings(user_data, successful="users.update.settings_updated", error="users.update.settings_not_updated")
- if @user.update_attributes(user_data)
+ if @user.update(user_data)
flash.now[:notice] = t(successful)
else
flash.now[:error] = t(error)
diff --git a/app/models/invitation_code.rb b/app/models/invitation_code.rb
index 428096756..1f941c818 100644
--- a/app/models/invitation_code.rb
+++ b/app/models/invitation_code.rb
@@ -16,17 +16,18 @@ class InvitationCode < ApplicationRecord
end
def add_invites!
- self.update_attributes(:count => self.count+100)
+ update(count: count + 100)
end
def use!
- self.update_attributes(:count => self.count-1)
+ update(count: count - 1)
end
def generate_token
- begin
+ loop do
self.token = SecureRandom.hex(6)
- end while InvitationCode.exists?(:token => self[:token])
+ break unless InvitationCode.default_scoped.exists?(token: token)
+ end
end
def self.default_inviter_or(user)
diff --git a/app/models/user.rb b/app/models/user.rb
index 788fe6aba..131fbcf68 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -250,7 +250,7 @@ class User < ApplicationRecord
def update_post(post, post_hash={})
if self.owns? post
- post.update_attributes(post_hash)
+ post.update(post_hash)
self.dispatch_post(post)
end
end
@@ -375,7 +375,7 @@ class User < ApplicationRecord
########### Profile ######################
def update_profile(params)
if photo = params.delete(:photo)
- photo.update_attributes(:pending => false) if photo.pending
+ photo.update(pending: false) if photo.pending
params[:image_url] = photo.url(:thumb_large)
params[:image_url_medium] = photo.url(:thumb_medium)
params[:image_url_small] = photo.url(:thumb_small)
@@ -383,7 +383,7 @@ class User < ApplicationRecord
params.stringify_keys!
params.slice!(*(Profile.column_names+['tag_string', 'date']))
- if self.profile.update_attributes(params)
+ if profile.update(params)
deliver_profile_update
true
else
diff --git a/app/models/user/connecting.rb b/app/models/user/connecting.rb
index 232dba405..62a3a4a02 100644
--- a/app/models/user/connecting.rb
+++ b/app/models/user/connecting.rb
@@ -58,7 +58,7 @@ class User
if destroy
contact.destroy
else
- contact.update_attributes(direction => false)
+ contact.update(direction => false)
end
end
end