[Git][noosfero/noosfero][master] Fixes unfollowing profile to use POST request

Larissa Reis gitlab at mg.gitlab.com
Mon Jul 18 15:05:41 BRT 2016


Larissa Reis pushed to branch master at Noosfero / noosfero


Commits:
d0cc3c8a by Larissa Reis at 2016-07-18T15:04:14-03:00
Fixes unfollowing profile to use POST request

- - - - -


3 changed files:

- app/views/blocks/profile_info_actions/_common.html.erb
- app/views/followers/_profile_list.html.erb
- features/follow_profile.feature


Changes:

=====================================
app/views/blocks/profile_info_actions/_common.html.erb
=====================================
--- a/app/views/blocks/profile_info_actions/_common.html.erb
+++ b/app/views/blocks/profile_info_actions/_common.html.erb
@@ -1,11 +1,11 @@
 <li><%= report_abuse(profile, :button) %></li>
-<%if logged_in? && (user != profile) && profile.allow_followers?%>
-<li>
-  <% follow = user.follows?(profile) %>
-    <%= button(:unfollow, content_tag('span', _('Unfollow')), {:profile => profile.identifier, :controller => 'profile', :action => 'unfollow'}, :id => 'action-unfollow', :title => _("Unfollow"), :style => follow ? "" : "display: none;") %>
+<% if logged_in? && (user != profile) && profile.allow_followers? %>
+  <li>
+    <% follow = user.follows?(profile) %>
+    <%= button(:unfollow, content_tag('span', _('Unfollow')), {:profile => profile.identifier, :controller => 'profile', :action => 'unfollow'}, :method => :post, :id => 'action-unfollow', :title => _("Unfollow"), :style => follow ? "" : "display: none;") %>
     <%= button(:ok, content_tag('span', _('Follow')), {:profile => profile.identifier, :controller => 'profile', :action => 'find_profile_circles'}, :id => 'action-follow', :title => _("Follow"), :style => follow ? "display: none;" : "") %>
     <div id="circles-container" style="display: none;">
     </div>
-</li>
-<%end%>
+  </li>
+<% end %>
 <%= render_environment_features(:profile_actions) %>


=====================================
app/views/followers/_profile_list.html.erb
=====================================
--- a/app/views/followers/_profile_list.html.erb
+++ b/app/views/followers/_profile_list.html.erb
@@ -7,7 +7,7 @@
       <%= button_without_text :remove, content_tag('span',_('unfollow')),
         { :controller => "profile", :profile => followed_profile.identifier, :follower_id => profile.id,
           :action => 'unfollow', :redirect_to => url_for({:controller => "followers", :profile => profile.identifier}) },
-          :title => _('remove') %>
+          :method => :post, :title => _('remove') %>
       <%= modal_icon_button :edit, _('change category'),
              url_for(:controller => 'followers', :action => 'set_category_modal',
                      :followed_profile_id => followed_profile.id) %>


=====================================
features/follow_profile.feature
=====================================
--- a/features/follow_profile.feature
+++ b/features/follow_profile.feature
@@ -110,6 +110,5 @@ Feature: follow profile
     And I am logged in as "johnsnow"
     When I go to nightswatch's homepage
     When I follow "Unfollow"
-    And I wait 1 second
     Then "johnsnow" should not be a follower of "nightswatch"
 



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/d0cc3c8aa04e050891e550169fae9dce0d4ed876
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160718/32836097/attachment-0001.html>


More information about the Noosfero-dev mailing list