From 97a4926c24fba2b7902242ca3b8486a433930c4a Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 18:07:26 -0600 Subject: [PATCH 01/74] require usernames to be 1-20 characters --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index 02a72777..dfc47b5b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,6 +12,7 @@ class User < ApplicationRecord include Authority::UserAbilities validates_uniqueness_of :username, allow_nil: true, allow_blank: true + validates :username, length: { in: 1..20 } has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions From d75cc4b07ff7ccafa176418aeff58b000156df05 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 18:11:26 -0600 Subject: [PATCH 02/74] require usernames to be alphanumeric --- app/models/user.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/user.rb b/app/models/user.rb index dfc47b5b..caf95de0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,6 +13,7 @@ class User < ApplicationRecord validates_uniqueness_of :username, allow_nil: true, allow_blank: true validates :username, length: { in: 1..20 } + validates :username, with: /^[A-Za-z0-9]+$/ has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions From cd0dc21e5de7c707073f79ebf50ba4ee953f5d02 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 18:20:01 -0600 Subject: [PATCH 03/74] allow accessing profile by /@andrew --- app/controllers/users_controller.rb | 10 ++++++++-- app/models/user.rb | 2 +- app/views/users/profile/_public_pages.html.erb | 2 +- app/views/users/show.html.erb | 2 +- config/routes.rb | 2 ++ 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 94379ecf..f1612ee3 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,8 +5,8 @@ class UsersController < ApplicationController def show @sidenav_expansion = 'my account' - - @user = User.find_by(id: params[:id]) + + @user = User.find_by(user_params) return redirect_to(root_path, notice: 'That user does not exist.') if @user.nil? @content = @user.public_content.select { |type, list| list.any? } @@ -70,4 +70,10 @@ class UsersController < ApplicationController notifier.ping ":bomb: :bomb: :bomb: #{user.email.split('@').first}@ (##{user.id}) just deleted their account." end + + private + + def user_params + params.permit(:id, :username) + end end diff --git a/app/models/user.rb b/app/models/user.rb index caf95de0..6c88a336 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,8 +12,8 @@ class User < ApplicationRecord include Authority::UserAbilities validates_uniqueness_of :username, allow_nil: true, allow_blank: true + validates_format_of :username, with: /\A[A-Za-z0-9]+\z/ validates :username, length: { in: 1..20 } - validates :username, with: /^[A-Za-z0-9]+$/ has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions diff --git a/app/views/users/profile/_public_pages.html.erb b/app/views/users/profile/_public_pages.html.erb index 1a26f6e4..8af92018 100644 --- a/app/views/users/profile/_public_pages.html.erb +++ b/app/views/users/profile/_public_pages.html.erb @@ -7,7 +7,7 @@ <% @tabs.each do |tab| %> <% content_type_class = @user.send(tab).build.class %> - <%= link_to send("#{tab}_user_path"), class: "collection-item #{content_type_class.color}-text" do %> + <%= link_to send("#{tab}_user_path", { id: @user.id }), class: "collection-item #{content_type_class.color}-text" do %> <%= pluralize @content[tab].length, tab.to_s.singularize %> <%= content_type_class.icon %> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 7376faeb..0fc9ba2d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -5,7 +5,7 @@ image_src: @user.image_url(120) content_jsonld = { - '@id': user_url, + '@id': user_url(id: @user.id), '@type': 'http://schema.org/Person', 'http://schema.org/name': @user.name, 'http://schema.org/description': "#{@user.name}’s profile on notebook.ai", diff --git a/config/routes.rb b/config/routes.rb index dd50f289..54339224 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,6 +12,8 @@ Rails.application.routes.draw do get content_type.name.downcase.pluralize.to_sym, on: :member end end + get '/@:username', to: 'users#show' + scope '/my' do get '/content', to: 'main#dashboard', as: :dashboard get '/content/recent', to: 'main#recent_content', as: :recent_content From 398c4d0661ad982b687bf82509f49307c88b7471 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 18:23:33 -0600 Subject: [PATCH 04/74] expose username link on profile --- app/views/users/profile/_info.html.erb | 2 +- config/routes.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/profile/_info.html.erb b/app/views/users/profile/_info.html.erb index d3107644..1cacbdb8 100644 --- a/app/views/users/profile/_info.html.erb +++ b/app/views/users/profile/_info.html.erb @@ -28,7 +28,7 @@ Username
- <%= link_to "@#{@user.username}", thredded_path %> + <%= link_to "@#{@user.username}", profile_by_username_path(username: @user.username) %>

<% end %> diff --git a/config/routes.rb b/config/routes.rb index 54339224..5af4e715 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,7 @@ Rails.application.routes.draw do get content_type.name.downcase.pluralize.to_sym, on: :member end end - get '/@:username', to: 'users#show' + get '/@:username', to: 'users#show', as: :profile_by_username scope '/my' do get '/content', to: 'main#dashboard', as: :dashboard From 8a2fe077304630656683ac485f4c352342d2620d Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 18:52:32 -0600 Subject: [PATCH 05/74] use new username path when available --- app/models/user.rb | 8 ++++++++ .../devise/registrations/panes/_information.html.erb | 1 + app/views/layouts/_sidenav.html.erb | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 6c88a336..2c6bd652 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -190,6 +190,14 @@ class User < ApplicationRecord found_key.user end + def profile_url + if self.username.present? + Rails.application.routes.url_helpers.profile_by_username_path(username: self.username) + else + Rails.application.routes.url_helpers.user_path(id: self.id) + end + end + private # Attributes that are non-public, and should be blacklisted from any public diff --git a/app/views/devise/registrations/panes/_information.html.erb b/app/views/devise/registrations/panes/_information.html.erb index 98dfc1a9..f511168e 100644 --- a/app/views/devise/registrations/panes/_information.html.erb +++ b/app/views/devise/registrations/panes/_information.html.erb @@ -16,6 +16,7 @@
<%= f.label 'Username (users can @mention you with your username on the forums)' %>
<%= f.text_field :username %> + Your profile will also be available at https://www.notebook.ai/@username.
diff --git a/app/views/layouts/_sidenav.html.erb b/app/views/layouts/_sidenav.html.erb index 46c786ed..9ec94cec 100644 --- a/app/views/layouts/_sidenav.html.erb +++ b/app/views/layouts/_sidenav.html.erb @@ -135,7 +135,7 @@
  • - <%= link_to current_user, class: 'waves-effect' do %> + <%= link_to current_user.profile_url, class: 'waves-effect' do %> person Profile <% end %> From 14981516788e513d9ca470830697b192d9be5f3e Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 19:01:40 -0600 Subject: [PATCH 06/74] double length limit --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 2c6bd652..e06474f0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -13,7 +13,7 @@ class User < ApplicationRecord validates_uniqueness_of :username, allow_nil: true, allow_blank: true validates_format_of :username, with: /\A[A-Za-z0-9]+\z/ - validates :username, length: { in: 1..20 } + validates :username, length: { in: 1..40 } has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions From 1d506d005b02633ecb84891ffacb8b81e36a970f Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 19:07:57 -0600 Subject: [PATCH 07/74] allow - and _ in usernames --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index e06474f0..10caeba9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,7 @@ class User < ApplicationRecord include Authority::UserAbilities validates_uniqueness_of :username, allow_nil: true, allow_blank: true - validates_format_of :username, with: /\A[A-Za-z0-9]+\z/ + validates_format_of :username, with: /\A[A-Za-z0-9\-_]+\z/ validates :username, length: { in: 1..40 } has_many :subscriptions, dependent: :destroy From adfd8e9d6a3549366c083e45c671b067c272c737 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 15 Jan 2019 19:42:15 -0600 Subject: [PATCH 08/74] allow most symbols in RFC 1738 --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 10caeba9..ab7a2e6b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,7 +12,7 @@ class User < ApplicationRecord include Authority::UserAbilities validates_uniqueness_of :username, allow_nil: true, allow_blank: true - validates_format_of :username, with: /\A[A-Za-z0-9\-_]+\z/ + validates_format_of :username, with: /\A[A-Za-z0-9\-_\$\+\!\*\(\)]+\z/ validates :username, length: { in: 1..40 } has_many :subscriptions, dependent: :destroy From f116276f104da588caa71c7748c9ce9e608f3442 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 22 Feb 2019 13:03:12 -0600 Subject: [PATCH 09/74] fix regression on page tag create/update calls --- app/controllers/content_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index 58b4a542..f337ccae 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -182,7 +182,7 @@ class ContentController < ApplicationController upload_files params['image_uploads'], content_type.name, @content.id end - update_page_tags + update_page_tags unless [AttributeCategory.name, AttributeField.name].include?(@content.class.name) successful_response(content_creation_redirect_url, t(:create_success, model_name: @content.try(:name).presence || humanized_model_name)) else @@ -214,7 +214,7 @@ class ContentController < ApplicationController end end - update_page_tags + update_page_tags unless [AttributeCategory.name, AttributeField.name].include?(@content.class.name) if @content.user == current_user # todo this needs some extra validation probably to ensure each attribute is one associated with this page From b5331a9daf35be49fbac3cc604c6a51802a95322 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 22 Feb 2019 13:08:26 -0600 Subject: [PATCH 10/74] be a little safer on that --- app/controllers/content_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index f337ccae..cef1da4d 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -182,7 +182,7 @@ class ContentController < ApplicationController upload_files params['image_uploads'], content_type.name, @content.id end - update_page_tags unless [AttributeCategory.name, AttributeField.name].include?(@content.class.name) + update_page_tags if @content.respond_to?(:page_tags) successful_response(content_creation_redirect_url, t(:create_success, model_name: @content.try(:name).presence || humanized_model_name)) else @@ -214,7 +214,7 @@ class ContentController < ApplicationController end end - update_page_tags unless [AttributeCategory.name, AttributeField.name].include?(@content.class.name) + update_page_tags if @content.respond_to?(:page_tags) if @content.user == current_user # todo this needs some extra validation probably to ensure each attribute is one associated with this page From e7e090dc11011e33a807b6fec60ddb0222e3b3e6 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 22 Feb 2019 13:41:43 -0600 Subject: [PATCH 11/74] update thredded to 0.16.8 --- Gemfile.lock | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 60802fc5..8af71d00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM ast (2.4.0) authority (3.3.0) activesupport (>= 3.0.0) - autoprefixer-rails (9.4.5) + autoprefixer-rails (9.4.8) execjs aws-eventstream (1.0.1) aws-partitions (1.131.0) @@ -209,7 +209,7 @@ GEM activesupport (>= 2) nokogiri (>= 1.4) htmlentities (4.3.4) - i18n (1.5.2) + i18n (1.5.3) concurrent-ruby (~> 1.0) inline_svg (1.3.1) activesupport (>= 3.0) @@ -235,7 +235,9 @@ GEM activerecord kaminari-core (= 1.1.1) kaminari-core (1.1.1) - kramdown (1.17.0) + kramdown (2.1.0) + kramdown-parser-gfm (1.0.1) + kramdown (~> 2.0) libv8 (6.7.288.46.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) @@ -285,7 +287,7 @@ GEM notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) - onebox (1.8.76) + onebox (1.8.78) htmlentities (~> 4.3) moneta (~> 1.0) multi_json (~> 1.11) @@ -313,7 +315,7 @@ GEM puma (3.12.0) puma-heroku (1.0.0) puma (~> 3.0) - pundit (2.0.0) + pundit (2.0.1) activesupport (>= 3.0.0) rack (2.0.6) rack-mini-profiler (1.0.1) @@ -389,7 +391,7 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rinku (2.0.4) + rinku (2.0.5) rmagick (2.16.0) rspec (3.8.0) rspec-core (~> 3.8.0) @@ -494,7 +496,7 @@ GEM climate_control (>= 0.0.3, < 1.0) thor (0.20.3) thread_safe (0.3.6) - thredded (0.16.4) + thredded (0.16.8) active_record_union (>= 1.3.0) autoprefixer-rails db_text_search (~> 0.3.0) @@ -503,7 +505,8 @@ GEM htmlentities inline_svg kaminari - kramdown (>= 1.17.0) + kramdown (>= 2.0.0) + kramdown-parser-gfm nokogiri onebox (~> 1.8, >= 1.8.48) pundit (>= 1.1.0) @@ -619,4 +622,4 @@ RUBY VERSION ruby 2.5.1p57 BUNDLED WITH - 1.16.4 + 1.17.3 From 5c83370814aae65e2739b6a163420ea455debc39 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 22 Feb 2019 13:46:21 -0600 Subject: [PATCH 12/74] add a few more suggested page tags --- app/services/page_tag_service.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/page_tag_service.rb b/app/services/page_tag_service.rb index 46d07370..cc91a6e2 100644 --- a/app/services/page_tag_service.rb +++ b/app/services/page_tag_service.rb @@ -16,13 +16,13 @@ class PageTagService < Service when Creature.name ["Domesticated", "Wild", "Humanoid"] when Deity.name - ["Good", "Evil"] + ["Good", "Evil", "Neutral"] when Flora.name - ["Floral", "Weed"] + ["Floral", "Weed", "Tree", "Bush"] when Government.name ["Republic", "Democracy", "Monarchy", "Dictatorship"] when Group.name - ["Good", "Evil"] + ["Good", "Evil", "Secret"] when Item.name ["Weapon", "Armor", "Artifact", "Relic"] when Job.name From 27fd804e51590185aa0c733844cfb7db9aa9b5b8 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sat, 23 Feb 2019 11:58:05 -0600 Subject: [PATCH 13/74] be a little extra safe on ui toasts --- app/views/cards/ui/_alert.html.erb | 2 +- app/views/cards/ui/_notice.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/cards/ui/_alert.html.erb b/app/views/cards/ui/_alert.html.erb index 01324c87..a60de6da 100644 --- a/app/views/cards/ui/_alert.html.erb +++ b/app/views/cards/ui/_alert.html.erb @@ -1,7 +1,7 @@ <% if alert %> <%= content_for :javascript do %> M.toast({ - html: "<%= alert.gsub('"', '\"').html_safe %>", + html: "<%= alert.gsub('"', '\"').gsub("\n", ' ').html_safe %>", classes: 'rounded' }) <% end %> diff --git a/app/views/cards/ui/_notice.html.erb b/app/views/cards/ui/_notice.html.erb index da6c047e..c376709c 100644 --- a/app/views/cards/ui/_notice.html.erb +++ b/app/views/cards/ui/_notice.html.erb @@ -1,7 +1,7 @@ <% if notice %> <%= content_for :javascript do %> M.toast({ - html: "<%= notice.gsub('"', '\"').html_safe %>", + html: "<%= notice.gsub('"', '\"').gsub("\n", ' ').html_safe %>", classes: 'rounded' }) <% end %> From 18c11db8ce48117681371d2c30401b2fc7601e46 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Tue, 26 Feb 2019 11:39:48 -0600 Subject: [PATCH 14/74] Update README.rdoc --- README.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rdoc b/README.rdoc index 0b13b7d9..3051b7d1 100644 --- a/README.rdoc +++ b/README.rdoc @@ -80,7 +80,7 @@ You should now see a copy of the site running locally at http://localhost:3000/! == Deployment to notebook.ai -Deployment to the live stage will only be done by approved developers, and consists of a deployment of +Deployment to the live production servers at www.Notebook.ai will only be done by approved developers, and consists of a deployment of - deploy github to staging (done only by approved developers) From 86927d604376c6abf6de7257a3e7d85925901668 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 14:26:19 -0500 Subject: [PATCH 15/74] update missed url --- app/views/main/dashboard.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/main/dashboard.html.erb b/app/views/main/dashboard.html.erb index 3aeeed09..a03d8f51 100644 --- a/app/views/main/dashboard.html.erb +++ b/app/views/main/dashboard.html.erb @@ -40,7 +40,7 @@
- <%= link_to current_user do %> + <%= link_to current_user.profile_url do %>
From 79158425f47ba33bbf2d8ab71b226d073984eea2 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 14:50:40 -0500 Subject: [PATCH 16/74] mildly cleaner user#edit error messages --- app/models/user.rb | 4 ++-- app/views/devise/registrations/edit.html.erb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index ab7a2e6b..7b2f281f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -12,8 +12,8 @@ class User < ApplicationRecord include Authority::UserAbilities validates_uniqueness_of :username, allow_nil: true, allow_blank: true - validates_format_of :username, with: /\A[A-Za-z0-9\-_\$\+\!\*\(\)]+\z/ - validates :username, length: { in: 1..40 } + validates_format_of :username, with: /\A[A-Za-z0-9\-_\$\+\!\*]+\z/, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)' + validates :username, length: { in: 0..40, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)' } has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 9b5387c2..a2328d78 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,5 +1,7 @@ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> +
+ <%= devise_error_messages! %> +
From 2f17b8294b6c0944e52f3ce934751d3d14dee47c Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 14:59:28 -0500 Subject: [PATCH 17/74] help text in form --- app/views/devise/registrations/panes/_information.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/devise/registrations/panes/_information.html.erb b/app/views/devise/registrations/panes/_information.html.erb index f511168e..e89911a3 100644 --- a/app/views/devise/registrations/panes/_information.html.erb +++ b/app/views/devise/registrations/panes/_information.html.erb @@ -16,7 +16,8 @@
<%= f.label 'Username (users can @mention you with your username on the forums)' %>
<%= f.text_field :username %> - Your profile will also be available at https://www.notebook.ai/@username. + Your Notebook.ai profile will be available at https://www.notebook.ai/@username.
+ Up to 40 numbers, letters, and/or the following symbols are allowed: - _ $ + ! *
From a6ee9f8ab175d52dc7d256083ed46d1e0ea6a0ff Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 15:05:34 -0500 Subject: [PATCH 18/74] update thredded and i18n --- Gemfile.lock | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 60802fc5..630c57fb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM ast (2.4.0) authority (3.3.0) activesupport (>= 3.0.0) - autoprefixer-rails (9.4.5) + autoprefixer-rails (9.4.10.2) execjs aws-eventstream (1.0.1) aws-partitions (1.131.0) @@ -123,7 +123,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) connection_pool (2.2.2) crack (0.4.3) safe_yaml (~> 1.0.0) @@ -174,7 +174,7 @@ GEM railties (>= 3.0.0) faraday (0.15.4) multipart-post (>= 1.2, < 3) - ffi (1.9.25) + ffi (1.10.0) filesize (0.2.0) flamegraph (0.9.5) font-awesome-rails (4.7.0.4) @@ -209,7 +209,7 @@ GEM activesupport (>= 2) nokogiri (>= 1.4) htmlentities (4.3.4) - i18n (1.5.2) + i18n (1.6.0) concurrent-ruby (~> 1.0) inline_svg (1.3.1) activesupport (>= 3.0) @@ -235,7 +235,9 @@ GEM activerecord kaminari-core (= 1.1.1) kaminari-core (1.1.1) - kramdown (1.17.0) + kramdown (2.1.0) + kramdown-parser-gfm (1.0.1) + kramdown (~> 2.0) libv8 (6.7.288.46.1) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) @@ -285,7 +287,7 @@ GEM notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) - onebox (1.8.76) + onebox (1.8.82) htmlentities (~> 4.3) moneta (~> 1.0) multi_json (~> 1.11) @@ -313,7 +315,7 @@ GEM puma (3.12.0) puma-heroku (1.0.0) puma (~> 3.0) - pundit (2.0.0) + pundit (2.0.1) activesupport (>= 3.0.0) rack (2.0.6) rack-mini-profiler (1.0.1) @@ -389,7 +391,7 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rinku (2.0.4) + rinku (2.0.5) rmagick (2.16.0) rspec (3.8.0) rspec-core (~> 3.8.0) @@ -443,8 +445,8 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sassc (2.0.0) - ffi (~> 1.9.6) + sassc (2.0.1) + ffi (~> 1.9) rake sassc-rails (2.1.0) railties (>= 4.0.0) @@ -494,7 +496,7 @@ GEM climate_control (>= 0.0.3, < 1.0) thor (0.20.3) thread_safe (0.3.6) - thredded (0.16.4) + thredded (0.16.9) active_record_union (>= 1.3.0) autoprefixer-rails db_text_search (~> 0.3.0) @@ -503,7 +505,8 @@ GEM htmlentities inline_svg kaminari - kramdown (>= 1.17.0) + kramdown (>= 2.0.0) + kramdown-parser-gfm nokogiri onebox (~> 1.8, >= 1.8.48) pundit (>= 1.1.0) @@ -619,4 +622,4 @@ RUBY VERSION ruby 2.5.1p57 BUNDLED WITH - 1.16.4 + 1.17.3 From 83ea63754576874977a69d22538d34ad17a53bf5 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 15:23:24 -0500 Subject: [PATCH 19/74] aside-posts --- app/views/thredded/posts/_post.html.erb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/views/thredded/posts/_post.html.erb diff --git a/app/views/thredded/posts/_post.html.erb b/app/views/thredded/posts/_post.html.erb new file mode 100644 index 00000000..00147364 --- /dev/null +++ b/app/views/thredded/posts/_post.html.erb @@ -0,0 +1,20 @@ +<% post, content = post_and_content if local_assigns.key?(:post_and_content) %> + +<% + muted_post = post.present? && post.to_model.content.split("\n").reject(&:empty?).all? { |paragraph| paragraph.strip.start_with?('(') && paragraph.strip.end_with?(')') } + muted_post_classes = 'grey lighten-4 grey-text text-darken-2' +%> + +<%= render 'thredded/posts_common/before_first_unread_post', post: post if post.first_unread_in_page? %> +<%= content_tag :article, id: dom_id(post), class: "thredded--post thredded--#{post.read_state}--post #{muted_post_classes if muted_post}" do %> + <%= render 'thredded/posts_common/actions', post: post, actions: local_assigns[:actions] %> + <%= render 'thredded/posts_common/header', post: post %> + <%= content || render('thredded/posts/content', post: post) %> + <% if post.pending_moderation? && !Thredded.content_visible_while_pending_moderation %> +

<%= t 'thredded.posts.pending_moderation_notice' %>

+ <% elsif post.blocked? && post.can_moderate? %> +

+ <%= render 'thredded/shared/content_moderation_blocked_state', moderation_record: post.last_moderation_record %> +

+ <% end %> +<% end %> From 7136981f2ecea53431dd571deee85615078281c2 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 15:30:42 -0500 Subject: [PATCH 20/74] emphasize non-muted posts more --- app/views/thredded/posts/_post.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/thredded/posts/_post.html.erb b/app/views/thredded/posts/_post.html.erb index 00147364..48127ee4 100644 --- a/app/views/thredded/posts/_post.html.erb +++ b/app/views/thredded/posts/_post.html.erb @@ -6,7 +6,7 @@ %> <%= render 'thredded/posts_common/before_first_unread_post', post: post if post.first_unread_in_page? %> -<%= content_tag :article, id: dom_id(post), class: "thredded--post thredded--#{post.read_state}--post #{muted_post_classes if muted_post}" do %> +<%= content_tag :article, id: dom_id(post), class: "thredded--post thredded--#{post.read_state}--post #{muted_post ? muted_post_classes : 'card'}" do %> <%= render 'thredded/posts_common/actions', post: post, actions: local_assigns[:actions] %> <%= render 'thredded/posts_common/header', post: post %> <%= content || render('thredded/posts/content', post: post) %> From 8d4bdcb2eff18006d979bcd435e29d03fd1cca1b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 11 Mar 2019 18:17:32 -0500 Subject: [PATCH 21/74] WHOOPS -- fix user signup --- app/models/user.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index 3bd5ee87..a30c3da3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -11,9 +11,12 @@ class User < ApplicationRecord include HasContent include Authority::UserAbilities - validates_uniqueness_of :username, allow_nil: true, allow_blank: true - validates_format_of :username, with: /\A[A-Za-z0-9\-_\$\+\!\*]+\z/, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)' - validates :username, length: { in: 0..40, message: 'must be between 1 and 40 alphanumeric characters (-, _, $, +, !, and * also accepted)' } + validates :username, + uniqueness: true, + allow_nil: true, + allow_blank: true, + length: { maximum: 40 }, + format: /\A[A-Za-z0-9\-_\$\+\!\*]+\z/ has_many :subscriptions, dependent: :destroy has_many :billing_plans, through: :subscriptions From a3bd8e4679cc89f0bfd25e37a40c357c465b0124 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 15 Mar 2019 11:45:12 -0500 Subject: [PATCH 22/74] update rails & railties --- Gemfile.lock | 72 ++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 630c57fb..a1cb5682 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,45 +7,45 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.2) - actionpack (= 5.2.2) + actioncable (5.2.2.1) + actionpack (= 5.2.2.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) + actionmailer (5.2.2.1) + actionpack (= 5.2.2.1) + actionview (= 5.2.2.1) + activejob (= 5.2.2.1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.2) - actionview (= 5.2.2) - activesupport (= 5.2.2) + actionpack (5.2.2.1) + actionview (= 5.2.2.1) + activesupport (= 5.2.2.1) rack (~> 2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.2) - activesupport (= 5.2.2) + actionview (5.2.2.1) + activesupport (= 5.2.2.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) active_record_union (1.3.0) activerecord (>= 4.0) - activejob (5.2.2) - activesupport (= 5.2.2) + activejob (5.2.2.1) + activesupport (= 5.2.2.1) globalid (>= 0.3.6) - activemodel (5.2.2) - activesupport (= 5.2.2) - activerecord (5.2.2) - activemodel (= 5.2.2) - activesupport (= 5.2.2) + activemodel (5.2.2.1) + activesupport (= 5.2.2.1) + activerecord (5.2.2.1) + activemodel (= 5.2.2.1) + activesupport (= 5.2.2.1) arel (>= 9.0) - activestorage (5.2.2) - actionpack (= 5.2.2) - activerecord (= 5.2.2) + activestorage (5.2.2.1) + actionpack (= 5.2.2.1) + activerecord (= 5.2.2.1) marcel (~> 0.3.1) - activesupport (5.2.2) + activesupport (5.2.2.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -327,18 +327,18 @@ GEM rack rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.2) - actioncable (= 5.2.2) - actionmailer (= 5.2.2) - actionpack (= 5.2.2) - actionview (= 5.2.2) - activejob (= 5.2.2) - activemodel (= 5.2.2) - activerecord (= 5.2.2) - activestorage (= 5.2.2) - activesupport (= 5.2.2) + rails (5.2.2.1) + actioncable (= 5.2.2.1) + actionmailer (= 5.2.2.1) + actionpack (= 5.2.2.1) + actionview (= 5.2.2.1) + activejob (= 5.2.2.1) + activemodel (= 5.2.2.1) + activerecord (= 5.2.2.1) + activestorage (= 5.2.2.1) + activesupport (= 5.2.2.1) bundler (>= 1.3.0) - railties (= 5.2.2) + railties (= 5.2.2.1) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.4) actionpack (>= 5.0.1.x) @@ -372,9 +372,9 @@ GEM sass-rails (>= 4.0, < 6) rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.2.2) - actionpack (= 5.2.2) - activesupport (= 5.2.2) + railties (5.2.2.1) + actionpack (= 5.2.2.1) + activesupport (= 5.2.2.1) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) From 92cd36cb3ca0a5074b230624448e4e524afa39d4 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 15 Mar 2019 12:00:38 -0500 Subject: [PATCH 23/74] devise 4.5 to 4.6 --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a1cb5682..fe58294f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -157,7 +157,7 @@ GEM db_text_search (0.3.0) activerecord (>= 4.1.15, < 6.0) debug_inspector (0.0.3) - devise (4.5.0) + devise (4.6.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0, < 6.0) @@ -388,9 +388,9 @@ GEM redis (4.1.0) regexp_parser (1.3.0) remotipart (1.4.2) - responders (2.4.0) - actionpack (>= 4.2.0, < 5.3) - railties (>= 4.2.0, < 5.3) + responders (2.4.1) + actionpack (>= 4.2.0, < 6.0) + railties (>= 4.2.0, < 6.0) rinku (2.0.5) rmagick (2.16.0) rspec (3.8.0) From e26cf573783cb4e83f8e0de2a9deea65742d5d85 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Fri, 15 Mar 2019 12:04:18 -0500 Subject: [PATCH 24/74] rubocop 0.62 to 0.65 --- Gemfile.lock | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fe58294f..e97a032e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -301,16 +301,17 @@ GEM mime-types mimemagic (~> 0.3.0) terrapin (~> 0.6.0) - parallel (1.12.1) + parallel (1.14.0) paranoia (2.4.1) activerecord (>= 4.0, < 5.3) - parser (2.5.3.0) + parser (2.6.0.0) ast (~> 2.4.0) pg (0.21.0) powerpack (0.1.2) pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) + psych (3.1.0) public_suffix (3.0.3) puma (3.12.0) puma-heroku (1.0.0) @@ -417,11 +418,12 @@ GEM rspec-mocks (~> 3.8.0) rspec-support (~> 3.8.0) rspec-support (3.8.0) - rubocop (0.62.0) + rubocop (0.65.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) + psych (>= 3.1.0) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.4.0) From 812b9df23cda99a4f930d57d74356dee9c144ed3 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 18 Mar 2019 16:13:11 -0500 Subject: [PATCH 25/74] hook up list filter bar + tag selection --- app/assets/stylesheets/buttons.scss | 5 +++ app/controllers/content_controller.rb | 4 +- .../components/_list_filter_bar.html.erb | 41 +++++++++++++++---- app/views/content/index.html.erb | 23 +---------- 4 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 app/assets/stylesheets/buttons.scss diff --git a/app/assets/stylesheets/buttons.scss b/app/assets/stylesheets/buttons.scss new file mode 100644 index 00000000..252ddb99 --- /dev/null +++ b/app/assets/stylesheets/buttons.scss @@ -0,0 +1,5 @@ +.btn { + .material-icons { + vertical-align: top; + } +} diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index cef1da4d..dbb24ca0 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -44,8 +44,8 @@ class ContentController < ApplicationController page_id: @content.pluck(:id) ) if params.key?(:slug) - filtered_page_tags = @page_tags.where(slug: params[:slug]) - @content.select! { |content| filtered_page_tags.pluck(:page_id).include?(content.id) } + @filtered_page_tags = @page_tags.where(slug: params[:slug]) + @content.select! { |content| @filtered_page_tags.pluck(:page_id).include?(content.id) } end @content = @content.sort_by(&:name) diff --git a/app/views/content/components/_list_filter_bar.html.erb b/app/views/content/components/_list_filter_bar.html.erb index 8953900f..81eede97 100644 --- a/app/views/content/components/_list_filter_bar.html.erb +++ b/app/views/content/components/_list_filter_bar.html.erb @@ -1,4 +1,4 @@ - +
diff --git a/app/views/content/index.html.erb b/app/views/content/index.html.erb index d1a78061..66322afb 100644 --- a/app/views/content/index.html.erb +++ b/app/views/content/index.html.erb @@ -6,30 +6,9 @@ <%= render partial: 'content/components/parallax_header', locals: { content_type: content_type, content_class: @content_type_class } %> <% end %> - -<% if @page_tags.any? %> -
- View by tag:  - <%= link_to polymorphic_path(@content_type_class) do %> - - <% end %> - <% @page_tags.uniq(&:tag).each do |tag| %> - <%= - link_to send( - "page_tag_#{content_type.pluralize}_path", - slug: PageTagService.slug_for(tag.tag) - ) do - %> - - <% end %> - <% end %> -
-
-<% end %> - <% if @content.any? %> - <%= render partial: 'content/components/list_filter_bar', locals: { } %> + <%= render partial: 'content/components/list_filter_bar', locals: { content_type: @content_type_class } %>
<%= render partial: 'content/list/list', locals: { content_list: @content, content_type: @content_type_class, show_add_another_form: true } %>
From 34efdae80c709e70f3751abd4858fb7ea1a394dd Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 18 Mar 2019 16:24:55 -0500 Subject: [PATCH 26/74] hook up universe filtering in filter bar --- .../components/_list_filter_bar.html.erb | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/app/views/content/components/_list_filter_bar.html.erb b/app/views/content/components/_list_filter_bar.html.erb index 81eede97..8706a5a3 100644 --- a/app/views/content/components/_list_filter_bar.html.erb +++ b/app/views/content/components/_list_filter_bar.html.erb @@ -9,16 +9,30 @@
- star_outline - + -->   -
+   From c9cf6d36fc6c077d18922d2a8942a3f4cb049a06 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Mon, 18 Mar 2019 16:37:53 -0500 Subject: [PATCH 27/74] guardrails --- .../components/_list_filter_bar.html.erb | 129 +++++++++--------- app/views/documents/index.html.erb | 2 +- 2 files changed, 67 insertions(+), 64 deletions(-) diff --git a/app/views/content/components/_list_filter_bar.html.erb b/app/views/content/components/_list_filter_bar.html.erb index 8706a5a3..fa662186 100644 --- a/app/views/content/components/_list_filter_bar.html.erb +++ b/app/views/content/components/_list_filter_bar.html.erb @@ -1,81 +1,84 @@
-
+
-
+ -
- lighten-5' - href='#' - data-position="bottom" - data-delay="500" - data-tooltip="Filter by universe" - data-target='universe-filter-dropdown'> - <%= Universe.icon %> - <%= @universe_scope.try(:name) if @universe_scope %> - - +
+ <% end %>