diff --git a/Gemfile.lock b/Gemfile.lock index 796f90dd..750464ea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1027,7 +1027,7 @@ GEM bundler-audit (0.6.1) bundler (>= 1.2.0, < 3) thor (~> 0.18) - capybara (3.32.1) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -1035,7 +1035,7 @@ GEM rack-test (>= 0.6.3) regexp_parser (~> 1.5) xpath (~> 3.2) - chartkick (3.3.1) + chartkick (3.4.0) childprocess (3.0.0) climate_control (0.2.0) cocoon (1.2.14) @@ -1049,8 +1049,8 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) - connection_pool (2.2.2) + concurrent-ruby (1.1.7) + connection_pool (2.2.3) crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.6) @@ -1100,7 +1100,7 @@ GEM db_text_search (0.3.1) activerecord (>= 4.1.15, < 7.0) debug_inspector (0.0.3) - devise (4.7.1) + devise (4.7.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -1123,15 +1123,15 @@ GEM multipart-post (>= 1.2, < 3) faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) - faye-websocket (0.10.9) + faye-websocket (0.11.0) eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) ffi (1.13.1) filesize (0.2.0) flamegraph (0.9.5) - flipper (0.17.2) - flipper-redis (0.17.2) - flipper (~> 0.17.2) + flipper (0.18.0) + flipper-redis (0.18.0) + flipper (~> 0.18.0) redis (>= 2.2, < 5) font-awesome-rails (4.7.0.5) railties (>= 3.2, < 6.1) @@ -1179,7 +1179,7 @@ GEM concurrent-ruby (~> 1.0) http (~> 4.1.0) jwt (~> 2.2.1) - ibm_watson (1.4.0) + ibm_watson (1.6.0) concurrent-ruby (~> 1.0) eventmachine (~> 1.2) faye-websocket (~> 0.10) @@ -1200,7 +1200,7 @@ GEM jquery-ui-rails (6.0.1) railties (>= 3.2.16) json (2.3.0) - jwt (2.2.1) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -1255,7 +1255,7 @@ GEM mustache (1.1.1) nenv (0.3.0) nested_form (0.3.2) - newrelic_rpm (6.10.0.364) + newrelic_rpm (6.12.0.367) nio4r (2.5.2) nokogiri (1.10.10) mini_portile2 (~> 2.4.0) @@ -1307,13 +1307,11 @@ GEM pundit (2.1.0) activesupport (>= 3.0.0) rack (2.2.3) - rack-mini-profiler (2.0.1) + rack-mini-profiler (2.0.4) rack (>= 1.2.0) rack-pjax (1.1.0) nokogiri (~> 1.5) rack (>= 1.1) - rack-protection (2.0.8.1) - rack rack-proxy (0.6.5) rack rack-test (1.1.0) @@ -1386,7 +1384,7 @@ GEM redis (4.2.1) regexp_parser (1.7.1) remotipart (1.4.4) - responders (3.0.0) + responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.4) @@ -1396,9 +1394,9 @@ GEM rspec-core (~> 3.9.0) rspec-expectations (~> 3.9.0) rspec-mocks (~> 3.9.0) - rspec-core (3.9.1) - rspec-support (~> 3.9.1) - rspec-expectations (3.9.1) + rspec-core (3.9.2) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-mocks (3.9.1) @@ -1407,7 +1405,7 @@ GEM rspec-prof (0.0.7) rspec (~> 3.0) ruby-prof - rspec-rails (4.0.0) + rspec-rails (4.0.1) actionpack (>= 4.2) activesupport (>= 4.2) railties (>= 4.2) @@ -1415,7 +1413,7 @@ GEM rspec-expectations (~> 3.9) rspec-mocks (~> 3.9) rspec-support (~> 3.9) - rspec-support (3.9.2) + rspec-support (3.9.3) rubocop (0.88.0) parallel (~> 1.10) parser (>= 2.7.1.1) @@ -1454,11 +1452,10 @@ GEM shellany (0.0.1) shoulda-matchers (4.3.0) activesupport (>= 4.2.0) - sidekiq (6.0.7) + sidekiq (6.1.1) connection_pool (>= 2.2.2) rack (~> 2.0) - rack-protection (>= 2.0.0) - redis (>= 4.1.0) + redis (>= 4.2.0) simplecov (0.13.0) docile (~> 1.1.0) json (>= 1.8, < 3) @@ -1515,17 +1512,17 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webpacker (5.0.1) + webpacker (5.1.1) activesupport (>= 5.2) rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) - websocket-driver (0.7.2) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.3.1) + zeitwerk (2.4.0) PLATFORMS ruby diff --git a/app/assets/javascripts/billing.js b/app/assets/javascripts/billing.js new file mode 100644 index 00000000..d67fd05c --- /dev/null +++ b/app/assets/javascripts/billing.js @@ -0,0 +1,7 @@ +$(document).ready(function () { + $('.js-prepaid-promo-code').click(function (event) { + var code = $(event.target).text(); + $('#promotional_code_promo_code').val(code); + return false; + }); +}) \ No newline at end of file diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 3c1eaa66..41ca8190 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1,3 +1,7 @@ .container-fluid { margin: 0 30px; } + +.force-word-wrap { + overflow-wrap: break-word; +} \ No newline at end of file diff --git a/app/authorizers/core_content_authorizer.rb b/app/authorizers/core_content_authorizer.rb index 5692e998..b872040f 100644 --- a/app/authorizers/core_content_authorizer.rb +++ b/app/authorizers/core_content_authorizer.rb @@ -9,9 +9,10 @@ class CoreContentAuthorizer < ContentAuthorizer def self.creatable_by?(user) return false if ENV.key?('CONTENT_BLACKLIST') && ENV['CONTENT_BLACKLIST'].split(',').include?(user.email) - - [ - PermissionService.billing_plan_allows_core_content?(user: user) - ].any? + + return true # All billing plans support core content right now + # [ + # PermissionService.billing_plan_allows_core_content?(user: user) + # ].any? end end diff --git a/app/controllers/data_controller.rb b/app/controllers/data_controller.rb index 7c726153..9e165ae6 100644 --- a/app/controllers/data_controller.rb +++ b/app/controllers/data_controller.rb @@ -43,6 +43,12 @@ class DataController < ApplicationController @collaborating_universes = Universe.where(id: collaborating_ids) end + def referrals + @referrals = current_user.referrals.includes(:referree) + @referral_count = @referrals.count + @share_link = "https://www.notebook.ai/?referral=#{current_user.referral_code.code}" + end + private def set_sidenav_expansion diff --git a/app/controllers/page_collection_submissions_controller.rb b/app/controllers/page_collection_submissions_controller.rb index 0d21120a..ca3e069f 100644 --- a/app/controllers/page_collection_submissions_controller.rb +++ b/app/controllers/page_collection_submissions_controller.rb @@ -46,8 +46,14 @@ class PageCollectionSubmissionsController < ApplicationController # DELETE /page_collection_submissions/1 def destroy + unless user_signed_in? && current_user == @page_collection_submission.page_collection.user + raise "Not allowed" + return + end + + page_collection = @page_collection_submission.page_collection @page_collection_submission.destroy - redirect_to page_collection_submissions_url, notice: 'Page collection submission was successfully destroyed.' + redirect_to page_collection, notice: 'The page was successfully removed from this collection.' end def approve diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index 74647d09..ba13c0ad 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -79,6 +79,11 @@ class PageCollectionsController < ApplicationController # DELETE /page_collections/1 def destroy + unless user_signed_in? && current_user == @page_collection.user + raise "Permission denied" + return + end + @page_collection.destroy redirect_to page_collections_url, notice: 'Page collection was successfully destroyed.' end @@ -113,6 +118,27 @@ class PageCollectionsController < ApplicationController redirect_to root_path, notice: "That Collection has been reported to site administration. Thank you!" end + def by_user + @page_collection = PageCollection.find(params[:page_collection_id]) + + unless (@page_collection.privacy == 'public' || (user_signed_in? && @page_collection.user == current_user)) + return redirect_to page_collections_path, notice: "That Collection is not public." + end + + @pages = @page_collection.accepted_submissions.where(user_id: params[:user_id]) + sort_pages + + @submittable_content = if user_signed_in? + @current_user_content.slice(*@page_collection.page_types) + else + [] + end + + @show_contributor_highlight = true + @highlighted_contributor = User.find_by(id: params[:user_id].to_i) + render :show + end + private # Use callbacks to share common setup or constraints between actions. diff --git a/app/controllers/stream_controller.rb b/app/controllers/stream_controller.rb index 0f4ef488..29c1c570 100644 --- a/app/controllers/stream_controller.rb +++ b/app/controllers/stream_controller.rb @@ -3,6 +3,7 @@ class StreamController < ApplicationController before_action :set_stream_navbar_actions, only: [:index, :global] before_action :set_stream_navbar_color, only: [:index, :global] before_action :set_sidenav_expansion + before_action :cache_linkable_content_for_each_content_type, only: [:index] def index followed_users = current_user.followed_users.pluck(:id) diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index fd18d658..6169aae6 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -122,12 +122,6 @@ class SubscriptionsController < ApplicationController end end - def referrals - @referrals = current_user.referrals.includes(:referree) - @referral_count = @referrals.count - @share_link = "https://www.notebook.ai/?referral=#{current_user.referral_code.code}" - end - # This isn't actually needed since we change the paid plan to the free plan, but will be needed when we # add a way to deactivate/delete accounts, so the logic is here for when it's needed. # def cancel @@ -286,9 +280,6 @@ class SubscriptionsController < ApplicationController }, { label: "Billing history", href: main_app.billing_history_path - }, { - label: "Referrals", - href: main_app.referrals_path }] end end diff --git a/app/models/paypal_invoice.rb b/app/models/billing/paypal_invoice.rb similarity index 56% rename from app/models/paypal_invoice.rb rename to app/models/billing/paypal_invoice.rb index 4a664cca..4b12da61 100644 --- a/app/models/paypal_invoice.rb +++ b/app/models/billing/paypal_invoice.rb @@ -1,4 +1,6 @@ class PaypalInvoice < ApplicationRecord + acts_as_paranoid + belongs_to :user belongs_to :page_unlock_promo_code, optional: true @@ -26,32 +28,11 @@ class PaypalInvoice < ApplicationRecord code: 'PP-' + (0...8).map { (65 + rand(26)).chr }.join + '-' + (0...8).map { (65 + rand(26)).chr }.join, page_types: Rails.application.config.content_types[:premium].map(&:name), uses_remaining: 1, - days_active: 30 * self.months.to_i, + days_active: 31 * self.months.to_i, internal_description: "Prepaid with PayPal", description: "Prepaid Premium subscription" ) self.save! - - if PromoService.active?(:promo_bogo) && (self.months == 3 || self.months == 6) - # During this promo, we create a separate Invoice + PromoCode also - self.user.paypal_invoices.create( - paypal_id: "None -- Created from promo_bogo promo", - status: self.status, - user_id: self.user_id, - months: self.months, - amount_cents: 0, - page_unlock_promo_code: PageUnlockPromoCode.create( - code: 'BOGO-' + (0...8).map { (65 + rand(26)).chr }.join + '-' + (0...8).map { (65 + rand(26)).chr }.join, - page_types: Rails.application.config.content_types[:premium].map(&:name), - uses_remaining: 1, - days_active: 30 * self.months.to_i, - internal_description: "promo_bogo duplicate code", - description: "Your free buy-one-get-one-free Premium Code", - ), - approval_url: nil, - payer_id: self.payer_id - ) - end end def activateable? diff --git a/app/models/page_collection.rb b/app/models/page_collections/page_collection.rb similarity index 98% rename from app/models/page_collection.rb rename to app/models/page_collections/page_collection.rb index a93addb0..062219b5 100644 --- a/app/models/page_collection.rb +++ b/app/models/page_collections/page_collection.rb @@ -1,4 +1,6 @@ class PageCollection < ApplicationRecord + acts_as_paranoid + belongs_to :user has_many :page_collection_submissions diff --git a/app/models/page_collection_following.rb b/app/models/page_collections/page_collection_following.rb similarity index 100% rename from app/models/page_collection_following.rb rename to app/models/page_collections/page_collection_following.rb diff --git a/app/models/page_collection_report.rb b/app/models/page_collections/page_collection_report.rb similarity index 100% rename from app/models/page_collection_report.rb rename to app/models/page_collections/page_collection_report.rb diff --git a/app/models/page_collection_submission.rb b/app/models/page_collections/page_collection_submission.rb similarity index 99% rename from app/models/page_collection_submission.rb rename to app/models/page_collections/page_collection_submission.rb index 7e905e24..471c7fa6 100644 --- a/app/models/page_collection_submission.rb +++ b/app/models/page_collections/page_collection_submission.rb @@ -1,4 +1,6 @@ class PageCollectionSubmission < ApplicationRecord + acts_as_paranoid + belongs_to :content, polymorphic: true belongs_to :page_collection belongs_to :user diff --git a/app/models/page_groupers/page_grouper.rb b/app/models/page_groupers/page_grouper.rb new file mode 100644 index 00000000..c1377268 --- /dev/null +++ b/app/models/page_groupers/page_grouper.rb @@ -0,0 +1,7 @@ +class PageGrouper < ApplicationRecord + self.abstract_class = true + + include HasContentLinking + + belongs_to :user, optional: true +end \ No newline at end of file diff --git a/app/models/planet_continent.rb b/app/models/page_groupers/planet_continent.rb similarity index 100% rename from app/models/planet_continent.rb rename to app/models/page_groupers/planet_continent.rb diff --git a/app/models/content_page_share.rb b/app/models/stream/content_page_share.rb similarity index 97% rename from app/models/content_page_share.rb rename to app/models/stream/content_page_share.rb index a367ff3f..4d4e08bf 100644 --- a/app/models/content_page_share.rb +++ b/app/models/stream/content_page_share.rb @@ -1,4 +1,6 @@ class ContentPageShare < ApplicationRecord + acts_as_paranoid + belongs_to :user belongs_to :content_page, polymorphic: true, optional: true belongs_to :secondary_content_page, polymorphic: true, optional: true diff --git a/app/models/content_page_share_following.rb b/app/models/stream/content_page_share_following.rb similarity index 100% rename from app/models/content_page_share_following.rb rename to app/models/stream/content_page_share_following.rb diff --git a/app/models/content_page_share_report.rb b/app/models/stream/content_page_share_report.rb similarity index 100% rename from app/models/content_page_share_report.rb rename to app/models/stream/content_page_share_report.rb diff --git a/app/models/share_comment.rb b/app/models/stream/share_comment.rb similarity index 89% rename from app/models/share_comment.rb rename to app/models/stream/share_comment.rb index 702b8486..8f790e19 100644 --- a/app/models/share_comment.rb +++ b/app/models/stream/share_comment.rb @@ -1,4 +1,6 @@ class ShareComment < ApplicationRecord + acts_as_paranoid + belongs_to :user, optional: true belongs_to :content_page_share diff --git a/app/models/attribute_category_suggestion.rb b/app/models/suggestions/attribute_category_suggestion.rb similarity index 100% rename from app/models/attribute_category_suggestion.rb rename to app/models/suggestions/attribute_category_suggestion.rb diff --git a/app/models/attribute_field_suggestion.rb b/app/models/suggestions/attribute_field_suggestion.rb similarity index 100% rename from app/models/attribute_field_suggestion.rb rename to app/models/suggestions/attribute_field_suggestion.rb diff --git a/app/models/timeline.rb b/app/models/timelines/timeline.rb similarity index 100% rename from app/models/timeline.rb rename to app/models/timelines/timeline.rb diff --git a/app/models/timeline_event.rb b/app/models/timelines/timeline_event.rb similarity index 93% rename from app/models/timeline_event.rb rename to app/models/timelines/timeline_event.rb index 4b886ae6..fc68f032 100644 --- a/app/models/timeline_event.rb +++ b/app/models/timelines/timeline_event.rb @@ -1,4 +1,6 @@ class TimelineEvent < ApplicationRecord + acts_as_paranoid + belongs_to :timeline has_many :timeline_event_entities, dependent: :destroy diff --git a/app/models/timeline_event_entity.rb b/app/models/timelines/timeline_event_entity.rb similarity index 100% rename from app/models/timeline_event_entity.rb rename to app/models/timelines/timeline_event_entity.rb diff --git a/app/models/notice_dismissal.rb b/app/models/users/notice_dismissal.rb similarity index 100% rename from app/models/notice_dismissal.rb rename to app/models/users/notice_dismissal.rb diff --git a/app/models/notification.rb b/app/models/users/notification.rb similarity index 100% rename from app/models/notification.rb rename to app/models/users/notification.rb diff --git a/app/models/page_settings_override.rb b/app/models/users/page_settings_override.rb similarity index 100% rename from app/models/page_settings_override.rb rename to app/models/users/page_settings_override.rb diff --git a/app/models/user_blocking.rb b/app/models/users/user_blocking.rb similarity index 100% rename from app/models/user_blocking.rb rename to app/models/users/user_blocking.rb diff --git a/app/models/user_following.rb b/app/models/users/user_following.rb similarity index 100% rename from app/models/user_following.rb rename to app/models/users/user_following.rb diff --git a/app/views/content/_share.html.erb b/app/views/content/_share.html.erb index 51276c63..8d835096 100644 --- a/app/views/content/_share.html.erb +++ b/app/views/content/_share.html.erb @@ -16,6 +16,13 @@
To be shared, content must either be public or in a public Universe. + + <%= link_to 'https://medium.com/indent-labs/privacy-on-notebook-ai-how-it-works-c23a59faeae2', class: 'blue-text lighten-1', target: '_new' do %> + Learn more about sharing on Notebook.ai. + <% end %> +
+
+ Changes are saved automatically and can be changed at any time.
@@ -69,10 +76,6 @@ <% end %> - -
- Changes are saved automatically and can be changed at any time. -
<% if shared_content.is_a?(Universe) %> @@ -84,12 +87,29 @@ <% end %> -
-

- <%= link_to 'https://medium.com/indent-labs/privacy-on-notebook-ai-how-it-works-c23a59faeae2', class: 'blue-text lighten-1', target: '_new' do %> - Click here to learn more about sharing pages on Notebook.ai - <% end %> -

+ +
+ <%= link_to [ + 'http://twitter.com/share?', + 'url=' + URI::escape(send("#{shared_content.class.name.downcase}_url", shared_content)), + '&text=' + URI::escape("I'm using Notebook.ai to create fictional worlds! You can see my #{shared_content.class.name.downcase} #{shared_content.name} at this link:") + ].join, target: '_new' do %> +
+ + Share to Twitter +
+ <% end %> +
+
+ &display=popup&ref=plugin&src=share_button" + onclick="return !window.open(this.href, 'Facebook', 'width=640,height=580')"> + +
+ + Share to Facebook +
+
<% else %> diff --git a/app/views/content/components/_collection_header.html.erb b/app/views/content/components/_collection_header.html.erb index 658621a1..fc9de293 100644 --- a/app/views/content/components/_collection_header.html.erb +++ b/app/views/content/components/_collection_header.html.erb @@ -3,10 +3,12 @@
  • <%= image_tag(collection.random_public_image) %>
    -

    - <%= PageCollection.icon %> - <%= collection.title %> -

    + <%= link_to collection, class: 'white-text' do %> +

    + <%= PageCollection.icon %> + <%= collection.title %> +

    + <% end %>
    <% if collection.subtitle? %> <%= collection.subtitle %> diff --git a/app/views/content_page_shares/_form.html.erb b/app/views/content_page_shares/_form.html.erb index 3a97df84..0f2d55ae 100644 --- a/app/views/content_page_shares/_form.html.erb +++ b/app/views/content_page_shares/_form.html.erb @@ -23,16 +23,11 @@ By default, your notebook pages are all private. Sharing your page here will automatically make it public, but you can change back to private at any time by editing the page directly.
    -
  • - <%= f.text_area :message, class: 'materialize-textarea' %> + <%= f.text_area :message, class: 'materialize-textarea js-can-mention-pages' %> <%= f.label :message, '2. Write a question or message about your page.' %>
    diff --git a/app/views/content_page_shares/_stream_document_share.html.erb b/app/views/content_page_shares/_stream_document_share.html.erb index 97ddeea8..bf53c6c6 100644 --- a/app/views/content_page_shares/_stream_document_share.html.erb +++ b/app/views/content_page_shares/_stream_document_share.html.erb @@ -47,8 +47,13 @@ <%= link_to [share.user, share] do %><%= time_ago_in_words share.shared_at %> ago<% end %>: -
    - <%= simple_format share.message %> +
    + <%= + simple_format ContentFormatterService.show( + text: share.message, + viewing_user: current_user + ) + %>
    <% end %> diff --git a/app/views/content_page_shares/_stream_page_share.html.erb b/app/views/content_page_shares/_stream_page_share.html.erb index 71aff342..b2752486 100644 --- a/app/views/content_page_shares/_stream_page_share.html.erb +++ b/app/views/content_page_shares/_stream_page_share.html.erb @@ -47,8 +47,13 @@ <%= link_to [share.user, share] do %><%= time_ago_in_words share.shared_at %> ago<% end %>: -
    - <%= simple_format share.message %> +
    + <%= + simple_format ContentFormatterService.show( + text: share.message, + viewing_user: current_user + ) + %>
    <% end %> diff --git a/app/views/content_page_shares/show.html.erb b/app/views/content_page_shares/show.html.erb index f6f7f67d..e8bac02a 100644 --- a/app/views/content_page_shares/show.html.erb +++ b/app/views/content_page_shares/show.html.erb @@ -66,27 +66,34 @@ -
    @@ -102,8 +109,13 @@

    <% if @share.message.present? %> -
    - <%= simple_format @share.message %> +
    + <%= + simple_format ContentFormatterService.show( + text: @share.message, + viewing_user: current_user + ) + %>
    <% end %> diff --git a/app/views/data/index.html.erb b/app/views/data/index.html.erb index 8c24a550..c5fb24ab 100644 --- a/app/views/data/index.html.erb +++ b/app/views/data/index.html.erb @@ -69,6 +69,20 @@ <% end %>
    +
    + <%= link_to referrals_path, class: 'black-text' do %> +
    +
    + favorite +
    Referrals
    +

    + Get your referral code, browse potential rewards, and invite your friends! +

    +
    +
    + <% end %> +
    +
    <%= link_to discussions_path, class: 'black-text' do %>
    diff --git a/app/views/subscriptions/referrals.html.erb b/app/views/data/referrals.html.erb similarity index 100% rename from app/views/subscriptions/referrals.html.erb rename to app/views/data/referrals.html.erb diff --git a/app/views/data/uploads.html.erb b/app/views/data/uploads.html.erb index 2ee22972..04c8c8f6 100644 --- a/app/views/data/uploads.html.erb +++ b/app/views/data/uploads.html.erb @@ -31,9 +31,9 @@
    -
    +
    Did you know? - Premium users get an extra 10GB of storage space, but all users can earn even more storage space by referring their friends to Notebook.ai. + Premium users get an extra 10GB of storage space, but you can earn even more storage space by referring friends to Notebook.ai. <%= link_to 'Learn more.', referrals_path, class: 'orange-text text-lighten-3' %>
    diff --git a/app/views/page_collections/_stream.html.erb b/app/views/page_collections/_stream.html.erb index 46eb0432..4f28ad74 100644 --- a/app/views/page_collections/_stream.html.erb +++ b/app/views/page_collections/_stream.html.erb @@ -11,6 +11,21 @@
    <%= link_to content.name, content %> + + <% if user_signed_in? && current_user == @page_collection.user %> + + more_vert + + + <% end %>
    <% if page.explanation? %>
    diff --git a/app/views/page_collections/show.html.erb b/app/views/page_collections/show.html.erb index 26280773..77c0bbdd 100644 --- a/app/views/page_collections/show.html.erb +++ b/app/views/page_collections/show.html.erb @@ -10,9 +10,14 @@
    <% else %> <%= render partial: 'page_collections/sort_bar' %> + <% if !!@show_contributor_highlight %> +
    + Showing all submitted pages from <%= link_to @highlighted_contributor.display_name, @highlighted_contributor, class: "#{User.color}-text" %>. + Click <%= link_to 'here', @page_collection, class: 'blue-text text-lighten-3' %> to see all pages regardless of author. +
    + <% end %> + <%= render partial: 'page_collections/stream', locals: { pages: @pages } %> <% end %> - - <%= render partial: 'page_collections/stream', locals: { pages: @pages } %>
    <%= render partial: 'page_collections/sidebar' %> diff --git a/app/views/share_comments/_form.html.erb b/app/views/share_comments/_form.html.erb index bdadf8b8..753b0522 100644 --- a/app/views/share_comments/_form.html.erb +++ b/app/views/share_comments/_form.html.erb @@ -1,8 +1,8 @@ <%= form_for ShareComment.new do |f| %>
    - <%= f.label :message, 'Leave a message' %> <%= f.hidden_field :content_page_share_id, value: share.id %> - <%= f.text_area :message, class: 'materialize-textarea' %> + <%= f.label 'Leave a message', for: "share_comment_#{share.id}" %> + <%= f.text_area :message, id: "share_comment_#{share.id}", class: 'materialize-textarea js-can-mention-pages' %> <%= f.submit 'Comment', class: 'btn right green white-text submit-button' %>
    <% end %> \ No newline at end of file diff --git a/app/views/share_comments/_show.html.erb b/app/views/share_comments/_show.html.erb index a4666022..ef7d94a4 100644 --- a/app/views/share_comments/_show.html.erb +++ b/app/views/share_comments/_show.html.erb @@ -7,7 +7,10 @@ <% end %> <%# Nesting from above %> - <%= simple_format comment.message, class: 'black-text' %> + <%= simple_format ContentFormatterService.show( + text: comment.message, + viewing_user: current_user + ), class: 'black-text' %>
    -<% end %> \ No newline at end of file +<% end %> + +<%= render partial: 'javascripts/content_linking' %> \ No newline at end of file diff --git a/app/views/subscriptions/new.html.erb b/app/views/subscriptions/new.html.erb index 47416d35..459c4150 100644 --- a/app/views/subscriptions/new.html.erb +++ b/app/views/subscriptions/new.html.erb @@ -239,8 +239,7 @@
    -
    -
    +
    @@ -309,7 +308,7 @@

      <% current_user.page_unlock_promo_codes.where('uses_remaining > 0').each do |code| %> -
    • <%= code.code %> (<%= code.description %>)
    • +
    • <%= code.code %> (<%= code.description %>)
    • <% end %>
    <% end %> @@ -363,31 +362,6 @@
    -
    -
    -
    -
    -
    - Upload Bandwidth -
    - <%= (current_user.upload_bandwidth_kb) > 0 ? Filesize.from("#{current_user.upload_bandwidth_kb}KB").pretty : '-' + Filesize.from("#{current_user.upload_bandwidth_kb.abs}KB").pretty %> remaining -
    -
    -

    - You have <%= (current_user.upload_bandwidth_kb) > 0 ? Filesize.from("#{current_user.upload_bandwidth_kb}KB").pretty : '-' + Filesize.from("#{current_user.upload_bandwidth_kb.abs}KB").pretty %> of bandwidth remaining. -

    -

    - This bandwidth can be used to upload images to your content anywhere on the site. Deleting an uploaded image frees - up the same amount of bandwidth. - <% unless on_premium_plan %> - To get more bandwidth, upgrade to our Premium plan. - <% end %> -

    -
    -
    -
    -
    -
    All prices are in US Dollars. Making payments using another currency will automatically exchange into US Dollars at the current exchange rates.
    \ No newline at end of file diff --git a/app/views/subscriptions/prepay.html.erb b/app/views/subscriptions/prepay.html.erb index 387ed79a..2c2b9058 100644 --- a/app/views/subscriptions/prepay.html.erb +++ b/app/views/subscriptions/prepay.html.erb @@ -60,7 +60,7 @@
    <%= link_to prepay_paypal_gateway_path(months: 3), class: 'black-text' do %> -
    +
    star @@ -77,7 +77,7 @@
    <%= link_to prepay_paypal_gateway_path(months: 6), class: 'black-text' do %> -
    +
    star @@ -126,7 +126,7 @@

    <% if current_user.on_premium_plan? && @invoices.any? %> -
    +
    Since you already have Premium features active, you won't be able to activate any codes on this account yet.
    Activation links will appear again whenever you don't have Premium active.
    diff --git a/app/views/users/profile/_info.html.erb b/app/views/users/profile/_info.html.erb index 6b0906f8..6f852a8d 100644 --- a/app/views/users/profile/_info.html.erb +++ b/app/views/users/profile/_info.html.erb @@ -51,7 +51,7 @@
    Username
    -
    +
    <%= link_to "@#{@user.username}", profile_by_username_path(username: @user.username) %>

    @@ -61,7 +61,7 @@
    Also known as
    -
    +
    <%= @user.other_names %>

    @@ -76,7 +76,7 @@
    Website
    -
    +
    <%= link_to @user.website, @user.website, target: '_new', data: { confirm: "You are about to visit an external website not owned by Notebook.ai. Please only continue if you trust this user." }, ref: 'nofollow' %>

    @@ -111,7 +111,7 @@
    Bio
    -
    +
    <%= simple_format truncate(@user.bio, length: 500) %>
    @@ -126,7 +126,7 @@
    <%= field.titleize %>
    -
    +
    <%= simple_format @user.send(field) %>
    diff --git a/config/routes.rb b/config/routes.rb index 588ba229..20ae46f9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,6 +16,8 @@ Rails.application.routes.draw do get 'follow', on: :member get 'unfollow', on: :member get 'report', on: :member + + get 'by/:user_id', to: 'page_collections#by_user', as: :submissions_by_user end resources :page_collection_submissions do get 'approve', on: :member @@ -92,12 +94,13 @@ Rails.application.routes.draw do # Legacy route: left intact so /my/documents/X URLs continue to work for everyone's bookmarks resources :documents + get '/referrals', to: 'data#referrals', as: :referrals + # Billing scope '/billing' do #get '/', to: 'subscriptions#show', as: :billing get '/subscription', to: 'subscriptions#new', as: :subscription get '/history', to: 'subscriptions#history', as: :billing_history - get '/referrals', to: 'subscriptions#referrals', as: :referrals get '/to/:stripe_plan_id', to: 'subscriptions#change', as: :change_subscription diff --git a/db/migrate/20200829011900_add_paranoid_fields_to_recent_models.rb b/db/migrate/20200829011900_add_paranoid_fields_to_recent_models.rb new file mode 100644 index 00000000..5adc0c03 --- /dev/null +++ b/db/migrate/20200829011900_add_paranoid_fields_to_recent_models.rb @@ -0,0 +1,8 @@ +class AddParanoidFieldsToRecentModels < ActiveRecord::Migration[6.0] + def change + add_column :page_collections, :deleted_at, :datetime + add_column :page_collection_submissions, :deleted_at, :datetime + add_column :paypal_invoices, :deleted_at, :datetime + add_column :timeline_events, :deleted_at, :datetime + end +end diff --git a/yarn.lock b/yarn.lock index 66f74d3d..e8eb501a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2610,9 +2610,9 @@ bluebird@^3.3.5, bluebird@^3.5.5: integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + version "4.11.9" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" + integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== body-parser@1.19.0: version "1.19.0" @@ -4166,9 +4166,9 @@ element-resize-detector@^1.2.1: batch-processor "1.0.0" elliptic@^6.0.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" - integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== + version "6.5.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -6563,9 +6563,9 @@ lodash.uniq@^4.5.0: integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= lodash@^4.0.0, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.5, lodash@~4.17.10: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + version "4.17.19" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" + integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== loglevel@^1.6.8: version "1.7.0"