Commit 1a77601e authored by Brian Hatchet's avatar Brian Hatchet :speech_balloon:

Revert "Revert "Merge remote-tracking branch 'origin/master' into...

Revert "Revert "Merge remote-tracking branch 'origin/master' into fix/nsfw-attachment-propegation-1443""

This reverts commit f92bb0b9.
1 merge request!298[Sprint/LuckyLizard](fix): Moved nsfw entity/attachment propegation so it executes.
Pipeline #78668033 pending with stages
......@@ -35,6 +35,12 @@ test:
script:
- bin/phpspec run
lint:
stage: test
image: minds/php-tests:latest
script:
- bin/php-cs-fixer fix --allow-risky=yes --verbose --dry-run
prepare:fpm:
stage: prepare
image: minds/ci:latest
......@@ -42,12 +48,12 @@ prepare:fpm:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- |
docker build \
-t $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF \
-t $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID \
-f containers/php-fpm/Dockerfile \
--build-arg MINDS_VERSION=$CI_BUILD_REF \
--build-arg MINDS_VERSION=$CI_PIPELINE_ID \
--build-arg SENTRY_DSN=$SENTRY_DSN \
.
- docker push $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
- docker push $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID
prepare:runners:
stage: prepare
......@@ -56,22 +62,22 @@ prepare:runners:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- |
docker build \
-t $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF \
-t $CI_REGISTRY_IMAGE/runners:$CI_PIPELINE_ID \
-f containers/php-runners/Dockerfile \
--build-arg MINDS_VERSION=$CI_BUILD_REF \
--build-arg MINDS_VERSION=$CI_PIPELINE_ID \
--build-arg SENTRY_DSN=$SENTRY_DSN \
.
- docker push $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF
- docker push $CI_REGISTRY_IMAGE/runners:$CI_PIPELINE_ID
prepare:all:sentry:
stage: prepare
image: getsentry/sentry-cli
script:
- echo "Create a new release $CI_COMMIT_SHA"
- sentry-cli releases new $CI_COMMIT_SHA
- sentry-cli releases set-commits --auto $CI_COMMIT_SHA
- sentry-cli releases finalize $CI_COMMIT_SHA
- echo "Finalized release for $CI_COMMIT_SHA"
- echo "Create a new release $CI_PIPELINE_ID"
- sentry-cli releases new $CI_PIPELINE_ID
- sentry-cli releases set-commits --auto $CI_PIPELINE_ID
- sentry-cli releases finalize $CI_PIPELINE_ID
- echo "Finalized release for $CI_PIPELINE_ID"
review:start:
stage: review
......@@ -79,19 +85,21 @@ review:start:
script:
- aws eks update-kubeconfig --name=sandbox
- git clone --branch=sandbox-wip https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/minds/helm-charts.git
- echo "Upgrading helm for pipeline ${CI_PIPELINE_ID}"
- echo "Setting to image ${CI_REGISTRY_IMAGE}"
- "helm upgrade \
--install \
--reuse-values \
--set phpfpm.image.repository=$CI_REGISTRY_IMAGE/fpm \
--set phpfpm.image.tag=$CI_BUILD_REF \
--set-string phpfpm.image.tag=$CI_PIPELINE_ID \
--set runners.image.repository=$CI_REGISTRY_IMAGE/runners \
--set runners.image.tag=$CI_BUILD_REF \
--set-string runners.image.tag=$CI_PIPELINE_ID \
--set domain=$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN \
--set elasticsearch.clusterName=$CI_BUILD_REF_SLUG-elasticsearch \
--wait \
$CI_BUILD_REF_SLUG \
./helm-charts/minds"
- sentry-cli releases deploys $CI_COMMIT_SHA new -e review-$CI_COMMIT_REF_SLUG
- sentry-cli releases deploys $CI_PIPELINE_ID new -e review-$CI_COMMIT_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
......@@ -126,17 +134,17 @@ staging:fpm:
- IMAGE_LABEL="staging"
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID
# Push to AWS registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
# Push to Gitlab registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker push $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
# Deploy to staging
- aws ecs update-service --service=$ECS_APP_STAGING_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
# Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
- sentry-cli releases deploys $CI_PIPELINE_ID new -e $IMAGE_LABEL
environment:
name: staging
url: https://www.minds.com/?staging=1
......@@ -152,17 +160,17 @@ canary:fpm:
- IMAGE_LABEL="canary"
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID
# Push to AWS registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
# Push to Gitlab registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker push $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
# Deploy to ECS
- aws ecs update-service --service=$ECS_APP_CANARY_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
# Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
- sentry-cli releases deploys $CI_PIPELINE_ID new -e $IMAGE_LABEL
only:
refs:
- master
......@@ -180,17 +188,17 @@ production:fpm:
- IMAGE_LABEL="production"
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF
- docker pull $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID
# Push to AWS registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL_FPM:$IMAGE_LABEL
# Push to Gitlab registry
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_BUILD_REF $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/fpm:$CI_PIPELINE_ID $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
- docker push $CI_REGISTRY_IMAGE/fpm:$IMAGE_LABEL
# Delpoy to ECS
- aws ecs update-service --service=$ECS_APP_PRODUCTION_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
# Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
- sentry-cli releases deploys $CI_PIPELINE_ID new -e $IMAGE_LABEL
only:
refs:
- master
......@@ -208,12 +216,12 @@ production:runners:
- IMAGE_LABEL="production"
- $(aws ecr get-login --no-include-email --region us-east-1)
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF
- docker pull $CI_REGISTRY_IMAGE/runners:$CI_PIPELINE_ID
# Push to production register
- docker tag $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF $ECR_REPOSITORY_URL_RUNNERS:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/runners:$CI_PIPELINE_ID $ECR_REPOSITORY_URL_RUNNERS:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL_RUNNERS:$IMAGE_LABEL
# Push gitlab registry
- docker tag $CI_REGISTRY_IMAGE/runners:$CI_BUILD_REF $CI_REGISTRY_IMAGE/runners:$IMAGE_LABEL
- docker tag $CI_REGISTRY_IMAGE/runners:$CI_PIPELINE_ID $CI_REGISTRY_IMAGE/runners:$IMAGE_LABEL
- docker push $CI_REGISTRY_IMAGE/runners:$IMAGE_LABEL
- aws ecs update-service --service=$ECS_RUNNERS_PRODUCTION_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
only:
......
......@@ -483,6 +483,10 @@ class newsfeed implements Interfaces\Api
$activity->setTags($_POST['tags']);
}
if (isset($_POST['nsfw'])) {
$activity->setNsfw($_POST['nsfw']);
}
$user = Core\Session::getLoggedInUser();
if ($user->isMature()) {
$activity->setMature(true);
......
......@@ -173,12 +173,10 @@ class notifications implements Interfaces\Api
/**
* Polyfill notifications to be readed by legacy clients
* @return array
*/
protected function polyfillResponse($notifications)
protected function polyfillResponse($notifications) : array
{
//if (!is_array($notifications)) {
// return $notifications;
// }
$return = [];
// Formatting for legacy notification handling in frontend
foreach ($notifications as $key => $entity) {
......@@ -202,15 +200,15 @@ class notifications implements Interfaces\Api
}
$notification = [
'guid' => $entity->getUUID(),
'uuid' => $entity->getUUID(),
'guid' => $entity->getUuid(),
'uuid' => $entity->getUuid(),
'description' => $data['description'],
'entityObj' => $entityObj ? $entityObj->export() : null,
'filter' => $entity->getType(),
'fromObj' => $fromObj ? $fromObj->export() : null,
'from_guid' => $entity->getFromGuid(),
'to' => $toObj ? $toObj->export() : null,
'guid' => $entity->getUUID(),
'guid' => $entity->getUuid(),
'notification_view' => $entity->getType(),
'params' => $data, // possibly some deeper polyfilling needed here,
'time_created' => $entity->getCreatedTimestamp(),
......
......@@ -6,12 +6,10 @@ namespace Minds\Core\Di;
class Registry
{
private array $providers = [];
/** @var array $providers */
private $providers = [];
public static function get()
{
}
}
......@@ -5,6 +5,7 @@
namespace Minds\Core\Notification;
use Minds\Core\Data\Cassandra\Client;
use Minds\Core\Di\Di;
use Minds\Common\Repository\Response;
use Cassandra\Bigint;
......@@ -17,7 +18,7 @@ class CassandraRepository
{
const NOTIFICATION_TTL = ((60 * 60) * 24) * 30; // 30 days
/** @var $cql */
/** @var Client $cql */
private $cql;
public function __construct($cql = null, $urn = null)
......@@ -82,8 +83,8 @@ class CassandraRepository
foreach ($result as $row) {
$notification = new Notification();
$notification->setUuid($row['uuid']->uuid() ?: null)
->setToGuid($row['to_guid'] ? (int) $row['to_guid']->value(): null)
->setFromGuid($row['from_guid'] ? (int) $row['from_guid']->value(): null)
->setToGuid(isset($row['to_guid']) ? (int) $row['to_guid']->value() : null)
->setFromGuid(isset($row['from_guid']) ? (int) $row['from_guid']->value() : null)
->setEntityGuid((string) $row['entity_guid']) // REMOVE ONCE FULLY ON CASSANDRA
->setEntityUrn($row['entity_urn'])
->setCreatedTimestamp($row['created_timestamp'] ? $row['created_timestamp']->time() : null)
......
......@@ -17,7 +17,6 @@ class Transcode implements Interfaces\QueueRunner
$transcoder = new Core\Media\Services\FFMpeg();
$transcoder->setKey($data->getData()['key']);
$transcoder->onQueue();
}, [ 'max_messages' => 1 });
}, [ 'max_messages' => 1 ]);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment