Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/Service/ClientDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ public function hasMobileConnection(IUser $user): bool {
->select('name')
->where($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
->andWhere($qb->expr()->orX(
$qb->expr()->eq('name', $qb->createNamedParameter('Nextcloud-iOS')),
$qb->expr()->like('name', $qb->createNamedParameter('%Nextcloud-android%')),
$qb->expr()->eq('name', $qb->createNamedParameter('%MagentaCLOUD iOS%')),
$qb->expr()->like('name', $qb->createNamedParameter('%Android%')),

))
->setMaxResults(1);
return $qb->executeQuery()->rowCount() === 1;
}
}
}
13 changes: 9 additions & 4 deletions lib/Service/MailSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

use OCP\Files\FileInfo;
use OCA\MonthlyStatusEmail\Db\NotificationTracker;
use OCA\MonthlyStatusEmail\Service\NotificationTrackerService;
use OCP\DB\Exception;
use OCP\IConfig;
use OCP\IL10N;
Expand Down Expand Up @@ -167,7 +168,8 @@ private function handleStorage(IEMailTemplate $emailTemplate, IUser $user): bool
return false;
} else {
$this->provider->writeStorageFull($emailTemplate, $storageInfo);
return true;
return false;

}
}

Expand All @@ -176,7 +178,7 @@ private function handleStorage(IEMailTemplate $emailTemplate, IUser $user): bool
* @return bool Whether a notification was sent
*/
public function sendMonthlyMailTo(NotificationTracker $trackedNotification): bool {
$message = $this->mailer->createMessage();
$message = $this->mailer->createMessage();
$user = $this->userManager->get($trackedNotification->getUserId());

if ($user === null) {
Expand Down Expand Up @@ -207,6 +209,8 @@ public function sendMonthlyMailTo(NotificationTracker $trackedNotification): boo
// People opting-out of the monthly emails should still get the
// 'urgent' email about running out of storage, but the rest
// shouldn't be sent.
$trackedNotification->setLastSendNotification(time());
$this->service->update($trackedNotification);
return false;
}

Expand Down Expand Up @@ -250,12 +254,13 @@ public function sendStatusEmailActivation(IUser $user, NotificationTracker $trac
return;
}

$this->provider->writeWelcomeMail($emailTemplate, $user->getDisplayName());
$this->sendEmail($emailTemplate, $user, $message, $trackedNotification);
//$this->provider->writeWelcomeMail($emailTemplate, $user->getDisplayName());
//$this->sendEmail($emailTemplate, $user, $message, $trackedNotification);
}

private function sendEmail(IEMailTemplate $template, IUser $user, IMessage $message, ?NotificationTracker $trackedNotification = null): void {
if ($trackedNotification !== null) {

$this->provider->writeOptOutMessage($template, $trackedNotification);
}
$message->useTemplate($template);
Expand Down