diff --git a/Changelog.md b/Changelog.md index 036083042..93735f234 100644 --- a/Changelog.md +++ b/Changelog.md @@ -41,12 +41,14 @@ Although the chat was never enabled per default and was marked as experimental, ## Refactor * Cache local posts/comments count for statistics [#8241](https://github.com/diaspora/diaspora/pull/8241) * Fix html-syntax in some handlebars templates [#8251](https://github.com/diaspora/diaspora/pull/8251) +* Remove `chat_enabled` flag from archive export [#8265](https://github.com/diaspora/diaspora/pull/8265) ## Bug fixes ## Features * Add tags to tumblr posts [#8244](https://github.com/diaspora/diaspora/pull/8244) * Add blocks to the archive export [#8263](https://github.com/diaspora/diaspora/pull/8263) +* Allow points and dashes in the username [#8266](https://github.com/diaspora/diaspora/pull/8266) # 0.7.15.0 diff --git a/app/models/user.rb b/app/models/user.rb index bfc97325b..14eb4562c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -36,10 +36,8 @@ class User < ApplicationRecord before_validation :set_current_language, :on => :create before_validation :set_default_color_theme, on: :create - validates :username, :presence => true, :uniqueness => true - validates_format_of :username, :with => /\A[A-Za-z0-9_]+\z/ - validates_length_of :username, :maximum => 32 - validates_exclusion_of :username, :in => AppConfig.settings.username_blacklist + validates :username, presence: true, uniqueness: true, format: {with: /\A[A-Za-z0-9_.\-]+\z/}, + length: {maximum: 32}, exclusion: {in: AppConfig.settings.username_blacklist} validates_inclusion_of :language, :in => AVAILABLE_LANGUAGE_CODES validates :color_theme, inclusion: {in: AVAILABLE_COLOR_THEMES}, allow_blank: true validates_format_of :unconfirmed_email, :with => Devise.email_regexp, :allow_blank => true diff --git a/app/views/registrations/_form.haml b/app/views/registrations/_form.haml index 9cd6ce0f7..b9f99cfa5 100644 --- a/app/views/registrations/_form.haml +++ b/app/views/registrations/_form.haml @@ -32,7 +32,7 @@ placeholder: t("registrations.new.username"), title: t("registrations.new.enter_username"), required: true, - pattern: "[A-Za-z0-9_]+", + pattern: "[A-Za-z0-9_.\-]+", aria: {labelledby: "usernameLabel"} - if mobile diff --git a/config/routes.rb b/config/routes.rb index 65ce0e8f1..8eb5c1ad9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -186,7 +186,11 @@ Rails.application.routes.draw do post 'by_handle' => :retrieve_remote, :as => 'person_by_handle' end end - get '/u/:username' => 'people#show', :as => 'user_profile', :constraints => { :username => /[^\/]+/ } + + # Note: The contraint for this route's username parameter cannot be removed. + # This constraint turns off the format parameter, so that an username + # doctor.example would not try to render the user `doctor` in `example` format. + get "/u/:username" => "people#show", :as => "user_profile", :constraints => {username: %r{[^/]+}} # External @@ -209,7 +213,7 @@ Rails.application.routes.draw do get 'help/:topic' => 'help#faq' #Protocol Url - get "protocol" => redirect("https://wiki.diasporafoundation.org/Federation_Protocol_Overview") + get "protocol" => redirect("https://diaspora.github.io/diaspora_federation/") # NodeInfo get ".well-known/nodeinfo", to: "node_info#jrd" diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c192fbd9e..ff159932a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -261,11 +261,6 @@ describe User, type: :model do expect(alice).not_to be_valid end - it "should not contain periods" do - alice.username = "kittens." - expect(alice).not_to be_valid - end - it "can be 32 characters long" do alice.username = "hexagoooooooooooooooooooooooooon" expect(alice).to be_valid