mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix for >5 tag logic
This commit is contained in:
parent
51ccd367c4
commit
575189656b
2 changed files with 9 additions and 2 deletions
|
@ -353,8 +353,8 @@ class Site < Sequel::Model
|
|||
new_tags.compact!
|
||||
@new_filtered_tags = []
|
||||
|
||||
if new_tags.length > 5
|
||||
error.add :tags, 'Cannot have more than 5 tags.'
|
||||
if ((new? ? 0 : tags_dataset.count) + new_tags.length > 5)
|
||||
errors.add :tags, 'Cannot have more than 5 tags for your site.'
|
||||
end
|
||||
|
||||
new_tags.each do |tag|
|
||||
|
|
|
@ -113,6 +113,13 @@ describe 'signup' do
|
|||
page.must_have_content /Tag.+cannot be more than two words/
|
||||
end
|
||||
|
||||
it 'fails for too many tags' do
|
||||
fill_in_valid
|
||||
fill_in 'tags', with: 'one, two, three, four, five, six'
|
||||
click_button 'Create Home Page'
|
||||
page.must_have_content /Cannot have more than \d tags for your site/
|
||||
end
|
||||
|
||||
it 'succeeds with no tags' do
|
||||
fill_in_valid
|
||||
fill_in 'tags', with: ''
|
||||
|
|
Loading…
Add table
Reference in a new issue