FIX: disable avatar education message when 'allow_uploaded_avatars' is

disabled
FEATURE: setting to disable avatar education message
This commit is contained in:
Arpit Jalan 2015-12-14 22:32:40 +05:30
parent f60a53762f
commit e65a7370ef
4 changed files with 25 additions and 2 deletions

View File

@ -1144,12 +1144,14 @@ en:
allow_profile_backgrounds: "Allow users to upload profile backgrounds."
sequential_replies_threshold: "Number posts a user has to make in a row in a topic before being reminded about too many sequential replies. "
sequential_replies_threshold: "Number of posts a user has to make in a row in a topic before being reminded about too many sequential replies."
enable_mobile_theme: "Mobile devices use a mobile-friendly theme, with the ability to switch to the full site. Disable this if you want to use a custom stylesheet that is fully responsive."
dominating_topic_minimum_percent: "What percentage of posts a user has to make in a topic before being reminded about overly dominating a topic."
disable_avatar_education_message: "Disable education message for changing avatar."
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
suppress_uncategorized_badge: "Don't show the badge for uncategorized topics in topic lists."

View File

@ -954,6 +954,7 @@ uncategorized:
educate_until_posts: 2
sequential_replies_threshold: 2
dominating_topic_minimum_percent: 20
disable_avatar_education_message: false
# Reporting
daily_performance_report: false

View File

@ -56,6 +56,12 @@ class ComposerMessagesFinder
# We don't notify users who have avatars or who have been notified already.
return if @user.uploaded_avatar_id || UserHistory.exists_for_user?(@user, :notified_about_avatar)
# Do not notify user if any of the following is true:
# - "disable avatar education message" is enabled
# - "sso overrides avatar" is enabled
# - "allow uploaded avatars" is disabled
return if SiteSetting.disable_avatar_education_message || SiteSetting.sso_overrides_avatar || !SiteSetting.allow_uploaded_avatars
# If we got this far, log that we've nagged them about the avatar
UserHistory.create!(action: UserHistory.actions[:notified_about_avatar], target_user_id: @user.id )

View File

@ -109,6 +109,21 @@ describe ComposerMessagesFinder do
UserHistory.create!(action: UserHistory.actions[:notified_about_avatar], target_user_id: user.id )
expect(finder.check_avatar_notification).to be_blank
end
it "doesn't notify users if 'disable_avatar_education_message' setting is enabled" do
SiteSetting.disable_avatar_education_message = true
expect(finder.check_avatar_notification).to be_blank
end
it "doesn't notify users if 'sso_overrides_avatar' setting is enabled" do
SiteSetting.sso_overrides_avatar = true
expect(finder.check_avatar_notification).to be_blank
end
it "doesn't notify users if 'allow_uploaded_avatars' setting is disabled" do
SiteSetting.allow_uploaded_avatars = false
expect(finder.check_avatar_notification).to be_blank
end
end
context '.check_sequential_replies' do
@ -313,4 +328,3 @@ describe ComposerMessagesFinder do
end
end