• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 9d368f39-3678-4b19-aecb-3a247a203167

pending completion
9d368f39-3678-4b19-aecb-3a247a203167

Pull #3363

circleci

Jane Sandberg
Don't allow more than 1000 bookmarks
Pull Request #3363: I2889 bookmark limit v2

28 of 32 new or added lines in 2 files covered. (87.5%)

5283 of 5592 relevant lines covered (94.47%)

1494.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/app/models/bookmark.rb
1
# frozen_string_literal: true
2

3
class Bookmark < ApplicationRecord
3✔
4
  belongs_to :user, polymorphic: true
3✔
5
  belongs_to :document, polymorphic: true
3✔
6
  validate :not_too_many_bookmarks, on: :create
3✔
7

8
  def document
3✔
NEW
9
    document_type.new document_type.unique_key => document_id
×
10
  end
11

12
  def document_type
3✔
13
    value = super if defined?(super)
3✔
14
    value &&= value.constantize
3✔
15
    value || default_document_type
3✔
16
  end
17

18
  def default_document_type
3✔
NEW
19
    SolrDocument
×
20
  end
21

22
  def not_too_many_bookmarks
3✔
23
    return if user.bookmarks.count < Orangelight.config['bookmarks']['maximum']
166✔
24

25
    errors.add(:user, "You have exceeded the maximum number of bookmarks! You can only save up to #{Orangelight.config['bookmarks']['maximum']} bookmarks")
3✔
26
  end
27
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc