diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 6d33b9d7fd..b93cbfbba4 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,6 +1,5 @@ <% if @user == current_user && @user.preference.try(:first_login) %> - -
+

<%= t(".login_banner.welcome_html", new_user_tips_link: link_to_modal(t(".login_banner.new_user_tips"), for: help_first_login_path, title: t(".login_banner.help_title")), diff --git a/features/tags_and_wrangling/favorite_tags.feature b/features/tags_and_wrangling/favorite_tags.feature index 49267341eb..9337f0908a 100644 --- a/features/tags_and_wrangling/favorite_tags.feature +++ b/features/tags_and_wrangling/favorite_tags.feature @@ -37,3 +37,18 @@ Feature: Favorite Tags When the tag "Rebecca Sutter" is decanonized And I go to the homepage Then I should not see "Rebecca Sutter" + + @javascript + Scenario: Favoriting a tag only shows one AJAX notice when another flash is already present + Given a canonical fandom "Dallas (TV 2012)" + And the user "bourbon" exists and is activated + And I am a visitor + When I view the "Dallas (TV 2012)" works index + And I follow "Log In" within "#header" + And I fill in "Username or email:" with "bourbon" within "#login" + And I fill in "Password:" with "password" within "#login" + And I press "Log In" within "#login" + Then I should see "Successfully logged in" + And I should see a "Favorite Tag" button + When I press "Favorite Tag" + Then I should see "You have successfully added Dallas (TV 2012) to your favorite tags." exactly 1 time diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 6962ec7f56..82f28197fe 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -461,6 +461,8 @@ $j(document).ready(function() { // data-destroy-value: text of button for destroying, e.g. Unfavorite, Unsubscribe // controller needs item_id and item_success_message for save success and // item_success_message for destroy success +// Limit AJAX flash messages to #main > .flash so they don't get duplicated +// when other flash-like banners are present $j(document).ready(function() { $j('form.ajax-create-destroy').on("click", function(event) { event.preventDefault(); @@ -470,7 +472,10 @@ $j(document).ready(function() { var formSubmit = form.find('[type="submit"]'); var createValue = form.data('create-value'); var destroyValue = form.data('destroy-value'); - var flashContainer = $j('.flash'); + var flashContainer = $j('#main > .flash').first(); + if (flashContainer.length === 0) { + return; + } $j.ajax({ type: 'POST',