Incorrect operation of the module.

Created on 11 October 2018, over 5 years ago
Updated 25 July 2023, 11 months ago

Drupal 8.6 >
php 7.1
like_dislike/src/Controller/LikeDislikeController.php
line 129

$already_clicked = key_exists($user, array_keys((array) $users));
//Change to
$already_clicked = in_array($user, array_keys((array) $users));

line 139

new HtmlCommand('#like', $entity_data->$field_name->likes)
//Change to
new HtmlCommand('#like', (string) $entity_data->$field_name->likes)

line 151

new HtmlCommand('#dislike', $entity_data->$field_name->dislikes)
//Change to
new HtmlCommand('#dislike', (string) $entity_data->$field_name->dislikes)
🐛 Bug report
Status

Fixed

Version

2.2

Component

Code

Created by

🇧🇾Belarus Anatolii1309

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India heykarthikwithu Bengaluru 🌍

    Thanks you for using the module and noticing the issue.

    Done some major fixes around like & dislikes within 2.2.0 release,
    Have a check if this issue still exist with 2.2.0 version?

    Please check for the module page for the features covered.

  • Assigned to MukhtarM
  • 🇮🇳India MukhtarM

    1. $already_clicked = key_exists($user, array_keys((array) $users));
    This is already handled in #118
    $user_already_clicked = array_key_exists($uid, (array) $already_clicked_users);

    As $already_clicked_users returns an associative array with (uid => liked) format, its key to be checked and thus array_key_exists function used instead of in_array.


    2.new HtmlCommand('#like', (string) $entity_data->$field_name->likes)
    This is handled in #126
$response->addCommand(new HtmlCommand('#like-' . $decode_data->entity_id, (string) $entity_data->$field_name->likes));

    3. new HtmlCommand('#dislike', (string) $entity_data->$field_name->dislikes)
    This is handled in #152
    $response->addCommand(new HtmlCommand('#dislike-' . $decode_data->entity_id, (string) $entity_data->$field_name->dislikes));

    2 & 3 are type conversions which is handled.

    All the changes are in the file like_dislike/src/Controller/LikeDislikeController.php

    Above all changes are available in the 2.3.0 version

  • Issue was unassigned.
  • Status changed to Fixed 11 months ago
  • 🇮🇳India heykarthikwithu Bengaluru 🌍

    Thank you all :)

    Note: Use the latest version of the module & Please check for the module page for the features covered.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024