current_user.settings(:notification_emails).favourite = user_params[:notification_emails][:favourite] == '1'
current_user.settings(:notification_emails).mention = user_params[:notification_emails][:mention] == '1'
- if current_user.update(user_params.except(:notification_emails))
+ current_user.settings(:interactions).must_be_follower = user_params[:interactions][:must_be_follower] == '1'
+ current_user.settings(:interactions).must_be_following = user_params[:interactions][:must_be_following] == '1'
+
+ if current_user.update(user_params.except(:notification_emails, :interactions))
redirect_to settings_preferences_path, notice: I18n.t('generic.changes_saved_msg')
else
render action: :show
private
def user_params
- params.require(:user).permit(:locale, notification_emails: [:follow, :reblog, :favourite, :mention])
+ params.require(:user).permit(:locale, notification_emails: [:follow, :reblog, :favourite, :mention], interactions: [:must_be_follower, :must_be_following])
end
end
def filter_from_mentions?(status, receiver)
should_filter = receiver.id == status.account_id # Filter if I'm mentioning myself
should_filter ||= receiver.blocking?(status.account) # or it's from someone I blocked
- should_filter ||= receiver.blocking?(status.mentions.map(&:account_id)) # or if it mentions someone I blocked
+ should_filter ||= receiver.blocking?(status.mentions.includes(:account).map(&:account)) # or if it mentions someone I blocked
if status.reply? && !status.thread.account.nil? # or it's a reply
should_filter ||= receiver.blocking?(status.thread.account) # to a user I blocked
def filter_from_public?(status, receiver)
should_filter = receiver.blocking?(status.account)
- should_filter ||= receiver.blocking?(status.mentions.map(&:account_id))
+ should_filter ||= receiver.blocking?(status.mentions.includes(:account).map(&:account))
if status.reply? && !status.thread.account.nil?
should_filter ||= receiver.blocking?(status.thread.account)
has_settings do |s|
s.key :notification_emails, defaults: { follow: false, reblog: false, favourite: false, mention: false }
+ s.key :interactions, defaults: { must_be_follower: false, must_be_following: false }
end
def send_devise_notification(notification, *args)
blocked = false
blocked ||= @recipient.id == @notification.from_account.id
blocked ||= @recipient.blocking?(@notification.from_account)
+ blocked ||= (@recipient.user.settings(:interactions).must_be_follower && !@notification.from_account.following?(@recipient))
+ blocked ||= (@recipient.user.settings(:interactions).must_be_following && !@recipient.following?(@notification.from_account))
blocked ||= send("blocked_#{@notification.type}?")
blocked
end
= ff.input :favourite, as: :boolean, wrapper: :with_label
= ff.input :mention, as: :boolean, wrapper: :with_label
+ = f.simple_fields_for :interactions, current_user.settings(:interactions) do |ff|
+ = ff.input :must_be_follower, as: :boolean, wrapper: :with_label
+ = ff.input :must_be_following, as: :boolean, wrapper: :with_label
+
.actions
= f.button :button, t('generic.save_changes'), type: :submit
- app/assets/fonts
- app/assets/videos
-ignore_missing:
- - '{devise,simple_form}.*'
-
ignore_unused:
- 'activerecord.attributes.*'
- '{devise,will_paginate,doorkeeper}.*'
follow: E-mail senden, wenn mir jemand folgt
mention: E-mail senden, wenn mich jemand erwähnt
reblog: E-mail senden, wenn jemand meinen Beitrag teilt
+ interactions:
+ must_be_follower: Benachrichtigungen von nicht-Folgern blockieren
+ must_be_following: Benachrichtigungen von Nutzern blockieren, denen ich nicht folge
'no': Nein
required:
mark: "*"
follow: Send e-mail when someone follows you
mention: Send e-mail when someone mentions you
reblog: Send e-mail when someone reblogs your status
+ interactions:
+ must_be_follower: Block notifications from non-followers
+ must_be_following: Block notifications from people you don't follow
'no': 'No'
required:
mark: "*"