From adb6541635eb1039534595c94023bd2dec343320 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 5 Mar 2014 14:21:53 +1100 Subject: [PATCH] FEATURE: mailing list mode always available --- .../templates/user/preferences.js.handlebars | 10 ++++------ app/mailers/user_notifications.rb | 3 +-- config/locales/server.en.yml | 1 - config/locales/server.fr.yml | 1 - config/locales/server.ru.yml | 3 +-- config/site_settings.yml | 3 --- lib/post_jobs_enqueuer.rb | 12 +++++------- spec/mailers/user_notifications_spec.rb | 1 - spec/models/topic_user_spec.rb | 2 -- 9 files changed, 11 insertions(+), 25 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars index b9b2f886366..d11fcbed3e1 100644 --- a/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/preferences.js.handlebars @@ -103,12 +103,6 @@
- {{#if Discourse.SiteSettings.enable_mailing_list_mode}} - - {{/if}} @@ -120,8 +114,12 @@ {{/if}} + +
diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 51e2f2109c2..6523c925df5 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -141,8 +141,7 @@ class UserNotifications < ActionMailer::Base username = @notification.data_hash[:original_username] notification_type = opts[:notification_type] || Notification.types[@notification.notification_type].to_s - return if SiteSetting.enable_mailing_list_mode && - user.mailing_list_mode && + return if user.mailing_list_mode && ["replied", "mentioned", "quoted", "posted"].include?(notification_type) title = @notification.data_hash[:topic_title] diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index fe40f1d63d6..6fe7616bf3f 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -803,7 +803,6 @@ en: email_in_address: "The email address the users can post new topics to. None means users can't post globally." email_in_min_trust: "The minimum trust level an users needs to have to be allowed to post new topics via email" email_in_category: "The category new emails are posted into" - enable_mailing_list_mode: "Allow users to (optionally) opt-in to mailing list mode via a user preference" minimum_topics_similar: "How many topics need to exist in the database before similar topics are presented." diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml index a2bfbe5e8f7..095c87d3e5c 100644 --- a/config/locales/server.fr.yml +++ b/config/locales/server.fr.yml @@ -694,7 +694,6 @@ fr: pop3s_polling_host: "L'hôte utilisé pour le polling pour l'email via POP3S" pop3s_polling_username: "Le nom d'utilisateur pour le polling POPS3 par email" pop3s_polling_password: "Le mot de passe pour le polling POPS3 par email" - enable_mailing_list_mode: "Autoriser les utilisateurs à s'inscrire (optionnellement) au mode de liste de diffusion via une préférence de l'utilisateur" minimum_topics_similar: "Combien de topics ont besoin d'exister dans la base de données avant que des topics similaires soit présentés." relative_date_duration: "Nombre de jours après la création d'un message à partir desquels les dates seront affichées en absolu plutôt qu'en relatif. Exemple: relatif : 7j, absolut : 20 Fév" delete_user_max_post_age: "L'âge maximum du premier message d'un utilisateur, en jours, qui permet de supprimer un utilisateur." diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml index 2ec5f5d3484..718f57d3734 100644 --- a/config/locales/server.ru.yml +++ b/config/locales/server.ru.yml @@ -721,7 +721,6 @@ ru: pop3s_polling_host: 'Имя хоста для доступа по протоколу POP3S' pop3s_polling_username: 'Имя пользователя для доступа по протоколу POP3S' pop3s_polling_password: 'Пароль пользователя для доступа по протоколу POP3S' - enable_mailing_list_mode: 'Позволить пользователям (опционально) присоединиться к списку рассылки через пользовательские настройки' minimum_topics_similar: 'Количество тем, которое должно присутствовать в базе данных, перед тем, как начнет выводиться подсказка о похожих темах.' relative_date_duration: 'Количество дней после отправки, в течении которых даты будут отображаться в относительном виде вместо абсолютного. Например, относительная дата: 7д, абсолютная дата: 20 Фев' delete_user_max_post_age: 'Максимальный возраст первого сообщения пользователя, в днях, позволяющий удалить пользователя.' @@ -995,4 +994,4 @@ ru: message_blank: 'пустое сообщение' message_to_blank: 'Адрес получателя пусто' text_part_body_blank: 'Текстовая часть сообщения письма пуста' - body_blank: 'Cообщения письма пусто' \ No newline at end of file + body_blank: 'Cообщения письма пусто' diff --git a/config/site_settings.yml b/config/site_settings.yml index c04e725e994..4281800cf98 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -255,9 +255,6 @@ email: default: 3 enum: 'MinTrustToCreateTopicSetting' email_in_category: -1 - enable_mailing_list_mode: - default: false - client: true files: max_image_size_kb: diff --git a/lib/post_jobs_enqueuer.rb b/lib/post_jobs_enqueuer.rb index 33c98259b9b..e5abfc87824 100644 --- a/lib/post_jobs_enqueuer.rb +++ b/lib/post_jobs_enqueuer.rb @@ -32,13 +32,11 @@ class PostJobsEnqueuer TopicTrackingState.publish_unread(@post) end - if SiteSetting.enable_mailing_list_mode - Jobs.enqueue_in( - SiteSetting.email_time_window_mins.minutes, - :notify_mailing_list_subscribers, - post_id: @post.id - ) - end + Jobs.enqueue_in( + SiteSetting.email_time_window_mins.minutes, + :notify_mailing_list_subscribers, + post_id: @post.id + ) end def after_topic_create diff --git a/spec/mailers/user_notifications_spec.rb b/spec/mailers/user_notifications_spec.rb index 138030c2d48..886a869cd59 100644 --- a/spec/mailers/user_notifications_spec.rb +++ b/spec/mailers/user_notifications_spec.rb @@ -90,7 +90,6 @@ describe UserNotifications do tu.last_emailed_post_number.should == response.post_number # in mailing list mode user_replies is not sent through - SiteSetting.stubs(:enable_mailing_list_mode).returns(true) response.user.mailing_list_mode = true mail = UserNotifications.user_replied(response.user, post: response, notification: notification) mail.class.should == ActionMailer::Base::NullMail diff --git a/spec/models/topic_user_spec.rb b/spec/models/topic_user_spec.rb index 4e11d9c3b2f..ce463c10eef 100644 --- a/spec/models/topic_user_spec.rb +++ b/spec/models/topic_user_spec.rb @@ -271,8 +271,6 @@ describe TopicUser do describe "mailing_list_mode" do it "will receive email notification for every topic" do - SiteSetting.stubs(:enable_mailing_list_mode).returns(true) - user1 = Fabricate(:user) user2 = Fabricate(:user, mailing_list_mode: true) post = create_post