Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ee4b910 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

fixed background job and code optimization

parent e19ce5a1
Loading
Loading
Loading
Loading
Loading
+23 −25
Original line number Diff line number Diff line
@@ -57,8 +57,29 @@ class Application extends App implements IBootstrap {
	 */
	public function __construct(array $params = []) {
		parent::__construct(self::APP_ID, $params);
		//$app = new \OCP\AppFramework\App('ecloud-theme-helper');
		//$containerinvite = $app->getContainer() ;

	}

	/**
	 * @inheritDoc
	 */
	public function register(IRegistrationContext $context): void {
		$context->registerDashboardWidget(CalendarWidget::class);

		// TODO: drop conditional code when the app is 23+
		if (method_exists($context, 'registerProfileLinkAction')) {
			$context->registerProfileLinkAction(AppointmentsAction::class);
		}

		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);


	}

	/**
	 * @inheritDoc
	 */
	public function boot(IBootContext $context): void {
		$container = $this->getContainer();
		/**
         * Middleware
@@ -107,27 +128,4 @@ class Application extends App implements IBootstrap {
		 // executed in the order that it is registered
		 $containerinvite->registerMiddleware('InvitationMiddleware');
	}

	/**
	 * @inheritDoc
	 */
	public function register(IRegistrationContext $context): void {
		$context->registerDashboardWidget(CalendarWidget::class);

		// TODO: drop conditional code when the app is 23+
		if (method_exists($context, 'registerProfileLinkAction')) {
			$context->registerProfileLinkAction(AppointmentsAction::class);
		}

		$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);


	}

	/**
	 * @inheritDoc
	 */
	public function boot(IBootContext $context): void {
		
	}
}
 No newline at end of file
+24 −5
Original line number Diff line number Diff line
@@ -29,20 +29,38 @@ namespace OCA\Calendar\BackgroundJob;

use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\QueuedJob ;
use OCP\ILogger;
use Psr\Log\LoggerInterface;
use OCP\IDBConnection;
use OCP\Defaults;
use OCP\Mail\IMailer;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\IUser;
use OCP\Calendar\IManager;
use OCP\L10N\IFactory;
use Sabre\VObject\Reader;
use OCP\Util;

class SendInviteResponseMailJob extends QueuedJob  {
	/** @var ILogger */
	private $logger;

	private const translations = [
		"tentative" => [
			"meeting_title" => "Invitation Tentatively Accepted: %s",
			"meeting_body" =>
				"%s has tentatively accepted your invitation to %s on %s",
			"meeting_head" => "Tentatively Accepted",
		],
		"accept" => [
			"meeting_title" => "Invitation Accepted: %s",
			"meeting_body" => "%s has accepted your invitation to %s on %s",
			"meeting_head" => "Accepted",
		],
		"decline" => [
			"meeting_title" => "Invitation Declined: %s",
			"meeting_body" => "%s has declined your invitation to %s on %s",
			"meeting_head" => "Declined",
		],
	];


	public function __construct(ITimeFactory $time,
									IDBConnection $db,
@@ -92,6 +110,7 @@ class SendInviteResponseMailJob extends QueuedJob {
	}
	private function extract_emails_from($string)
	{
		$string= (string) $string;
		$matches = [];
		$found = preg_match("/mailto:(.*)/i", $string, $matches);
		if ($found === 1) {
@@ -100,8 +119,8 @@ class SendInviteResponseMailJob extends QueuedJob {
		return "";
	}
	protected function run($arguments) {
		print_r($arguments);
		$token = $arguments['token'];
		$methodName = $arguments['methodName'];
		//$outdated = $this->service->sendInviteResponseMail($argument);
		$queryCalendarInvitations = $this->db->getQueryBuilder();
			$queryCalendarInvitations
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ class InvitationMiddleware extends Middleware
		) {
			$token = $this->request->getParam("token");

			$this->jobList->add(SendInviteResponseMailJob::class, ['token' => $token]);
			$this->jobList->add(SendInviteResponseMailJob::class, ['token' => $token,'methodName' => $methodName]);

		}