Added new Moderator email
SUMMIT_SUBMISSIONS_PRESENTATION_MODERATOR_NOTIFICATION Change-Id: I7ac6d395570547175363e5de25969175e4e6b37c Signed-off-by: smarcet <smarcet@gmail.com>
This commit is contained in:
parent
a3757e03d6
commit
89cd16e565
|
@ -0,0 +1,90 @@
|
|||
<?php namespace App\Jobs\Emails\PresentationSubmissions;
|
||||
/**
|
||||
* Copyright 2020 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Jobs\Emails\AbstractEmailJob;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use models\summit\Presentation;
|
||||
use models\summit\PresentationSpeaker;
|
||||
/**
|
||||
* Class PresentationModeratorNotificationEmail
|
||||
* @package App\Jobs\Emails\PresentationSubmissions
|
||||
*/
|
||||
class PresentationModeratorNotificationEmail extends AbstractEmailJob
|
||||
{
|
||||
protected function getEmailEventSlug(): string
|
||||
{
|
||||
return self::EVENT_SLUG;
|
||||
}
|
||||
|
||||
// metadata
|
||||
const EVENT_SLUG = 'SUMMIT_SUBMISSIONS_PRESENTATION_MODERATOR_NOTIFICATION';
|
||||
const EVENT_NAME = 'SUMMIT_SUBMISSIONS_PRESENTATION_MODERATOR_NOTIFICATION';
|
||||
const DEFAULT_TEMPLATE = 'SUMMIT_SUBMISSIONS_PRESENTATION_MODERATOR_NOTIFICATION';
|
||||
|
||||
/**
|
||||
* PresentationModeratorNotificationEmail constructor.
|
||||
* @param PresentationSpeaker $moderator
|
||||
* @param Presentation $presentation
|
||||
*/
|
||||
public function __construct(PresentationSpeaker $moderator, Presentation $presentation)
|
||||
{
|
||||
|
||||
$summit = $presentation->getSummit();
|
||||
$creator = $presentation->getCreator();
|
||||
$selection_plan = $presentation->getSelectionPlan();
|
||||
|
||||
if(is_null($selection_plan))
|
||||
throw new \InvalidArgumentException('Presentation selection plan is null.');
|
||||
|
||||
$speaker_management_base_url = Config::get('cfp.base_url');
|
||||
$idp_base_url = Config::get('idp.base_url');
|
||||
$support_email = $summit->getSupportEmail();
|
||||
$support_email = !empty($support_email) ? $support_email: Config::get("cfp.support_email", null);
|
||||
|
||||
|
||||
if(empty($speaker_management_base_url))
|
||||
throw new \InvalidArgumentException('cfp.base_url is null.');
|
||||
|
||||
if(empty($idp_base_url))
|
||||
throw new \InvalidArgumentException('idp.base_url is null.');
|
||||
|
||||
if(empty($support_email))
|
||||
throw new \InvalidArgumentException('cfp.support_email is null.');
|
||||
|
||||
$payload = [];
|
||||
$payload['summit_name'] = $summit->getName();
|
||||
$payload['summit_logo'] = $summit->getLogoUrl();
|
||||
$payload['speaker_full_name'] = $moderator->getFullName(" ");
|
||||
$payload['speaker_email'] = $moderator->getEmail();
|
||||
$payload['creator_full_name'] = $creator->getFullName();
|
||||
$payload['creator_email'] = $creator->getEmail();
|
||||
$payload['selection_plan_name'] = $selection_plan->getName();
|
||||
$payload['presentation_edit_link'] = $presentation->getEditLink();
|
||||
|
||||
$summitBeginDate = $summit->getLocalBeginDate();
|
||||
$payload['summit_date'] = !is_null($summitBeginDate)? $summitBeginDate->format("F d, Y") : "";
|
||||
$submissionEndDateLocal = $selection_plan->getSubmissionEndDateLocal();
|
||||
$payload['until_date'] = !is_null($submissionEndDateLocal) ? $submissionEndDateLocal->format('F d, Y') : "";
|
||||
|
||||
$payload['selection_process_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug());
|
||||
$payload['speaker_management_link'] = sprintf("%s/app/%s", $speaker_management_base_url, $summit->getRawSlug());
|
||||
$payload['bio_edit_link'] = sprintf("%s/app/%s/profile", $speaker_management_base_url, $summit->getRawSlug());
|
||||
$payload['reset_password_link'] = sprintf("%s/auth/password/reset", $idp_base_url);
|
||||
$payload['support_email'] = $support_email;
|
||||
|
||||
$template_identifier = $this->getEmailTemplateIdentifierFromEmailEvent($summit);
|
||||
|
||||
parent::__construct($payload, $template_identifier, $payload['speaker_email']);
|
||||
}
|
||||
|
||||
}
|
|
@ -4626,6 +4626,7 @@ SQL;
|
|||
->select('distinct ft')
|
||||
->from('App\Models\Foundation\Summit\EmailFlows\SummitEmailFlowType', 'ft')
|
||||
->orderBy("ft.id");
|
||||
|
||||
$res = $builder->getQuery()->getResult();
|
||||
$list = [];
|
||||
foreach($res as $flow_type){
|
||||
|
|
|
@ -23,6 +23,7 @@ use App\Events\SummitUpdated;
|
|||
use App\Facades\ResourceServerContext;
|
||||
use App\Http\Utils\IFileUploader;
|
||||
use App\Jobs\Emails\PresentationSubmissions\ImportEventSpeakerEmail;
|
||||
use App\Jobs\Emails\PresentationSubmissions\PresentationModeratorNotificationEmail;
|
||||
use App\Jobs\Emails\PresentationSubmissions\PresentationSpeakerNotificationEmail;
|
||||
use App\Jobs\Emails\Schedule\ShareEventEmail;
|
||||
use App\Jobs\ProcessEventDataImport;
|
||||
|
@ -1829,6 +1830,9 @@ final class SummitService extends AbstractService implements ISummitService
|
|||
|
||||
$presentation->setModerator($speaker);
|
||||
|
||||
if($speaker->getMemberId() != $presentation->getCreatedById())
|
||||
PresentationModeratorNotificationEmail::dispatch($speaker, $presentation);
|
||||
|
||||
return $presentation;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
<?php namespace Database\Migrations\Model;
|
||||
/**
|
||||
* Copyright 2021 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use App\Jobs\Emails\PresentationSubmissions\PresentationModeratorNotificationEmail;
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema as Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Foundation\Summit\EmailFlows\SummitEmailFlowType;
|
||||
use LaravelDoctrine\ORM\Facades\Registry;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
use SummitEmailFlowTypeSeeder;
|
||||
|
||||
/**
|
||||
* Class Version20210707172103
|
||||
* @package Database\Migrations\Model
|
||||
*/
|
||||
class Version20210707172103 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema):void
|
||||
{
|
||||
DB::setDefaultConnection("model");
|
||||
$em = Registry::getManager(SilverstripeBaseModel::EntityManager);
|
||||
$repository = $em->getRepository(SummitEmailFlowType::class);
|
||||
$flow = $repository->findOneBy([
|
||||
"name" => "Presentation Submissions"
|
||||
]);
|
||||
|
||||
SummitEmailFlowTypeSeeder::createEventsTypes(
|
||||
[
|
||||
[
|
||||
'name' => PresentationModeratorNotificationEmail::EVENT_NAME,
|
||||
'slug' => PresentationModeratorNotificationEmail::EVENT_SLUG,
|
||||
'default_email_template' => PresentationModeratorNotificationEmail::DEFAULT_TEMPLATE
|
||||
]
|
||||
],
|
||||
$flow
|
||||
);
|
||||
|
||||
$em->persist($flow);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema):void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?php namespace Database\Migrations\Model;
|
||||
/**
|
||||
* Copyright 2021 OpenStack Foundation
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
**/
|
||||
use Doctrine\Migrations\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema as Schema;
|
||||
use LaravelDoctrine\ORM\Facades\Registry;
|
||||
use models\summit\Summit;
|
||||
use models\utils\SilverstripeBaseModel;
|
||||
/**
|
||||
* Class Version20210707172106
|
||||
* @package Database\Migrations\Model
|
||||
*/
|
||||
class Version20210707172106 extends AbstractMigration
|
||||
{
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function up(Schema $schema):void
|
||||
{
|
||||
$em = Registry::getManager(SilverstripeBaseModel::EntityManager);
|
||||
$repository = $em->getRepository(Summit::class);
|
||||
$summits = $repository->findAll();
|
||||
foreach($summits as $summit){
|
||||
$summit->seedDefaultEmailFlowEvents();
|
||||
$em->persist($summit);
|
||||
}
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Schema $schema
|
||||
*/
|
||||
public function down(Schema $schema):void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ use App\Jobs\Emails\PresentationSubmissions\SelectionProcess\PresentationSpeaker
|
|||
use App\Jobs\Emails\PresentationSubmissions\SelectionProcess\PresentationSpeakerSelectionProcessAlternateRejectedEmail;
|
||||
use App\Jobs\Emails\PresentationSubmissions\SelectionProcess\PresentationSpeakerSelectionProcessRejectedEmail;
|
||||
use App\Jobs\Emails\PresentationSubmissions\ImportEventSpeakerEmail;
|
||||
use App\Jobs\Emails\PresentationSubmissions\PresentationModeratorNotificationEmail;
|
||||
// Presentation Selections
|
||||
use App\Jobs\Emails\PresentationSelections\PresentationCategoryChangeRequestCreatedEmail;
|
||||
use App\Jobs\Emails\PresentationSelections\PresentationCategoryChangeRequestResolvedEmail;
|
||||
|
@ -261,6 +262,11 @@ final class SummitEmailFlowTypeSeeder extends Seeder
|
|||
'slug' => PresentationSpeakerNotificationEmail::EVENT_SLUG,
|
||||
'default_email_template' => PresentationSpeakerNotificationEmail::DEFAULT_TEMPLATE
|
||||
],
|
||||
[
|
||||
'name' => PresentationModeratorNotificationEmail::EVENT_NAME,
|
||||
'slug' => PresentationModeratorNotificationEmail::EVENT_SLUG,
|
||||
'default_email_template' => PresentationModeratorNotificationEmail::DEFAULT_TEMPLATE
|
||||
],
|
||||
[
|
||||
'name' => PresentationSpeakerSelectionProcessAcceptedAlternateEmail::EVENT_NAME,
|
||||
'slug' => PresentationSpeakerSelectionProcessAcceptedAlternateEmail::EVENT_SLUG,
|
||||
|
|
Loading…
Reference in New Issue