Commit 9f6cc7cf authored by Dennis Schubert's avatar Dennis Schubert
Browse files

Merge pull request #6683 from svbergerem/fix-mobile-500-like

Fix 500 for mobile like without javascript
parents 73ab7e25 9cc40af6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ Contributions are very welcome, the hard work is done!
* Add navbar on mobile when not logged in [#6483](https://github.com/diaspora/diaspora/pull/6483)
* Fix timeago tooltips for reshares [#6648](https://github.com/diaspora/diaspora/pull/6648)
* "Getting started" is now turned off after first visit on mobile [#6681](https://github.com/diaspora/diaspora/pull/6681)
* Fixed a 500 when liking on mobile without JS enabled [#6683](https://github.com/diaspora/diaspora/pull/6683)

## Features
* Support color themes [#6033](https://github.com/diaspora/diaspora/pull/6033)
+5 −5
Original line number Diff line number Diff line
@@ -63,18 +63,18 @@ $(document).ready(function(){
    evt.preventDefault();
    var link = $(this),
        likeCounter = $(this).closest(".stream_element").find(".like-count"),
        href = link.attr("href");
        url = link.data("url");

    if(!link.hasClass("loading")){
      if(link.hasClass('inactive')) {
        $.ajax({
          url: href,
          url: url,
          dataType: 'json',
          type: 'POST',
          beforeSend: showLoader(link),
          success: function(data){
            removeLoader(link);
            link.attr("href", href + "/" + data["id"]);
            link.data("url", url + "/" + data.id);

            if(likeCounter){
              likeCounter.text(parseInt(likeCounter.text(), 10) + 1);
@@ -84,13 +84,13 @@ $(document).ready(function(){
      }
      else if(link.hasClass("active")){
        $.ajax({
          url: link.attr("href"),
          url: url,
          dataType: 'json',
          type: 'DELETE',
          beforeSend: showLoader(link),
          complete: function(){
            removeLoader(link);
            link.attr("href", href.replace(/\/\d+$/, ''));
            link.data("url", url.replace(/\/\d+$/, ""));

            if(likeCounter){
              likeCounter.text(parseInt(likeCounter.text(), 10) - 1);
+8 −2
Original line number Diff line number Diff line
@@ -20,9 +20,15 @@ module MobileHelper

  def mobile_like_icon(post)
    if current_user && current_user.liked?(post)
      link_to "", post_like_path(post.id, current_user.like_for(post).id), class: "entypo-heart like-action active"
      link_to "",
              "#",
              data:  {url: post_like_path(post.id, current_user.like_for(post).id)},
              class: "entypo-heart like-action active"
    else
      link_to "", post_likes_path(post.id), class: "entypo-heart like-action inactive"
      link_to "",
              "#",
              data:  {url: post_likes_path(post.id)},
              class: "entypo-heart like-action inactive"
    end
  end