set the avatar to default FIRST when clearing avatar
This commit is contained in:
		@@ -151,10 +151,10 @@ app:post("user_clear_avatar", "/:username/clear_avatar", function(self)
 | 
			
		||||
    return {redirect_to = self:url_for("user", {username = self.params.username})}
 | 
			
		||||
  end
 | 
			
		||||
  local old_avatar_id = target_user.avatar_id
 | 
			
		||||
  util.destroy_avatar(old_avatar_id)
 | 
			
		||||
  target_user:update({
 | 
			
		||||
    avatar_id = 1,
 | 
			
		||||
  })
 | 
			
		||||
  util.destroy_avatar(old_avatar_id)
 | 
			
		||||
  util.inject_infobox(self, "Avatar cleared.")
 | 
			
		||||
  return {redirect_to = self:url_for("user_settings", {username = self.params.username})}
 | 
			
		||||
end)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user