FEATURE: Replace Lounge with General Category (#18097)

- Seed the General category so that the general chat channel will have
  a home
- Do not seed the Lounge category anymore
- Move the "Welcome to Site" topic to the General category
This commit is contained in:
Blake Erickson 2022-08-29 13:05:41 -06:00 committed by GitHub
parent e16c8ea2e7
commit eba8b8d34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 56 deletions

View File

@ -647,8 +647,8 @@ en:
uncategorized_category_name: "Uncategorized"
vip_category_name: "Lounge"
vip_category_description: "A category exclusive to members with trust level 3 and higher."
general_category_name: "General"
general_category_description: "Create topics here that dont fit into any other existing category."
meta_category_name: "Site Feedback"
meta_category_description: "Discussion about this site, its organization, how it works, and how we can improve it."
@ -673,30 +673,6 @@ en:
You may want to close this topic via the admin :wrench: (at the upper right and bottom), so that replies don't pile up on an announcement.
lounge_welcome:
title: "Welcome to the Lounge"
body: |
Congratulations! :confetti_ball:
If you can see this topic, you were recently promoted to **regular** (trust level 3).
You can now …
* Edit the title of any topic
* Change the category of any topic
* Have all your links followed ([automatic nofollow](https://en.wikipedia.org/wiki/Nofollow) is removed)
* Access a private Lounge category only visible to users at trust level 3 and higher
* Hide spam with a single flag
Here's the [current list of fellow regulars](%{base_path}/badges/3/regular). Be sure to say hi.
Thanks for being an important part of this community!
(For more information on trust levels, [see this topic][trust]. Please note that only members who continue to meet the requirements over time will remain regulars.)
[trust]: https://blog.discourse.org/2018/06/understanding-discourse-trust-levels/
admin_quick_start_title: "READ ME FIRST: Admin Quick Start Guide"
category:

View File

@ -2263,7 +2263,7 @@ uncategorized:
hidden: true
# Category IDs
lounge_category_id:
general_category_id:
default: -1
hidden: true
meta_category_id:
@ -2335,9 +2335,6 @@ uncategorized:
default: -1
hidden: true
client: true
lounge_welcome_topic_id:
default: -1
hidden: true
admin_quick_start_topic_id:
default: -1
hidden: true

View File

@ -77,14 +77,14 @@ module SeedData
force_permissions: true
},
{
site_setting_name: 'lounge_category_id',
name: I18n.t('vip_category_name'),
description: I18n.t('vip_category_description'),
site_setting_name: 'general_category_id',
name: I18n.t('general_category_name'),
description: I18n.t('general_category_description'),
position: 3,
color: 'A461EF',
text_color: '652D90',
permissions: { trust_level_3: :full },
force_permissions: false
color: '25AAE2',
text_color: 'FFFFFF',
permissions: { everyone: :full },
force_permissions: true
}
]

View File

@ -85,24 +85,14 @@ module SeedData
if include_welcome_topics
# Welcome Topic
topics << {
site_setting_name: 'welcome_topic_id',
title: I18n.t('discourse_welcome_topic.title'),
raw: I18n.t('discourse_welcome_topic.body', base_path: Discourse.base_path),
after_create: proc do |post|
post.topic.update_pinned(true, true)
end
}
# Lounge Welcome Topic
if lounge_category = Category.find_by(id: SiteSetting.lounge_category_id)
if general_category = Category.find_by(id: SiteSetting.general_category_id)
topics << {
site_setting_name: 'lounge_welcome_topic_id',
title: I18n.t('lounge_welcome.title'),
raw: I18n.t('lounge_welcome.body', base_path: Discourse.base_path),
category: lounge_category,
site_setting_name: 'welcome_topic_id',
title: I18n.t('discourse_welcome_topic.title'),
raw: I18n.t('discourse_welcome_topic.body', base_path: Discourse.base_path),
category: general_category,
after_create: proc do |post|
post.topic.update_pinned(true)
post.topic.update_pinned(true, true)
end
}
end

View File

@ -158,13 +158,13 @@ RSpec.describe SeedData::Categories do
describe "#reseed_options" do
it "returns only existing categories as options" do
create_category("meta_category_id")
create_category("lounge_category_id")
create_category("general_category_id")
Post.last.revise(Fabricate(:admin), raw: "Hello world")
expected_options = [
{ id: "uncategorized_category_id", name: I18n.t("uncategorized_category_name"), selected: true },
{ id: "meta_category_id", name: I18n.t("meta_category_name"), selected: true },
{ id: "lounge_category_id", name: I18n.t("vip_category_name"), selected: false }
{ id: "general_category_id", name: I18n.t("general_category_name"), selected: false }
]
expect(subject.reseed_options).to eq(expected_options)

View File

@ -5,6 +5,11 @@ require 'seed_data/topics'
RSpec.describe SeedData::Topics do
subject { SeedData::Topics.with_default_locale }
before do
general_category = Fabricate(:category, name: "General")
SiteSetting.general_category_id = general_category.id
end
def create_topic(name = "welcome_topic_id")
subject.create(site_setting_names: [name])
end
@ -18,7 +23,7 @@ RSpec.describe SeedData::Topics do
topic = Topic.last
expect(topic.title).to eq(I18n.t("discourse_welcome_topic.title"))
expect(topic.first_post.raw).to eq(I18n.t('discourse_welcome_topic.body', base_path: Discourse.base_path).rstrip)
expect(topic.category_id).to eq(SiteSetting.uncategorized_category_id)
expect(topic.category_id).to eq(SiteSetting.general_category_id)
expect(topic.user_id).to eq(Discourse::SYSTEM_USER_ID)
expect(topic.pinned_globally).to eq(true)
expect(topic.pinned_at).to be_present