mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 08:43:25 +08:00
change "visitor" trust level to "new user"
I blame me for this mistake.. visitor means other stuff in practice. New User is correct meaning.
This commit is contained in:
parent
9add8a74aa
commit
b64a4100fa
|
@ -135,18 +135,18 @@ class Post < ActiveRecord::Base
|
|||
if acting_user.present? && acting_user.has_trust_level?(:basic)
|
||||
errors.add(:base, I18n.t(:too_many_mentions, count: SiteSetting.max_mentions_per_post)) if raw_mentions.size > SiteSetting.max_mentions_per_post
|
||||
else
|
||||
errors.add(:base, I18n.t(:too_many_mentions_visitor, count: SiteSetting.visitor_max_mentions_per_post)) if raw_mentions.size > SiteSetting.visitor_max_mentions_per_post
|
||||
errors.add(:base, I18n.t(:too_many_mentions_newuser, count: SiteSetting.newuser_max_mentions_per_post)) if raw_mentions.size > SiteSetting.newuser_max_mentions_per_post
|
||||
end
|
||||
end
|
||||
|
||||
def max_images_validator
|
||||
return if acting_user.present? && acting_user.has_trust_level?(:basic)
|
||||
errors.add(:base, I18n.t(:too_many_images, count: SiteSetting.visitor_max_images)) if image_count > SiteSetting.visitor_max_images
|
||||
errors.add(:base, I18n.t(:too_many_images, count: SiteSetting.newuser_max_images)) if image_count > SiteSetting.newuser_max_images
|
||||
end
|
||||
|
||||
def max_links_validator
|
||||
return if acting_user.present? && acting_user.has_trust_level?(:basic)
|
||||
errors.add(:base, I18n.t(:too_many_links, count: SiteSetting.visitor_max_links)) if link_count > SiteSetting.visitor_max_links
|
||||
errors.add(:base, I18n.t(:too_many_links, count: SiteSetting.newuser_max_links)) if link_count > SiteSetting.newuser_max_links
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ class SiteSetting < ActiveRecord::Base
|
|||
setting(:post_undo_action_window_mins, 10)
|
||||
setting(:system_username, '')
|
||||
setting(:max_mentions_per_post, 10)
|
||||
setting(:visitor_max_mentions_per_post, 2)
|
||||
setting(:newuser_max_mentions_per_post, 2)
|
||||
|
||||
setting(:uncategorized_name, 'uncategorized')
|
||||
|
||||
|
@ -168,8 +168,8 @@ class SiteSetting < ActiveRecord::Base
|
|||
setting(:body_min_entropy, 7)
|
||||
setting(:max_word_length, 30)
|
||||
|
||||
setting(:visitor_max_links, 2)
|
||||
setting(:visitor_max_images, 0)
|
||||
setting(:newuser_max_links, 2)
|
||||
setting(:newuser_max_images, 0)
|
||||
|
||||
setting(:title_fancy_entities, true)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ cs:
|
|||
one: "Bohužel, můžete zmínit jen jednoho uživatele v jednom příspěvku."
|
||||
few: "Bohužel, můžete zmínit jen %{count} uživatele v jednom příspěvku."
|
||||
other: "Bohužel, můžete zmínit jen %{count} uživatelů v jednom příspěvku."
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: "Bohužel, návštěvníci nemohou zmiňovat ostatní uživatele."
|
||||
one: "Bohužel, návštěvníci mohou zmínit jen jednoho uživatele v jednom příspěvku."
|
||||
few: "Bohužel, návštěvníci mohou zmínit jen %{count} uživatele v jednom příspěvku."
|
||||
|
@ -103,7 +103,7 @@ cs:
|
|||
post_template: "%{replace_paragraph}\n\nPoužijte toto místo níže pro delší popis a stanovení pravidel diskuze!"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "návštěvník"
|
||||
basic:
|
||||
title: "základní uživatel"
|
||||
|
@ -503,9 +503,9 @@ cs:
|
|||
regular_requires_likes_given: "Kolik 'líbí se' musí základní uživatel rozdat, než může získat stálou (2) věrohodnost"
|
||||
regular_requires_topic_reply_count: "Do kolika témat musí základní uživatel odpovědět, než může získat stálou (2) věrohodnost"
|
||||
|
||||
visitor_max_links: "Kolik odkazů může návštěvník vložit do příspěvku"
|
||||
visitor_max_images: "Kolik obrázků může návštěvník vložit do příspěvku"
|
||||
visitor_max_mentions_per_post: "Kolik zmínek přes @name může návštěvník vložit do příspěvku"
|
||||
newuser_max_links: "Kolik odkazů může návštěvník vložit do příspěvku"
|
||||
newuser_max_images: "Kolik obrázků může návštěvník vložit do příspěvku"
|
||||
newuser_max_mentions_per_post: "Kolik zmínek přes @name může návštěvník vložit do příspěvku"
|
||||
max_mentions_per_post: "Maximální počet zmínek přes @name, které mohou být použity v jednom příspěvku"
|
||||
|
||||
auto_link_images_wider_than: "Obrázky širší než tato hodnota v pixelech budou odkazovány do lightboxu"
|
||||
|
|
|
@ -91,7 +91,7 @@ de:
|
|||
post_template: "%{replace_paragraph}\n\nBenutze den folgenden Platz für eine ausführliche Beschreibung sowie für Regeln und zur Diskussion!"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "Gast"
|
||||
basic:
|
||||
title: "Anfänger"
|
||||
|
@ -427,9 +427,9 @@ de:
|
|||
basic_requires_topics_entered: "Zahl der Themen, die ein neuer Nutzer erstellen muss, bevor er zum sporadischen Nutzer (Vertrauenswürdigkeit 1) aufsteigt."
|
||||
basic_requires_read_posts: "Zahl der Beiträge, die ein neuer Nutzer lesen muss, bevor bevor er zum sporadischen Nutzer (Vertrauenswürdigkeit 1) aufsteigt."
|
||||
basic_requires_time_spent_mins: "Minuten, die ein neuer Nutzer Beiträge lesen muss, bevor er zum sporadischen Nutzer (Vertrauenswürdigkeit 1) aufsteigt."
|
||||
visitor_max_links: "Maximale Zahl der Links, die Gäste Beiträgen hinzufügen dürfen."
|
||||
visitor_max_images: "Maximale Zahl der Bilder, die Gäste Beiträgen hinzufügen dürfen."
|
||||
visitor_max_mentions_per_post: "Maximale Zahl der @Namens-Erwähnungen, die Gäste in Beiträgen nutzen dürfen."
|
||||
newuser_max_links: "Maximale Zahl der Links, die Gäste Beiträgen hinzufügen dürfen."
|
||||
newuser_max_images: "Maximale Zahl der Bilder, die Gäste Beiträgen hinzufügen dürfen."
|
||||
newuser_max_mentions_per_post: "Maximale Zahl der @Namens-Erwähnungen, die Gäste in Beiträgen nutzen dürfen."
|
||||
max_mentions_per_post: "Maximale Zahl der @Namens-Erwähnungen, die man in einem Beitrag nutzen kann."
|
||||
|
||||
auto_link_images_wider_than: "Pixelbreite, ab der Bilder automatisch verlinkt und verkleinert in einer Lightbox dargestellt werden."
|
||||
|
|
|
@ -19,18 +19,18 @@ en:
|
|||
zero: "Sorry, you can't mention other users."
|
||||
one: "Sorry, you can only mention one other user in a post."
|
||||
other: "Sorry, you can only mention %{count} users in a post."
|
||||
too_many_mentions_visitor:
|
||||
zero: "Sorry, visitors can't mention other users."
|
||||
one: "Sorry, visitors can only mention one other user in a post."
|
||||
other: "Sorry, visitors can only mention %{count} users in a post."
|
||||
too_many_mentions_newuser:
|
||||
zero: "Sorry, new users can't mention other users."
|
||||
one: "Sorry, new users can only mention one other user in a post."
|
||||
other: "Sorry, new users can only mention %{count} users in a post."
|
||||
too_many_images:
|
||||
zero: "Sorry, visitors can't put images in posts."
|
||||
one: "Sorry, visitors can only put one image in a post."
|
||||
other: "Sorry, visitors can only put %{count} images in a post."
|
||||
zero: "Sorry, new users can't put images in posts."
|
||||
one: "Sorry, new users can only put one image in a post."
|
||||
other: "Sorry, new users can only put %{count} images in a post."
|
||||
too_many_links:
|
||||
zero: "Sorry, visitors can't put links in posts."
|
||||
one: "Sorry, visitors can only put one link in a post."
|
||||
other: "Sorry, visitors can only put %{count} links in a post."
|
||||
zero: "Sorry, new users can't put links in posts."
|
||||
one: "Sorry, new users can only put one link in a post."
|
||||
other: "Sorry, new users can only put %{count} links in a post."
|
||||
|
||||
just_posted_that: "is too similar to what you recently posted"
|
||||
has_already_been_used: "has already been used"
|
||||
|
@ -98,8 +98,8 @@ en:
|
|||
post_template: "%{replace_paragraph}\n\nUse this space for a longer description, as well as to establish any category guidelines or rules.\n\nSome things to consider in any discussion replies below:\n\n- What is this category for? Why should people select this category for their topic?\n\n- How is this different than the other categories we already have?\n\n- Do we need this category?\n\n- Should we merge this with another category, or split it into more categories?\n"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
title: "visitor"
|
||||
newuser:
|
||||
title: "new user"
|
||||
basic:
|
||||
title: "basic user"
|
||||
regular:
|
||||
|
@ -497,9 +497,9 @@ en:
|
|||
regular_requires_likes_given: "How many likes a basic user must cast before promotion to regular (2) trust level"
|
||||
regular_requires_topic_reply_count: "How many topics a basic user must reply to before promotion to regular (2) trust level"
|
||||
|
||||
visitor_max_links: "How many links a visitor can add to a post"
|
||||
visitor_max_images: "How many images a visitor can add to a post"
|
||||
visitor_max_mentions_per_post: "Maximum number of @name notifications a visitor can use in a post"
|
||||
newuser_max_links: "How many links a new user can add to a post"
|
||||
newuser_max_images: "How many images a new user can add to a post"
|
||||
newuser_max_mentions_per_post: "Maximum number of @name notifications a new user can use in a post"
|
||||
max_mentions_per_post: "Maximum number of @name notifications you can use in a post"
|
||||
|
||||
auto_link_images_wider_than: "Images wider than this, in pixels, will get auto link and lightbox treatment"
|
||||
|
|
|
@ -26,7 +26,7 @@ fr:
|
|||
zero: "Désolé, vous ne pouvez pas mentionner d'utilisateur."
|
||||
one: "Désolé, vous ne pouvez mentionner qu'un seul utilisateur."
|
||||
other: "Désolé, vous ne pouvez mentionner que %{count} utilisateur."
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: "Désolé, les visiteurs ne peuvent pas mentionner d'utilisateur."
|
||||
one: "Désolé, les visiteurs ne peuvent mentionner qu'un seul utilisateur."
|
||||
other: "Désolé, les visiteurs ne peuvent mentionner que %{count} utilisateur."
|
||||
|
@ -107,7 +107,7 @@ fr:
|
|||
post_template: "%{replace_paragraph}\n\nUtilisez l'espace ci-dessous pour une plus longue description, voire pour établir des règles."
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "visiteur"
|
||||
basic:
|
||||
title: "utilisateur basique"
|
||||
|
@ -474,9 +474,9 @@ fr:
|
|||
previous_visit_timeout_hours: "Combien de temps dure une visite avant de la considérer comme la visite 'précédente', en heures."
|
||||
|
||||
uncategorized_name: "Nom pour les discussions sans catégorie dans la liste des catégories"
|
||||
visitor_max_links: "Nombre maximum de liens qu'un visiteur peut ajouter à un message"
|
||||
visitor_max_images: "Nombre maximum d'images qu'un visiteur peut ajouter à un message"
|
||||
visitor_max_mentions_per_post: "Nombre maximum de référence à un @utilisateur qu'un visiteur peut ajouter à un message"
|
||||
newuser_max_links: "Nombre maximum de liens qu'un visiteur peut ajouter à un message"
|
||||
newuser_max_images: "Nombre maximum d'images qu'un visiteur peut ajouter à un message"
|
||||
newuser_max_mentions_per_post: "Nombre maximum de référence à un @utilisateur qu'un visiteur peut ajouter à un message"
|
||||
max_mentions_per_post: "Le nombre maximal de @mentions que vous pouvez ajouter à un message"
|
||||
|
||||
rate_limit_create_topic: "Combien de secondes avant de pouvoir démarrer une nouvelle discussion"
|
||||
|
|
|
@ -80,8 +80,8 @@ id:
|
|||
post_template: "%{replace_paragraph}\n\nUse this space for a longer description, as well as to establish any category guidelines or rules.\n\nSome things to consider in any discussion replies below:\n\n- What is this category for? Why should people select this category for their topic?\n\n- How is this different than the other categories we already have?\n\n- Do we need this category?\n\n- Should we merge this with another category, or split it into more categories?\n"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
title: "visitor"
|
||||
newuser:
|
||||
title: "new user"
|
||||
basic:
|
||||
title: "basic user"
|
||||
regular:
|
||||
|
|
|
@ -80,7 +80,7 @@ it:
|
|||
post_template: "%{replace_paragraph}\n\nUsa lo spazio sottostante per una descrizione più estesa, ed anche per stabilire delle regole per la conversazione!"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "visitatore"
|
||||
basic:
|
||||
title: "utente base"
|
||||
|
|
|
@ -14,7 +14,7 @@ pseudo:
|
|||
zero: '[[ Šóřřý, ýóů čáɳ''ť ɱéɳťíóɳ óťĥéř ůšéřš. ]]'
|
||||
one: '[[ Šóřřý, ýóů čáɳ óɳłý ɱéɳťíóɳ óɳé óťĥéř ůšéř íɳ á ƿóšť. ]]'
|
||||
other: '[[ Šóřřý, ýóů čáɳ óɳłý ɱéɳťíóɳ %{count} ůšéřš íɳ á ƿóšť. ]]'
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: '[[ Šóřřý, νíšíťóřš čáɳ''ť ɱéɳťíóɳ óťĥéř ůšéřš. ]]'
|
||||
one: '[[ Šóřřý, νíšíťóřš čáɳ óɳłý ɱéɳťíóɳ óɳé óťĥéř ůšéř íɳ á ƿóšť. ]]'
|
||||
other: '[[ Šóřřý, νíšíťóřš čáɳ óɳłý ɱéɳťíóɳ %{count} ůšéřš íɳ á ƿóšť. ]]'
|
||||
|
@ -94,7 +94,7 @@ pseudo:
|
|||
|
||||
Ůšé ťĥíš šƿáčé ƀéłóŵ ƒóř á łóɳǧéř ďéščříƿťíóɳ, áš ŵéłł áš ťó éšťáƀłíšĥ áɳý řůłéš óř ďíščůššíóɳ! ]]
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: '[[ νíšíťóř ]]'
|
||||
basic:
|
||||
title: '[[ ƀášíč ůšéř ]]'
|
||||
|
@ -509,9 +509,9 @@ pseudo:
|
|||
ťó ƀášíč (1) ťřůšť łéνéł ]]'
|
||||
basic_requires_time_spent_mins: '[[ Ĥóŵ ɱáɳý ɱíɳůťéš á ɳéŵ ůšéř ɱůšť řéáď ƿóšťš
|
||||
ƀéƒóřé ƿřóɱóťíóɳ ťó ƀášíč (1) ťřůšť łéνéł ]]'
|
||||
visitor_max_links: '[[ Ĥóŵ ɱáɳý łíɳǩš á νíšíťóř čáɳ áďď ťó á ƿóšť ]]'
|
||||
visitor_max_images: '[[ Ĥóŵ ɱáɳý íɱáǧéš á νíšíťóř čáɳ áďď ťó á ƿóšť ]]'
|
||||
visitor_max_mentions_per_post: '[[ Ϻáхíɱůɱ ɳůɱƀéř óƒ @ɳáɱé ɳóťíƒíčáťíóɳš á νíšíťóř
|
||||
newuser_max_links: '[[ Ĥóŵ ɱáɳý łíɳǩš á νíšíťóř čáɳ áďď ťó á ƿóšť ]]'
|
||||
newuser_max_images: '[[ Ĥóŵ ɱáɳý íɱáǧéš á νíšíťóř čáɳ áďď ťó á ƿóšť ]]'
|
||||
newuser_max_mentions_per_post: '[[ Ϻáхíɱůɱ ɳůɱƀéř óƒ @ɳáɱé ɳóťíƒíčáťíóɳš á νíšíťóř
|
||||
čáɳ ůšé íɳ á ƿóšť ]]'
|
||||
max_mentions_per_post: '[[ Ϻáхíɱůɱ ɳůɱƀéř óƒ @ɳáɱé ɳóťíƒíčáťíóɳš ýóů čáɳ ůšé íɳ
|
||||
á ƿóšť ]]'
|
||||
|
|
|
@ -16,7 +16,7 @@ sv:
|
|||
zero: "Tyvärr, du kan inte omnämna andra användare."
|
||||
one: "Tyvärr, du kan bara omnämna en annan användare i ett inlägg."
|
||||
other: "Tyvärr, du kan bara omnämna %{count} användare i ett inlägg."
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: "Tyvärr, besökare kan inte omnämna andra användare."
|
||||
one: "Tyvärr, besökare kan bara omnämna en annan användare i ett inlägg."
|
||||
other: "Tyvärr, besökare kan bara omnämna %{count} användare i ett inlägg."
|
||||
|
@ -94,7 +94,7 @@ sv:
|
|||
post_template: "%{replace_paragraph}\n\nUse this space for a longer description, as well as to establish any category guidelines or rules.\n\nSome things to consider in any discussion replies below:\n\n- What is this category for? Why should people select this category for their topic?\n\n- How is this different than the other categories we already have?\n\n- Do we need this category?\n\n- Should we merge this with another category, or split it into more categories?\n"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "besökare"
|
||||
basic:
|
||||
title: "vanlig användare"
|
||||
|
@ -463,9 +463,9 @@ sv:
|
|||
regular_requires_likes_given: "How many likes a basic user must cast before promotion to regular (2) trust level"
|
||||
regular_requires_topic_reply_count: "How many topics a basic user must reply to before promotion to regular (2) trust level"
|
||||
|
||||
visitor_max_links: "How many links a visitor can add to a post"
|
||||
visitor_max_images: "How many images a visitor can add to a post"
|
||||
visitor_max_mentions_per_post: "Maximum number of @name notifications a visitor can use in a post"
|
||||
newuser_max_links: "How many links a new user can add to a post"
|
||||
newuser_max_images: "How many images a new user can add to a post"
|
||||
newuser_max_mentions_per_post: "Maximum number of @name notifications a new user can use in a post"
|
||||
max_mentions_per_post: "Maximum number of @name notifications you can use in a post"
|
||||
|
||||
auto_link_images_wider_than: "Images wider than this, in pixels, will get auto link and lightbox treatment"
|
||||
|
|
|
@ -19,7 +19,7 @@ zh_CN:
|
|||
zero: "抱歉, 你无法@用户。"
|
||||
one: "抱歉, 你一次仅能@一个用户。"
|
||||
other: "抱歉, 你一次仅能@ %{count} 个用户。"
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: "抱歉, 游客无法@用户。"
|
||||
one: "抱歉, 游客一次仅能@一个用户。"
|
||||
other: "抱歉, 游客一次仅能@ %{count} 个用户。"
|
||||
|
@ -98,7 +98,7 @@ zh_CN:
|
|||
post_template: "%{replace_paragraph}\n\n使用下面的空间输入分类的详细描述信息,可包括在此分类下讨论的规则、内容导向等等。"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "访客"
|
||||
basic:
|
||||
title: "初级用户"
|
||||
|
@ -481,9 +481,9 @@ zh_CN:
|
|||
regular_requires_likes_given: "一个初级用户升级到常规用户(2)所需要投出的赞数"
|
||||
regular_requires_topic_reply_count: "一个初级用户升级到常规用户(2)所需要回复的主题数量"
|
||||
|
||||
visitor_max_links: "一个访问者可以添加到一个帖子里的链接数量"
|
||||
visitor_max_images: "一个访问者可以加入到一个帖子里的图片数量"
|
||||
visitor_max_mentions_per_post: "一个访问者可以在一个帖子里使用 @name 提及的最大数量"
|
||||
newuser_max_links: "一个访问者可以添加到一个帖子里的链接数量"
|
||||
newuser_max_images: "一个访问者可以加入到一个帖子里的图片数量"
|
||||
newuser_max_mentions_per_post: "一个访问者可以在一个帖子里使用 @name 提及的最大数量"
|
||||
max_mentions_per_post: "你可以在一个帖子里使用 @name 提及的最大数量"
|
||||
|
||||
auto_link_images_wider_than: "图片宽度超过此设定像素值的,将被自动附加一个链接并且使用灯箱(lightbox)来展示"
|
||||
|
|
|
@ -19,7 +19,7 @@ zh_TW:
|
|||
zero: "抱歉, 你無法@用戶。"
|
||||
one: "抱歉, 你一次僅能@一個用戶。"
|
||||
other: "抱歉, 你一次僅能@ %{count} 個用戶。"
|
||||
too_many_mentions_visitor:
|
||||
too_many_mentions_newuser:
|
||||
zero: "抱歉, 遊客無法@用戶。"
|
||||
one: "抱歉, 遊客一次僅能@一個用戶。"
|
||||
other: "抱歉, 遊客一次僅能@ %{count} 個用戶。"
|
||||
|
@ -98,7 +98,7 @@ zh_TW:
|
|||
post_template: "%{replace_paragraph}\n\n使用下面的空間輸入分類的詳細描述信息,可包括在此分類下討論的規則、內容導向等等。"
|
||||
|
||||
trust_levels:
|
||||
visitor:
|
||||
newuser:
|
||||
title: "訪客"
|
||||
basic:
|
||||
title: "初級用戶"
|
||||
|
@ -481,9 +481,9 @@ zh_TW:
|
|||
regular_requires_likes_given: "一個初級用戶升級到常規用戶(2)所需要投出的贊數"
|
||||
regular_requires_topic_reply_count: "一個初級用戶升級到常規用戶(2)所需要回複的主題數量"
|
||||
|
||||
visitor_max_links: "一個訪問者可以添加到一個帖子裏的鏈接數量"
|
||||
visitor_max_images: "一個訪問者可以加入到一個帖子裏的圖片數量"
|
||||
visitor_max_mentions_per_post: "一個訪問者可以在一個帖子裏使用 @name 提及的最大數量"
|
||||
newuser_max_links: "一個訪問者可以添加到一個帖子裏的鏈接數量"
|
||||
newuser_max_images: "一個訪問者可以加入到一個帖子裏的圖片數量"
|
||||
newuser_max_mentions_per_post: "一個訪問者可以在一個帖子裏使用 @name 提及的最大數量"
|
||||
max_mentions_per_post: "你可以在一個帖子裏使用 @name 提及的最大數量"
|
||||
|
||||
auto_link_images_wider_than: "圖片寬度超過此設定像素值的,將被自動附加一個鏈接並且使用燈箱(lightbox)來展示"
|
||||
|
|
|
@ -21,7 +21,7 @@ class Promotion
|
|||
false
|
||||
end
|
||||
|
||||
def review_visitor
|
||||
def review_newuser
|
||||
return false if @user.topics_entered < SiteSetting.basic_requires_topics_entered
|
||||
return false if @user.posts_read_count < SiteSetting.basic_requires_read_posts
|
||||
return false if (@user.time_read / 60) < SiteSetting.basic_requires_time_spent_mins
|
||||
|
|
|
@ -6,7 +6,7 @@ class TrustLevel
|
|||
class << self
|
||||
def levels
|
||||
@levels ||= Enum.new(
|
||||
:visitor, :basic, :regular, :leader, :elder, start: 0
|
||||
:newuser, :basic, :regular, :leader, :elder, start: 0
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TrustLevel
|
|||
end
|
||||
|
||||
def compare(current_level, level)
|
||||
(current_level || levels[:visitor]) >= levels[level] rescue binding.pry
|
||||
(current_level || levels[:newuser]) >= levels[level] rescue binding.pry
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ require 'post_revisor'
|
|||
describe PostRevisor do
|
||||
|
||||
let(:topic) { Fabricate(:topic) }
|
||||
let(:visitor) { Fabricate(:visitor) }
|
||||
let(:post_args) { {user: visitor, topic: topic} }
|
||||
let(:newuser) { Fabricate(:newuser) }
|
||||
let(:post_args) { {user: newuser, topic: topic} }
|
||||
|
||||
context 'revise' do
|
||||
let(:post) { Fabricate(:post, post_args) }
|
||||
|
@ -186,7 +186,7 @@ describe PostRevisor do
|
|||
end
|
||||
end
|
||||
|
||||
describe "admin editing a visitor's post" do
|
||||
describe "admin editing a new user's post" do
|
||||
let(:changed_by) { Fabricate(:admin) }
|
||||
|
||||
before do
|
||||
|
@ -194,18 +194,18 @@ describe PostRevisor do
|
|||
subject.revise!(changed_by, "So, post them here!\nhttp://i.imgur.com/FGg7Vzu.gif")
|
||||
end
|
||||
|
||||
it "allows an admin to insert images into a visitor's post" do
|
||||
it "allows an admin to insert images into a new user's post" do
|
||||
post.errors.should be_blank
|
||||
end
|
||||
end
|
||||
|
||||
describe "visitor editing their own post" do
|
||||
describe "new user editing their own post" do
|
||||
before do
|
||||
SiteSetting.stubs(:too_many_images).returns(0)
|
||||
subject.revise!(post.user, "So, post them here!\nhttp://i.imgur.com/FGg7Vzu.gif")
|
||||
end
|
||||
|
||||
it "allows an admin to insert images into a visitor's post" do
|
||||
it "allows an admin to insert images into a new user's post" do
|
||||
post.errors.should be_present
|
||||
end
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ require 'promotion'
|
|||
|
||||
describe Promotion do
|
||||
|
||||
context "visitor" do
|
||||
context "newuser" do
|
||||
|
||||
let(:user) { Fabricate(:user, trust_level: TrustLevel.levels[:visitor])}
|
||||
let(:user) { Fabricate(:user, trust_level: TrustLevel.levels[:newuser])}
|
||||
let(:promotion) { Promotion.new(user) }
|
||||
|
||||
it "doesn't raise an error with a nil user" do
|
||||
|
@ -20,7 +20,7 @@ describe Promotion do
|
|||
end
|
||||
|
||||
it "has not changed the user's trust level" do
|
||||
user.trust_level.should == TrustLevel.levels[:visitor]
|
||||
user.trust_level.should == TrustLevel.levels[:newuser]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ describe TopicsController do
|
|||
end
|
||||
|
||||
it "reviews the user for a promotion if they're new" do
|
||||
user.update_column(:trust_level, TrustLevel.levels[:visitor])
|
||||
user.update_column(:trust_level, TrustLevel.levels[:newuser])
|
||||
Promotion.any_instance.expects(:review)
|
||||
get :show, id: topic.id
|
||||
end
|
||||
|
|
|
@ -49,9 +49,9 @@ Fabricator(:another_admin, from: :user) do
|
|||
admin true
|
||||
end
|
||||
|
||||
Fabricator(:visitor, from: :user) do
|
||||
Fabricator(:newuser, from: :user) do
|
||||
name 'Newbie Newperson'
|
||||
username 'newbie'
|
||||
email 'newbie@new.com'
|
||||
trust_level TrustLevel.levels[:visitor]
|
||||
trust_level TrustLevel.levels[:newuser]
|
||||
end
|
||||
|
|
|
@ -87,14 +87,14 @@ describe Post do
|
|||
end
|
||||
|
||||
describe "maximum images" do
|
||||
let(:visitor) { Fabricate(:user, trust_level: TrustLevel.levels[:visitor]) }
|
||||
let(:post_no_images) { Fabricate.build(:post, post_args.merge(user: visitor)) }
|
||||
let(:post_one_image) { Fabricate.build(:post, post_args.merge(raw: "![sherlock](http://bbc.co.uk/sherlock.jpg)", user: visitor)) }
|
||||
let(:post_two_images) { Fabricate.build(:post, post_args.merge(raw: "<img src='http://discourse.org/logo.png'> <img src='http://bbc.co.uk/sherlock.jpg'>", user: visitor)) }
|
||||
let(:post_with_avatars) { Fabricate.build(:post, post_args.merge(raw: '<img alt="smiley" title=":smiley:" src="/assets/emoji/smiley.png" class="avatar"> <img alt="wink" title=":wink:" src="/assets/emoji/wink.png" class="avatar">', user: visitor)) }
|
||||
let(:post_with_favicon) { Fabricate.build(:post, post_args.merge(raw: '<img src="/assets/favicons/wikipedia.png" class="favicon">', user: visitor)) }
|
||||
let(:post_with_thumbnail) { Fabricate.build(:post, post_args.merge(raw: '<img src="/assets/emoji/smiley.png" class="thumbnail">', user: visitor)) }
|
||||
let(:post_with_two_classy_images) { Fabricate.build(:post, post_args.merge(raw: "<img src='http://discourse.org/logo.png' class='classy'> <img src='http://bbc.co.uk/sherlock.jpg' class='classy'>", user: visitor)) }
|
||||
let(:newuser) { Fabricate(:user, trust_level: TrustLevel.levels[:newuser]) }
|
||||
let(:post_no_images) { Fabricate.build(:post, post_args.merge(user: newuser)) }
|
||||
let(:post_one_image) { Fabricate.build(:post, post_args.merge(raw: "![sherlock](http://bbc.co.uk/sherlock.jpg)", user: newuser)) }
|
||||
let(:post_two_images) { Fabricate.build(:post, post_args.merge(raw: "<img src='http://discourse.org/logo.png'> <img src='http://bbc.co.uk/sherlock.jpg'>", user: newuser)) }
|
||||
let(:post_with_avatars) { Fabricate.build(:post, post_args.merge(raw: '<img alt="smiley" title=":smiley:" src="/assets/emoji/smiley.png" class="avatar"> <img alt="wink" title=":wink:" src="/assets/emoji/wink.png" class="avatar">', user: newuser)) }
|
||||
let(:post_with_favicon) { Fabricate.build(:post, post_args.merge(raw: '<img src="/assets/favicons/wikipedia.png" class="favicon">', user: newuser)) }
|
||||
let(:post_with_thumbnail) { Fabricate.build(:post, post_args.merge(raw: '<img src="/assets/emoji/smiley.png" class="thumbnail">', user: newuser)) }
|
||||
let(:post_with_two_classy_images) { Fabricate.build(:post, post_args.merge(raw: "<img src='http://discourse.org/logo.png' class='classy'> <img src='http://bbc.co.uk/sherlock.jpg' class='classy'>", user: newuser)) }
|
||||
|
||||
it "returns 0 images for an empty post" do
|
||||
Fabricate.build(:post).image_count.should == 0
|
||||
|
@ -128,11 +128,11 @@ describe Post do
|
|||
context "validation" do
|
||||
|
||||
before do
|
||||
SiteSetting.stubs(:visitor_max_images).returns(1)
|
||||
SiteSetting.stubs(:newuser_max_images).returns(1)
|
||||
end
|
||||
|
||||
context 'visitor' do
|
||||
it "allows a visitor to post below the limit" do
|
||||
context 'newuser' do
|
||||
it "allows a new user to post below the limit" do
|
||||
post_one_image.should be_valid
|
||||
end
|
||||
|
||||
|
@ -140,7 +140,7 @@ describe Post do
|
|||
post_two_images.should_not be_valid
|
||||
end
|
||||
|
||||
it "doesn't allow a visitor to edit their post to insert an image" do
|
||||
it "doesn't allow a new user to edit their post to insert an image" do
|
||||
post_no_images.user.trust_level = TrustLevel.levels[:new]
|
||||
post_no_images.save
|
||||
-> {
|
||||
|
@ -150,7 +150,7 @@ describe Post do
|
|||
end
|
||||
end
|
||||
|
||||
it "allows more images from a non-visitor account" do
|
||||
it "allows more images from a not-new account" do
|
||||
post_two_images.user.trust_level = TrustLevel.levels[:basic]
|
||||
post_two_images.should be_valid
|
||||
end
|
||||
|
@ -160,10 +160,10 @@ describe Post do
|
|||
end
|
||||
|
||||
describe "maximum links" do
|
||||
let(:visitor) { Fabricate(:user, trust_level: TrustLevel.levels[:visitor]) }
|
||||
let(:post_one_link) { Fabricate.build(:post, post_args.merge(raw: "[sherlock](http://www.bbc.co.uk/programmes/b018ttws)", user: visitor)) }
|
||||
let(:post_two_links) { Fabricate.build(:post, post_args.merge(raw: "<a href='http://discourse.org'>discourse</a> <a href='http://twitter.com'>twitter</a>", user: visitor)) }
|
||||
let(:post_with_mentions) { Fabricate.build(:post, post_args.merge(raw: "hello @#{visitor.username} how are you doing?") )}
|
||||
let(:newuser) { Fabricate(:user, trust_level: TrustLevel.levels[:newuser]) }
|
||||
let(:post_one_link) { Fabricate.build(:post, post_args.merge(raw: "[sherlock](http://www.bbc.co.uk/programmes/b018ttws)", user: newuser)) }
|
||||
let(:post_two_links) { Fabricate.build(:post, post_args.merge(raw: "<a href='http://discourse.org'>discourse</a> <a href='http://twitter.com'>twitter</a>", user: newuser)) }
|
||||
let(:post_with_mentions) { Fabricate.build(:post, post_args.merge(raw: "hello @#{newuser.username} how are you doing?") )}
|
||||
|
||||
it "returns 0 links for an empty post" do
|
||||
Fabricate.build(:post).link_count.should == 0
|
||||
|
@ -184,10 +184,10 @@ describe Post do
|
|||
context "validation" do
|
||||
|
||||
before do
|
||||
SiteSetting.stubs(:visitor_max_links).returns(1)
|
||||
SiteSetting.stubs(:newuser_max_links).returns(1)
|
||||
end
|
||||
|
||||
context 'visitor' do
|
||||
context 'newuser' do
|
||||
it "returns true when within the amount of links allowed" do
|
||||
post_one_link.should be_valid
|
||||
end
|
||||
|
@ -250,28 +250,28 @@ describe Post do
|
|||
|
||||
context "max mentions" do
|
||||
|
||||
let(:visitor) { Fabricate(:user, trust_level: TrustLevel.levels[:visitor]) }
|
||||
let(:post_with_one_mention) { Fabricate.build(:post, post_args.merge(raw: "@Jake is the person I'm mentioning", user: visitor)) }
|
||||
let(:post_with_two_mentions) { Fabricate.build(:post, post_args.merge(raw: "@Jake @Finn are the people I'm mentioning", user: visitor)) }
|
||||
let(:newuser) { Fabricate(:user, trust_level: TrustLevel.levels[:newuser]) }
|
||||
let(:post_with_one_mention) { Fabricate.build(:post, post_args.merge(raw: "@Jake is the person I'm mentioning", user: newuser)) }
|
||||
let(:post_with_two_mentions) { Fabricate.build(:post, post_args.merge(raw: "@Jake @Finn are the people I'm mentioning", user: newuser)) }
|
||||
|
||||
context 'visitor' do
|
||||
context 'new user' do
|
||||
before do
|
||||
SiteSetting.stubs(:visitor_max_mentions_per_post).returns(1)
|
||||
SiteSetting.stubs(:newuser_max_mentions_per_post).returns(1)
|
||||
SiteSetting.stubs(:max_mentions_per_post).returns(5)
|
||||
end
|
||||
|
||||
it "allows a visitor to have visitor_max_mentions_per_post mentions" do
|
||||
it "allows a new user to have newuser_max_mentions_per_post mentions" do
|
||||
post_with_one_mention.should be_valid
|
||||
end
|
||||
|
||||
it "doesn't allow a visitor to have more than visitor_max_mentions_per_post mentions" do
|
||||
it "doesn't allow a new user to have more than newuser_max_mentions_per_post mentions" do
|
||||
post_with_two_mentions.should_not be_valid
|
||||
end
|
||||
end
|
||||
|
||||
context "non-visitor" do
|
||||
context "not a new user" do
|
||||
before do
|
||||
SiteSetting.stubs(:visitor_max_mentions_per_post).returns(0)
|
||||
SiteSetting.stubs(:newuser_max_mentions_per_post).returns(0)
|
||||
SiteSetting.stubs(:max_mentions_per_post).returns(1)
|
||||
end
|
||||
|
||||
|
|
|
@ -131,14 +131,14 @@ describe Report do
|
|||
|
||||
context "with users at different trust levels" do
|
||||
before do
|
||||
3.times { Fabricate(:user, trust_level: TrustLevel.levels[:visitor]) }
|
||||
3.times { Fabricate(:user, trust_level: TrustLevel.levels[:newuser]) }
|
||||
2.times { Fabricate(:user, trust_level: TrustLevel.levels[:regular]) }
|
||||
Fabricate(:user, trust_level: TrustLevel.levels[:elder])
|
||||
end
|
||||
|
||||
it "returns a report with data" do
|
||||
report.data.should be_present
|
||||
report.data.find {|d| d[:x] == TrustLevel.levels[:visitor]} [:y].should == 3
|
||||
report.data.find {|d| d[:x] == TrustLevel.levels[:newuser]} [:y].should == 3
|
||||
report.data.find {|d| d[:x] == TrustLevel.levels[:regular]}[:y].should == 2
|
||||
report.data.find {|d| d[:x] == TrustLevel.levels[:elder]}[:y].should == 1
|
||||
end
|
||||
|
|
|
@ -267,7 +267,7 @@ describe User do
|
|||
describe "trust levels" do
|
||||
|
||||
# NOTE be sure to use build to avoid db calls
|
||||
let(:user) { Fabricate.build(:user, trust_level: TrustLevel.levels[:visitor]) }
|
||||
let(:user) { Fabricate.build(:user, trust_level: TrustLevel.levels[:newuser]) }
|
||||
|
||||
it "sets to the default trust level setting" do
|
||||
SiteSetting.expects(:default_trust_level).returns(TrustLevel.levels[:elder])
|
||||
|
@ -281,7 +281,7 @@ describe User do
|
|||
end
|
||||
|
||||
it "is true for your basic level" do
|
||||
user.has_trust_level?(:visitor).should be_true
|
||||
user.has_trust_level?(:newuser).should be_true
|
||||
end
|
||||
|
||||
it "is false for a higher level" do
|
||||
|
@ -290,7 +290,7 @@ describe User do
|
|||
|
||||
it "is true if you exceed the level" do
|
||||
user.trust_level = TrustLevel.levels[:elder]
|
||||
user.has_trust_level?(:visitor).should be_true
|
||||
user.has_trust_level?(:newuser).should be_true
|
||||
end
|
||||
|
||||
it "is true for an admin even with a low trust level" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user