mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
Users cannot change their own username after 3 days since registering. Site setting username_change_period allows you to change the number of days.
This commit is contained in:
@ -278,6 +278,10 @@ class Guardian
|
||||
!topic.archived && (is_staff? || is_my_own?(topic))
|
||||
end
|
||||
|
||||
def can_edit_username?(user)
|
||||
is_staff? || (is_me?(user) && user.created_at > SiteSetting.username_change_period.days.ago)
|
||||
end
|
||||
|
||||
# Deleting Methods
|
||||
def can_delete_post?(post)
|
||||
# Can't delete the first post
|
||||
|
Reference in New Issue
Block a user