Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5775 | Rev 5956 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5775 Rev 5780
Línea 936... Línea 936...
936
                ];
936
                ];
937
                return new JsonModel($response);
937
                return new JsonModel($response);
938
            }
938
            }
Línea 939... Línea 939...
939
            
939
            
940
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
940
            $contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
Línea 941... Línea 941...
941
            $like = $contentReactionMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
941
            $contentReaction = $contentReactionMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
942
            
942
            
943
            if (!$like) {
943
            if (!$contentReaction) {
944
                $response = [
944
                $response = [
945
                    'success' => false,
945
                    'success' => false,
946
                    'data' => 'ERROR_DUPLICATE_ACTION'
946
                    'data' => 'ERROR_DUPLICATE_ACTION'
947
                ];
947
                ];
Línea 948... Línea 948...
948
                return new JsonModel($response);
948
                return new JsonModel($response);
949
            }
949
            }
Línea 950... Línea 950...
950
            
950
            
951
            if ($contentReactionMapper->deleteByFeedIdAndUserId($feed->id, $currentUser->id)) {
951
            if ($contentReactionMapper->deleteByFeedIdAndUserId($feed->id, $currentUser->id)) {
952
                $reactions = $contentReactionMapper->fetchCountContentReactionByFeedId($feed->id);
952
                $reactions = $contentReactionMapper->fetchCountContentReactionsByFeedId($feed->id);
Línea 1004... Línea 1004...
1004
                    'data' => 'ERROR_DUPLICATE_ACTION'
1004
                    'data' => 'ERROR_DUPLICATE_ACTION'
1005
                ];
1005
                ];
1006
                return new JsonModel($response);
1006
                return new JsonModel($response);
1007
            }
1007
            }
Línea 1008... Línea 1008...
1008
 
1008
 
1009
            $like = new Like();
1009
            $contentReaction = new Like();
1010
            $like->user_id = $currentUser->id;
1010
            $contentReaction->user_id = $currentUser->id;
1011
            $like->feed_id = $feed->id;
1011
            $contentReaction->feed_id = $feed->id;
Línea 1012... Línea 1012...
1012
            $like->relational = Like::RELATIONAL_FEED;
1012
            $contentReaction->relational = Like::RELATIONAL_FEED;
Línea 1013... Línea 1013...
1013
 
1013
 
Línea 1014... Línea 1014...
1014
            if ($likeMapper->insert($like)) {
1014
            if ($contentReactionMapper->insert($contentReaction)) {
Línea 1068... Línea 1068...
1068
 
1068
 
1069
 
1069
 
1070
                $response = [
1070
                $response = [
1071
                    'success' => true,
1071
                    'success' => true,
1072
                    'data' => [
1072
                    'data' => [
1073
                        'likes' => $likes
1073
                        'likes' => $contentReactions
1074
                    ]
1074
                    ]
1075
                ];
1075
                ];
1076
            } else {
1076
            } else {
1077
                $response = [
1077
                $response = [
1078
                    'success' => false,
1078
                    'success' => false,
1079
                    'data' => $likeMapper->getError()
1079
                    'data' => $contentReactionMapper->getError()
1080
                ];
1080
                ];
1081
            }
1081
            }
Línea 1106... Línea 1106...
1106
                    'data' => 'ERROR_POST_NOT_FOUND'
1106
                    'data' => 'ERROR_POST_NOT_FOUND'
1107
                ];
1107
                ];
1108
                return new JsonModel($response);
1108
                return new JsonModel($response);
1109
            }
1109
            }
Línea 1110... Línea 1110...
1110
 
1110
 
1111
            $likeMapper = LikeMapper::getInstance($this->adapter);
1111
            $contentReactionMapper = LikeMapper::getInstance($this->adapter);
Línea 1112... Línea 1112...
1112
            $like = $likeMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
1112
            $contentReaction = $contentReactionMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
1113
 
1113
 
1114
            if (!$like) {
1114
            if (!$contentReaction) {
1115
                $response = [
1115
                $response = [
1116
                    'success' => false,
1116
                    'success' => false,
1117
                    'data' => 'ERROR_DUPLICATE_ACTION'
1117
                    'data' => 'ERROR_DUPLICATE_ACTION'
1118
                ];
1118
                ];
Línea 1119... Línea 1119...
1119
                return new JsonModel($response);
1119
                return new JsonModel($response);
1120
            }
1120
            }
Línea 1121... Línea 1121...
1121
 
1121
 
1122
            if ($likeMapper->deleteByFeedIdAndUserId($feed->id, $currentUser->id)) {
1122
            if ($contentReactionMapper->deleteByFeedIdAndUserId($feed->id, $currentUser->id)) {
1123
                $likes = $likeMapper->fetchCountLikeByFeedId($feed->id);
1123
                $contentReactions = $contentReactionMapper->fetchCountLikeByFeedId($feed->id);
1124
 
1124
 
1125
 
1125
 
1126
                $response = [
1126
                $response = [
1127
                    'success' => true,
1127
                    'success' => true,
1128
                    'data' => [
1128
                    'data' => [
1129
                        'likes' => $likes
1129
                        'likes' => $contentReactions
1130
                    ]
1130
                    ]
1131
                ];
1131
                ];
1132
            } else {
1132
            } else {
1133
                $response = [
1133
                $response = [
1134
                    'success' => false,
1134
                    'success' => false,
Línea 1452... Línea 1452...
1452
 
1452
 
1453
 
1453
 
1454
 
1454
 
1455
 
1455
 
1456
        /*
1456
        /*
1457
        $likeMapper = LikeMapper::getInstance($this->adapter);
1457
        $contentReactionMapper = LikeMapper::getInstance($this->adapter);
1458
        $like = $likeMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
1458
        $contentReaction = $contentReactionMapper->fetchOneByFeedIdAndUserId($feed->id, $currentUser->id);
1459
        $likes = $likeMapper->fetchCountLikeByFeedId($feed->id);
1459
        $contentReactions = $contentReactionMapper->fetchCountLikeByFeedId($feed->id);
Línea 1545... Línea 1545...
1545
            'feed_increment_external_counter_url' => $share_increment_external_counter_url,
1545
            'feed_increment_external_counter_url' => $share_increment_external_counter_url,
1546
            'feed_delete_url' =>  '',
1546
            'feed_delete_url' =>  '',
1547
            'feed_content_type' => $feed->file_type ? $feed->file_type : '',
1547
            'feed_content_type' => $feed->file_type ? $feed->file_type : '',
1548
            'feed_reactions' =>  $reactions,
1548
            'feed_reactions' =>  $reactions,
1549
            'feed_highlighted' => $feed->id == $feedHighlighted ? 1 : 0,
1549
            'feed_highlighted' => $feed->id == $feedHighlighted ? 1 : 0,
1550
            //'is_liked' => $like ? 1 : 0,
1550
            //'is_liked' => $contentReaction ? 1 : 0,
1551
            //'like_url' => $this->url()->fromRoute('post/like', ['id' => $post->uuid]),
1551
            //'like_url' => $this->url()->fromRoute('post/like', ['id' => $post->uuid]),
1552
            //'unlike_url' => $this->url()->fromRoute('post/unlike', ['id' => $post->uuid]),
1552
            //'unlike_url' => $this->url()->fromRoute('post/unlike', ['id' => $post->uuid]),
Línea 1553... Línea 1553...
1553
 
1553