From ea269ccfb215ecba7f11c28bbb70f76e6aa5db01 Mon Sep 17 00:00:00 2001 From: Jeff Atwood Date: Tue, 2 Dec 2014 21:36:25 -0800 Subject: [PATCH] rename purge_inactive to purge_unactivated --- app/jobs/scheduled/purge_inactive.rb | 2 +- app/models/user.rb | 10 +++------- config/locales/server.en.yml | 2 +- config/locales/server.es.yml | 2 +- config/locales/server.fi.yml | 2 +- config/locales/server.fr.yml | 2 +- config/locales/server.he.yml | 2 +- config/locales/server.ko.yml | 2 +- config/locales/server.pt_BR.yml | 2 +- config/locales/server.sq.yml | 2 +- config/locales/server.zh_CN.yml | 2 +- config/site_settings.yml | 2 +- spec/models/user_spec.rb | 6 +++--- 13 files changed, 17 insertions(+), 21 deletions(-) diff --git a/app/jobs/scheduled/purge_inactive.rb b/app/jobs/scheduled/purge_inactive.rb index ee5e30a43b9..a6615f5fe25 100644 --- a/app/jobs/scheduled/purge_inactive.rb +++ b/app/jobs/scheduled/purge_inactive.rb @@ -3,7 +3,7 @@ module Jobs every 1.day def execute(args) - User.purge_inactive + User.purge_unactivated end end end diff --git a/app/models/user.rb b/app/models/user.rb index 8a846ee2d95..7fc88a0b6fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -791,16 +791,12 @@ class User < ActiveRecord::Base end end - # Delete inactive accounts that are over a week old - def self.purge_inactive + # Delete unactivated accounts (without verified email) that are over a week old + def self.purge_unactivated - # You might be wondering why this query matches on post_count = 0. The reason - # is a long time ago we had a bug where users could post before being activated - # and some sites still have those records which can't be purged. to_destroy = User.where(active: false) .joins('INNER JOIN user_stats AS us ON us.user_id = users.id') - .where("created_at < ?", SiteSetting.purge_inactive_users_grace_period_days.days.ago) - .where('us.post_count = 0') + .where("created_at < ?", SiteSetting.purge_unactivated_users_grace_period_days.days.ago) .where('NOT admin AND NOT moderator') .limit(100) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 233d0a07398..be11d2e8f27 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -845,7 +845,7 @@ en: clean_up_uploads: "Remove orphan unreferenced uploads to prevent illegal hosting. WARNING: you may want to back up of your /uploads directory before enabling this setting." clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed." purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased." - purge_inactive_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted." + purge_unactivated_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted." enable_s3_uploads: "Place uploads on Amazon S3 storage. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)." s3_use_iam_profile: 'Use AWS EC2 IAM role to retrieve keys. NOTE: enabling will override "s3 access key id" and "s3 secret access key" settings.' s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods, no underscores." diff --git a/config/locales/server.es.yml b/config/locales/server.es.yml index 44121790b54..d2ff1c237f4 100644 --- a/config/locales/server.es.yml +++ b/config/locales/server.es.yml @@ -749,7 +749,7 @@ es: clean_up_uploads: "Eliminar subidas huérfanas sin referencia para prevenir hosting ilegal. AVISO: antes de habilitar esta opción quizá quieres hacer un backup de tu directorio de /uploads" clean_orphan_uploads_grace_period_hours: "Período de gracia (en horas) antes de que una subida huérfana sea eliminada." purge_deleted_uploads_grace_period_days: "Período de gracia (en días) antes de que una subida eliminada sea borrada totalmente." - purge_inactive_users_grace_period_days: "Periodo de gracia (en días) durante los cuales un usuario que no haya activado su cuenta no será aún eliminado." + purge_unactivated_users_grace_period_days: "Periodo de gracia (en días) durante los cuales un usuario que no haya activado su cuenta no será aún eliminado." enable_s3_uploads: "Coloca los archivos subidos en el almacén Amazon S3. IMPORTANTE: requiere de credenciales de S3 validas. (ambas clave de acceso y clave de acceso secreta)." s3_use_iam_profile: 'Usar el rol de AWS EC2 IAM para descargar las llaves. NOTA: habilitando esta opción ignorará la "llave de acceso s3" y "la llave de acceso secreta s3".' s3_upload_bucket: "El nombre del bucket Amazon S3 donde se subirán los archivos. AVISO: debe ser en minúsculas, sin puntos ni guiones bajos." diff --git a/config/locales/server.fi.yml b/config/locales/server.fi.yml index d6035432783..7192c3c767f 100644 --- a/config/locales/server.fi.yml +++ b/config/locales/server.fi.yml @@ -733,7 +733,7 @@ fi: clean_up_uploads: "Poista orpoutuneet liitetiedostot, joita ei käytetä viesteissä, laittoman hostauksen estämiseksi. VAROITUS: kannattaa varmuuskopioida /uploads kansio ennen tämän asetuksen ottamista käyttöön." clean_orphan_uploads_grace_period_hours: "Varoaika (tunteina) kunnes orpoutuneet liitetiedostot poistetaan" purge_deleted_uploads_grace_period_days: "Varoaika (päivinä) kunnes poistettu liitetiedosto tuhotaan." - purge_inactive_users_grace_period_days: "Varoaika (päivinä) kunnes aktivoimaton käyttäjätili tuhotaan." + purge_unactivated_users_grace_period_days: "Varoaika (päivinä) kunnes aktivoimaton käyttäjätili tuhotaan." enable_s3_uploads: "Lataa liitetiedostot Amazon S3:een. Tärkeää: edellyttää toimivat S3 kirjautumistiedot (access key id ja secret access key)." s3_use_iam_profile: 'Käytä AWS EC2 IAM roolia avainten hakuun. HUOM: käyttöönotto korvaa "s3 access key id" ja "s3 secret access key" asetukset.' s3_access_key_id: "Amazon S3 access key id, jota käytetään kuvien sijoittamisessa." diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml index 25928ab0696..96256d502d9 100644 --- a/config/locales/server.fr.yml +++ b/config/locales/server.fr.yml @@ -744,7 +744,7 @@ fr: clean_up_uploads: "Retirer les fichiers téléchargés orphelins pour prévenir les hébergements illégaux. ATTENTION: vous devriez faire une sauvegarde de votre répertoire /uploads avant d'activer ce paramètre." clean_orphan_uploads_grace_period_hours: "La période de grâce (en heures) avant qu'un fichier envoyé orphelin soit retiré." purge_deleted_uploads_grace_period_days: "La période de grâce (en jours) avant qu'un fichier envoyé et supprimé soit effacé." - purge_inactive_users_grace_period_days: "Période de grâce (en jours) avant qu'un utilisateur qui n'a pas activé son compte soit supprimé." + purge_unactivated_users_grace_period_days: "Période de grâce (en jours) avant qu'un utilisateur qui n'a pas activé son compte soit supprimé." enable_s3_uploads: "Placez les fichiers envoyés sur un stockage Amazon S3. IMPORTANT: nécessite un accès valide à S3 (l'identifiant et la clé secrète)." s3_use_iam_profile: 'Utiliser un role AWS EC2 IAM pour la récupération des clés. NOTE: si activé, surcharge les paramètres "s3 access key id" et "s3 secret access key".' s3_upload_bucket: "Le nom du bucket Amazon S3 qui contiendra les fichiers téléchargés. ATTENTION : doit être en minuscule, sans points et sans caractères de soulignement." diff --git a/config/locales/server.he.yml b/config/locales/server.he.yml index bd08cd13788..0c870d55860 100644 --- a/config/locales/server.he.yml +++ b/config/locales/server.he.yml @@ -726,7 +726,7 @@ he: clean_up_uploads: "הסירו העלאות יתומות וללא הפניה כדי למנוע אירוח בלתי חוקי של חומר. אזהרה: אתם עלולי לרצות לגבות את תיקיית ה-/uploads שלכם לפנו שתאפשרו הגדרה זו." clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed." purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased." - purge_inactive_users_grace_period_days: "תקופת המתנה (בימים) לפני שמשתמש שלא הפעיל את החשבון שלו יימחק." + purge_unactivated_users_grace_period_days: "תקופת המתנה (בימים) לפני שמשתמש שלא הפעיל את החשבון שלו יימחק." enable_s3_uploads: "אחסן העלאות (uploads) על תשתית של Amazon S3. חשוב: מצריך מפתח גישה + מפתח גישה סודי שיהיו חוקיים." s3_use_iam_profile: 'השתמש ב-AWS EC2 IAM role על מנת לאחזר מפתחות. שימו לב: איפשור של זה ידרוס את ההגדרות "S3 access key id" וכן את "s3 secret access key".' s3_access_key_id: "מפתח הגישה (access key id) של Amazon S3 שישמש להעלאת התמונות." diff --git a/config/locales/server.ko.yml b/config/locales/server.ko.yml index 01a1c6b9c6e..56edfb3e295 100644 --- a/config/locales/server.ko.yml +++ b/config/locales/server.ko.yml @@ -691,7 +691,7 @@ ko: clean_up_uploads: "불법 호스팅을 막기 위해서 참조되지 않은 업로드 파일은 제거한다. 주의 : 이 설정을 활성화 하기 전에 `/uploads` 디렉토리를 백업하는 것이 좋다." clean_orphan_uploads_grace_period_hours: "참조되지 않은 업로드 파일을 제거하기 전 기간(시간)" purge_deleted_uploads_grace_period_days: "참조되지 않은 업로드 파일을 완전 삭제하지 전 기간(일)" - purge_inactive_users_grace_period_days: "활성화 되지 않은 사용자를 삭제하기 까지의 기간(일)" + purge_unactivated_users_grace_period_days: "활성화 되지 않은 사용자를 삭제하기 까지의 기간(일)" s3_access_key_id: "이미지를 업로드 할 때 사용할 Amazon S3의 access key id" s3_secret_access_key: "이미지를 업로드 할 때 사용할 Amazon S3의 secret access key" s3_region: "이미지를 업로드 할 때 사용할 Amazon S3 region" diff --git a/config/locales/server.pt_BR.yml b/config/locales/server.pt_BR.yml index f7d4538dc22..49e29d31d68 100644 --- a/config/locales/server.pt_BR.yml +++ b/config/locales/server.pt_BR.yml @@ -661,7 +661,7 @@ pt_BR: clean_up_uploads: "Remover envios sem referência para evitar hospedagem ilegal. AVISO: você pode querer fazer um backup do seu diretório de /uploads antes de habilitar essa configuração." clean_orphan_uploads_grace_period_hours: "Carência (em horas) antes de um upload órfão ser removido." purge_deleted_uploads_grace_period_days: "Carência (em dias) antes que um upload excluído seja apagado." - purge_inactive_users_grace_period_days: "Carência (em dias) antes de um usuário que não tenha ativado sua conta seja deletado." + purge_unactivated_users_grace_period_days: "Carência (em dias) antes de um usuário que não tenha ativado sua conta seja deletado." min_trust_to_create_topic: "O nível de confiança mínimo necessário para criar um novo tópico." min_trust_to_edit_wiki_post: "O nível de confiança mínimo necessário para editar uma postagem marcada como wiki." title_fancy_entities: "Converter caracteres ASCII comuns em entidades HTML nos títulos dos tópicos, ala SmartyPants http://daringfireball.net/projects/smartypants/" diff --git a/config/locales/server.sq.yml b/config/locales/server.sq.yml index 9418e3cccd8..d1e69b1e1de 100644 --- a/config/locales/server.sq.yml +++ b/config/locales/server.sq.yml @@ -749,7 +749,7 @@ sq: clean_up_uploads: "Remove orphan unreferenced uploads to prevent illegal hosting. WARNING: you may want to back up of your /uploads directory before enabling this setting." clean_orphan_uploads_grace_period_hours: "Grace period (in hours) before an orphan upload is removed." purge_deleted_uploads_grace_period_days: "Grace period (in days) before a deleted upload is erased." - purge_inactive_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted." + purge_unactivated_users_grace_period_days: "Grace period (in days) before a user who has not activated their account is deleted." enable_s3_uploads: "Place uploads on Amazon S3 storage. IMPORTANT: requires valid S3 credentials (both access key id & secret access key)." s3_use_iam_profile: 'Use AWS EC2 IAM role to retrieve keys. NOTE: enabling will override "s3 access key id" and "s3 secret access key" settings.' s3_upload_bucket: "The Amazon S3 bucket name that files will be uploaded into. WARNING: must be lowercase, no periods, no underscores." diff --git a/config/locales/server.zh_CN.yml b/config/locales/server.zh_CN.yml index 237fae728df..6a04252c2f3 100644 --- a/config/locales/server.zh_CN.yml +++ b/config/locales/server.zh_CN.yml @@ -719,7 +719,7 @@ zh_CN: clean_up_uploads: "移除孤立的已上传资料。警告:您可能想要在启用这个设定前备份一下 /uploads 目录。" clean_orphan_uploads_grace_period_hours: "删除孤立上传资料的宽限期(单位:小时)" purge_deleted_uploads_grace_period_days: "移除已删除的孤立上传资料的宽限期(单位:小时)" - purge_inactive_users_grace_period_days: "删除不活跃用户账户的宽限期(单位:天)。" + purge_unactivated_users_grace_period_days: "删除不活跃用户账户的宽限期(单位:天)。" enable_s3_uploads: "上传至 Amazon S3 存储的地址。重要:需要有效的 S3 验证资料(包括 access key id & secret access key)。" s3_use_iam_profile: '使用 AWS EC2 IAM 角色来获得 key。注意:启用这个会覆盖“S3 access key id”和“S3 secret access key” 设置。' s3_upload_bucket: "上传文件保存于 Amazon S3 的 bucket 名字。警告:必须为小写,无句点,无下划线。" diff --git a/config/site_settings.yml b/config/site_settings.yml index c076ba42549..97bf9a60afa 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -285,7 +285,7 @@ users: default: false email_token_valid_hours: 24 email_token_grace_period_hours: 0 - purge_inactive_users_grace_period_days: 7 + purge_unactivated_users_grace_period_days: 7 public_user_custom_fields: type: list default: '' diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d2d1d79afe3..ce009f1cb53 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1155,13 +1155,13 @@ describe User do end end - describe "#purge_inactive" do + describe "#purge_unactivated" do let!(:user) { Fabricate(:user) } let!(:inactive) { Fabricate(:user, active: false) } let!(:inactive_old) { Fabricate(:user, active: false, created_at: 1.month.ago) } - it 'should only remove old, inactive users' do - User.purge_inactive + it 'should only remove old, unactivated users' do + User.purge_unactivated all_users = User.all all_users.include?(user).should == true all_users.include?(inactive).should == true