Skip to content

Commit

Permalink
feat(drupal): update project to 1.3.5 version
Browse files Browse the repository at this point in the history
  • Loading branch information
acattaneoacn committed Nov 2, 2022
1 parent 55c9670 commit be8702f
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 24 deletions.
2 changes: 1 addition & 1 deletion drupal/config/sync/search_api.index.default_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ processor_settings:
spaces: ''
ignored: ._-
overlap_cjk: 1
minimum_word_size: '3'
minimum_word_size: '2'
tracker_settings:
default:
indexing_order: fifo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ public static function replyCreate($nodeId, $commentId, $userId, $commentBody):
}

$parentComment = Comment::load($commentId);
NotificationsController::sendNotification(
$node,
$comment->getOwnerId(),
$parentComment->getOwnerId(),
'comment_reply'
);
if($comment->getOwnerId()!=$parentComment->getOwnerId()){
NotificationsController::sendNotification(
$node,
$comment->getOwnerId(),
$parentComment->getOwnerId(),
'comment_reply'
);
}

$node = Node::load($nodeId);
if (empty($node)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public function post(Request $req)
ValidationController::validateRequestBody($body, self::JSON_SCHEMA);

$externalLink = $body->external_link;
if (!preg_match('~^(?:f|ht)tps?://~i', $externalLink)) {
if (!preg_match('~^(?:f|ht)tps?://~i', $externalLink) && !empty($externalLink)) {
$externalLink = 'https://' . $externalLink;
}

if (!UrlHelper::isValid($externalLink, true)) {
if (!UrlHelper::isValid($externalLink, true) && !empty($externalLink)) {
throw new Exception('DCRA03: External link not valid', 400);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ public function post(Request $req, $id = null)
ValidationController::validateRequestBody($body, self::JSON_SCHEMA);

$externalLink = $body->external_link;
if (!preg_match('~^(?:f|ht)tps?://~i', $externalLink)) {
if (!preg_match('~^(?:f|ht)tps?://~i', $externalLink) && !empty($externalLink)) {
$externalLink = 'https://' . $externalLink;
}

if (!UrlHelper::isValid($externalLink, true)) {
if (!UrlHelper::isValid($externalLink, true) && !empty($externalLink)) {
throw new Exception('DIURA07: External link not valid', 400);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function post(Request $req, $id = null)

ItemController::delete(
$userId,
$id,
$node,
$body->reason
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\rest_api\Plugin\views\style;

use Drupal\Component\Serialization\Json;
use Drupal\rest\Plugin\views\style\Serializer;

/**
Expand All @@ -26,17 +25,29 @@ class CustomSerializer extends Serializer
public function rowNormalize($row)
{
$items = [];

foreach ($row as $key => $value) {
if (!empty($value) && Json::decode($value)) {
$items[$key] = json_decode($value, true);
} elseif ($value === '[]') {
$value = (string)$value;
if ($value === '[]') {
$items[$key] = [];
} elseif ((string)$value === '0') {
} elseif ($value === '0') {
$items[$key] = 0;
} elseif (!empty($value) && json_decode($value, true)) {
$items[$key] = json_decode($value, true);
} else {
$items[$key] = html_entity_decode($value);
}

if (in_array($key,
['title',
'body',
'name',
'description',
'type',
'intervention',
'program_label',
'category_label'])) {
$items[$key] = (string)$items[$key];
}
}

return $items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Drupal\rest_api\Plugin\views\style;

use Drupal\Component\Serialization\Json;
use Drupal\rest\Plugin\views\style\Serializer;

/**
Expand All @@ -26,17 +25,29 @@ class NestingSerializer extends Serializer
public function rowNormalize($row)
{
$items = [];

foreach ($row as $key => $value) {
if (!empty($value) && Json::decode($value)) {
$items[$key] = json_decode($value, true);
} elseif ($value === '[]') {
$value = (string)$value;
if ($value === '[]') {
$items[$key] = [];
} elseif ((string)$value === '0') {
} elseif ($value === '0') {
$items[$key] = 0;
} elseif (!empty($value) && json_decode($value, true)) {
$items[$key] = json_decode($value, true);
} else {
$items[$key] = html_entity_decode($value);
}

if (in_array($key,
['title',
'body',
'name',
'description',
'type',
'intervention',
'program_label',
'category_label'])) {
$items[$key] = (string)$items[$key];
}
}

return $items;
Expand Down

0 comments on commit be8702f

Please sign in to comment.