mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 06:25:58 +08:00
59d04c0695
Changed internals so trust levels are referred to with TrustLevel[1], TrustLevel[2] etc. This gives us much better flexibility naming trust levels, these names are meant to be controlled by various communities.
26 lines
629 B
Ruby
26 lines
629 B
Ruby
# kind of odd, but we need it, we also need to nuke usage of User from inside migrations
|
|
# very poor form
|
|
user = User.find_by("id <> -1 and username_lower = 'system'")
|
|
if user
|
|
user.username = UserNameSuggester.suggest("system")
|
|
user.save
|
|
end
|
|
|
|
User.seed do |u|
|
|
u.id = -1
|
|
u.name = "system"
|
|
u.username = "system"
|
|
u.username_lower = "system"
|
|
u.email = "no_email"
|
|
u.password = SecureRandom.hex
|
|
u.active = true
|
|
u.admin = true
|
|
u.moderator = true
|
|
u.email_direct = false
|
|
u.approved = true
|
|
u.email_private_messages = false
|
|
u.trust_level = TrustLevel[4]
|
|
end
|
|
|
|
Group.user_trust_level_change!(-1 ,TrustLevel[4])
|