Línea 140... |
Línea 140... |
140 |
//$contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
|
140 |
//$contentReaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
|
Línea 141... |
Línea 141... |
141 |
|
141 |
|
142 |
$contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
|
142 |
$contentReactionMapper = ContentReactionMapper::getInstance($this->adapter);
|
143 |
$reactions = $contentReactionMapper->fetchCountByPostId($post->id);
|
143 |
$reactions = $contentReactionMapper->fetchCountByPostId($post->id);
|
- |
|
144 |
$reaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
|
- |
|
145 |
|
- |
|
146 |
$type = '';
|
- |
|
147 |
if($post->file) {
|
- |
|
148 |
$filename = basename($post->file);
|
- |
|
149 |
$parts = explode(',', $filename);
|
- |
|
150 |
if(count($parts > 1)) {
|
- |
|
151 |
$extension = $parts[ count($parts) -1 ];
|
- |
|
152 |
if(in_array($extension, ['mov', 'webm','mp4','mpeg'] )) {
|
- |
|
153 |
$type = 'video';
|
- |
|
154 |
} else if(in_array($extension, ['jpg','jpeg','png'] )) {
|
- |
|
155 |
$type = 'image';
|
- |
|
156 |
} else if(in_array($extension, ['wav', 'mp3', 'pdf'] )) {
|
- |
|
157 |
$type = 'audio';
|
- |
|
158 |
}
|
Línea -... |
Línea 159... |
- |
|
159 |
}
|
- |
|
160 |
|
- |
|
161 |
}
|
- |
|
162 |
|
- |
|
163 |
|
Línea 144... |
Línea 164... |
144 |
$reaction = $contentReactionMapper->fetchOneByPostIdAndUserId($post->id, $currentUser->id);
|
164 |
|
145 |
|
165 |
|
146 |
|
166 |
|
147 |
return new JsonModel([
|
167 |
return new JsonModel([
|
Línea 152... |
Línea 172... |
152 |
'uuid' => $post->uuid,
|
172 |
'uuid' => $post->uuid,
|
153 |
'title' => $post->title,
|
173 |
'title' => $post->title,
|
154 |
'description' => $post->description,
|
174 |
'description' => $post->description,
|
155 |
'url' => $post->url,
|
175 |
'url' => $post->url,
|
156 |
'date' => $post->date,
|
176 |
'date' => $post->date,
|
- |
|
177 |
'type' => $post->type,
|
157 |
'status' => $post->status,
|
178 |
'status' => $post->status,
|
158 |
'image' => $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->image], ['force_canonical' => true]),
|
179 |
'image' => $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->image], ['force_canonical' => true]),
|
159 |
'file' => $post->file ? $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->file], ['force_canonical' => true]) : '',
|
180 |
'file' => $post->file ? $this->url()->fromRoute('storage',['type' => 'post', 'code' => $post->uuid, 'filename' => $post->file], ['force_canonical' => true]) : '',
|
- |
|
181 |
'type' => $type,
|
160 |
'added_on' => $post->added_on,
|
182 |
'added_on' => $post->added_on,
|
161 |
'share_external_url' => $share_external_url,
|
183 |
'share_external_url' => $share_external_url,
|
162 |
'total_share_external' => $post->total_external_shared,
|
184 |
'total_share_external' => $post->total_external_shared,
|
163 |
'share_increment_external_counter_url' => $share_increment_external_counter_url,
|
185 |
'share_increment_external_counter_url' => $share_increment_external_counter_url,
|
164 |
'comments_url' => $this->url()->fromRoute('post/comments', ['id' => $post->uuid]),
|
186 |
'comments_url' => $this->url()->fromRoute('post/comments', ['id' => $post->uuid]),
|