From 98b8f924d705bb305d2f8a1774f3cbdc35a6a851 Mon Sep 17 00:00:00 2001 From: Simona Stefan Date: Fri, 17 Jan 2020 17:49:35 +0200 Subject: [PATCH 01/10] Remove double tag node association causing warnings (#6268) --- app/models/tag.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/models/tag.rb b/app/models/tag.rb index 634c88f215..a291dece45 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -7,16 +7,6 @@ class Tag < ApplicationRecord has_many :node_tag, foreign_key: 'tid' # we're not really using the filter_by_type stuff here: - has_many :node, through: :drupal_node_tag do - def filter_by_type(type, limit = 10) - where(status: 1, type: type) - .limit(limit) - .order('created DESC') - end - end - - # the following probably never gets used; tag.node will use the above definition. - # also, we're not really using the filter_by_type stuff here: has_many :node, through: :node_tag do def filter_by_type(type, limit = 10) where(status: 1, type: type) From 1bd9aac3f4f2015170bc04e1151138cbe846dfef Mon Sep 17 00:00:00 2001 From: Vladimir Mikulic <35997844+VladimirMikulic@users.noreply.github.com> Date: Fri, 17 Jan 2020 10:50:12 -0500 Subject: [PATCH 02/10] REFACTOR: post_test.rb [Travis optimization] (#7275) The most important improvement is the removal of assert_page_reloads statement. This block of code never executed and just delayed Travis for ~1min every build. The second improvement is the addition of the "setup" function. Instead of writing login logic in every test, now before every test the "setup" function will run and log in the user. Part of #7272 --- test/system/post_test.rb | 52 +++++++++------------------------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/test/system/post_test.rb b/test/system/post_test.rb index 1b1bd0914b..3a8ff11a62 100644 --- a/test/system/post_test.rb +++ b/test/system/post_test.rb @@ -5,14 +5,17 @@ class PostTest < ApplicationSystemTestCase include ActiveJob::TestHelper Capybara.default_max_wait_time = 60 - test 'posting from the editor' do + def setup visit '/' - click_on 'Login' - fill_in("username-login", with: "Bob") + find(".nav-link.loginToggle").click() + fill_in("username-login", with: "jeff") fill_in("password-signup", with: "secretive") - click_on "Log in" + find(".login-modal-form #login-button").click() + end + + test 'posting from the editor' do visit '/post' fill_in("title-input", with: "My new post") @@ -20,27 +23,17 @@ class PostTest < ApplicationSystemTestCase el = find(".wk-wysiwyg") # rich text input el.set("All about this interesting stuff") - assert_page_reloads do - find('.ple-publish').click - assert_selector('h1', text: "My new post") - assert_selector('#content', text: "All about this interesting stuff") - assert_selector('.alert-success', text: "×\nSuccess! Thank you for contributing open research, and thanks for your patience while your post is approved by community moderators and we'll email you when it is published. In the meantime, if you have more to contribute, feel free to do so.") - - end + find('.ple-publish').click() + assert_selector('h1', text: "My new post") + assert_selector('#content', text: "All about this interesting stuff") + assert_selector('.alert-success', text: "×\nResearch note published. Get the word out on the discussion lists!") end test 'adding tags to the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - find(".login-modal-form #login-button").click() - find('a#tags-open').click() find('.tag-input').set('nature').native.send_keys(:return) @@ -53,13 +46,6 @@ class PostTest < ApplicationSystemTestCase test 'removing tags from the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - find(".login-modal-form #login-button").click() - find('a#tags-open').click() find('.tag-input').set('nature').native.send_keys(:return) @@ -75,13 +61,6 @@ class PostTest < ApplicationSystemTestCase test 'like button on the post' do visit '/wiki/wiki-page-path/comments' - find('a[data-target="#loginModal"]', text: 'Login').click() - - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - - click_on 'Log in' - like_button = find('.btn-like').click(); # Make sure that star is toggled @@ -109,11 +88,7 @@ def assert_page_does_not_reload(message = "page should not reload") test "edit wiki" do visit '/wiki/wiki-page-path/' - click_on "Login" - fill_in 'user_session[username]', with: 'jeff' - fill_in 'user_session[password]', with: 'secretive' - click_on "Log in" find('a.btn-circle:first-of-type .fa-pencil').click() fill_in("body", with: "Test for editing wikis!") @@ -131,11 +106,6 @@ def assert_page_does_not_reload(message = "page should not reload") Capybara.ignore_hidden_elements = false visit '/wiki/new' - find('.login-page-form #username-login').set('jeff') - find('.login-page-form #password-signup').set('secretive') - - find('.login-page-form #login-button').click() - # Upload the image drop_in_dropzone("#{Rails.root.to_s}/public/images/pl.png") From 9a5ffcd2d0bbee749b5c25e0c14dd7f669cb6037 Mon Sep 17 00:00:00 2001 From: Suyash Choudhary <57896905+sssash18@users.noreply.github.com> Date: Fri, 17 Jan 2020 22:28:29 +0530 Subject: [PATCH 03/10] Test for spamaway (#7276) * Added 'spamaway_textarea blank error' test * Added empty line between the test * Added 'do' --- test/integration/signup_flow_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/integration/signup_flow_test.rb b/test/integration/signup_flow_test.rb index eaa97b9e3b..deaad82f78 100644 --- a/test/integration/signup_flow_test.rb +++ b/test/integration/signup_flow_test.rb @@ -80,6 +80,26 @@ def setup assert response.body.include? 'errors prohibited this user from being saved' assert response.body.include? 'Email should look like an email address.' end + + test 'spamaway text area not blank error message' do + post '/register', params: { + user: { + username: "newuser", + email: @new_user[:email], + password: @new_user[:password], + password_confirmation: @new_user[:password] + }, + spamaway: { + statement1: @spamaway[:statement1], + statement2: @spamaway[:statement2], + statement3: @spamaway[:statement3], + statement4: @spamaway[:statement4], + follow_instructions: "Not_Blank" + } + } + assert response.body.include? '1 error prohibited this user from being saved' + assert response.body.include? 'Spam detection Please read the instructions in the last box carefully.' + end private From 4e8ce69e8a880e5079b818a4027750182cfaf099 Mon Sep 17 00:00:00 2001 From: nicoleiocana <44947175+nicoleiocana@users.noreply.github.com> Date: Fri, 17 Jan 2020 08:59:32 -0800 Subject: [PATCH 04/10] Fix 'Posting from tag pages not tagging properly #6592' (#7278) --- app/views/tag/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/tag/show.html.erb b/app/views/tag/show.html.erb index c38b1c5115..b6ad38eff3 100644 --- a/app/views/tag/show.html.erb +++ b/app/views/tag/show.html.erb @@ -25,7 +25,7 @@
<% if current_user && current_user.following(params[:id]) %> - New post + New post <% else %> Follow <% if @related_tags %> From 834fa15566ca811fb3ab45441655db12460885ef Mon Sep 17 00:00:00 2001 From: Ajit Mujumdar <38528640+imajit@users.noreply.github.com> Date: Fri, 17 Jan 2020 23:28:51 +0530 Subject: [PATCH 05/10] Fixes #7263 At location button to dashboard sidebar (#7265) * Fixes #7263 At location button to dashboard sidebar * Fixes #7263 At location button to dashboard sidebar * Trying new code to fix issue --- app/views/sidebar/_dashboard.html.erb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/sidebar/_dashboard.html.erb b/app/views/sidebar/_dashboard.html.erb index 69bca8c0d8..0252f2c010 100644 --- a/app/views/sidebar/_dashboard.html.erb +++ b/app/views/sidebar/_dashboard.html.erb @@ -16,8 +16,17 @@
+ +<% if current_user %> +
+ Add your location +

+ Add your location to see work near you
+ About location privacy » +

+
+<% end %> -