-
-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] issues sending notifications from kanban board. - no notification is emailed #2196
Comments
I have the same issue. Hope this will be prioritised because being unable to send emails is a big problem. I'm running Leantime 2.4.8, self hosted. |
I assume that you all are using ldap then? |
I'm using Google OIDC. |
Hi,
The temp work around for me was to force emails to come to
my email address then I forward them
(see some of the bug description posted on github)
ok so i have a team of 7 😉️
regards
Andy
-----Original Message-----
From: Fabio Rinaldi ***@***.***>
Reply-To: Leantime/leantime
***@***.***
To: Leantime/leantime ***@***.***>
Cc: as1029 ***@***.***>, Author
***@***.***>
Subject: Re: [Leantime/leantime] [BUG] issues sending
notifications from kanban board. - no notification is
emailed (Issue #2196)
Date: Sat, 13 Jan 2024 15:40:26 -0800
I have the same issue. Hope this will be prioritised
because being unable to send emails is a big problem.
—
Reply to this email directly, view it on GitHub, or
unsubscribe.
You are receiving this because you authored the
thread.Message ID:
***@***.***>
|
This is now fixed in 3.0.5 |
Hi, this doesn't appear to be fixed. I'm running Leantime 3.0.7 and the issue is still occurring: the TO field doesn't contain an email address but rather the numeric ID of the user that the email is supposed to be sent to. I've enabled debugging, and I can see the following log:
8 is the ID of the user the email was supposed to be sent to. |
Hi Marcel,
Thanks for all your work on this project!
I just checked to see on the email issue (wanted to do a
code update - cos have more team members and it is
becoming a pain to forward email).
The mailer is still getting an ID instead of an email
address.
Please can you check and fix?
(I have looked at the below code in version 3.05 3.06 3.07
and 3.1.0-beta
I think the issue is in this code (full file below for
your convenience issues highlighted in red) :
$taggedUser = $links->item($i)->getAttribute('data-tagged-
user-id');
is a numeric value not an email address?
$mailer->sendMail(array($taggedUser), $authorName);
first parameter sendMail should be an array of email
addresses - not an array of user ID's
Hope that helps
kind regards
Andy
app/Domain/Notifications/Services/Notifications.php
**********************************************************
*******
<?php
namespace Leantime\Domain\Notifications\Services {
use DOMDocument;
use
Illuminate\Contracts\Container\BindingResolutionException;
use Leantime\Core\Db as DbCore;
use Leantime\Core\Language as LanguageCore;
use Leantime\Core\Mailer as MailerCore;
use
Leantime\Domain\Notifications\Repositories\Notifications
as NotificationRepository;
use Leantime\Domain\Users\Repositories\Users as
UserRepository;
/**
*
*/
class Notifications
{
private DbCore $db;
private NotificationRepository $notificationsRepo;
private UserRepository $userRepository;
private LanguageCore $language;
/**
* __construct - get database connection
*
* @access public
*/
public function __construct(
DbCore $db,
NotificationRepository $notificationsRepo,
UserRepository $userRepository,
LanguageCore $language
) {
$this->db = $db;
$this->notificationsRepo = $notificationsRepo;
$this->userRepository = $userRepository;
$this->language = $language;
}
/**
* @param $userId
* @param $showNewOnly
* @param $limitStart
* @param $limitEnd
* @param $filterOptions
* @return array|false
*/
/**
* @param $userId
* @param int $showNewOnly
* @param int $limitStart
* @param int $limitEnd
* @param array $filterOptions
* @return array|false
*/
public function getAllNotifications($userId, int
$showNewOnly = 0, int $limitStart = 0, int $limitEnd =
100, array $filterOptions = array()): false|array
{
return $this->notificationsRepo-
getAllNotifications($userId, $showNewOnly, $limitStart,
$limitEnd, $filterOptions);
}
/**
* @param array $notifications
* @return bool|null
*/
public function addNotifications(array $notifications):
?bool
{
return $this->notificationsRepo-
addNotifications($notifications);
}
/**
* @param $id
* @param $userId
* @return bool
*/
/**
* @param $id
* @param $userId
* @return bool
*/
public function markNotificationRead($id, $userId): bool
{
if ($id == "all") {
return $this->notificationsRepo-
markAllNotificationRead($userId);
} else {
return $this->notificationsRepo-
markNotificationRead($id);
}
}
/**
* @param string $content
* @param string $module
* @param int $moduleId
* @param int $authorId
* @param string $url
* @return void
* @throws BindingResolutionException
*/
public function processMentions(string $content, string
$module, int $moduleId, int $authorId, string $url): void
{
$dom = new DOMDocument();
//Content may not be well formatted. Suppress warnings.
@$dom->loadHTML($content);
$links = $dom->getElementsByTagName("a");
$author = $this->userRepository->getUser($authorId);
$authorName = $author['firstname'] ?? $this->language-
__('label.team_mate');
for ($i = 0; $i < $links->count(); $i++) {
$taggedUser = $links->item($i)->getAttribute('data-tagged-
user-id');
if ($taggedUser !== '' && is_numeric($taggedUser)) {
//Check if user was mentioned before
$userMentions = $this->getAllNotifications(
$taggedUser,
false,
0,
10,
array("type" => "mention", "module" => $module, "moduleId"
=> $moduleId)
);
if ($userMentions === false || (is_array($userMentions) &&
count($userMentions) == 0)) {
$notification = array(
"userId" => $taggedUser,
"read" => '0',
"type" => 'mention',
"module" => $module,
"moduleId" => $moduleId,
"message" => sprintf($this->language-
__('text.x_mentioned_you'), $authorName),
"datetime" => date("Y-m-d H:i:s"),
"url" => $url,
"authorId" => $authorId,
);
$this->addNotifications(array($notification));
//send email
$mailer = app()->make(MailerCore::class);
$mailer->setContext('notify_project_users');
$subject = sprintf($this->language-
__('text.x_mentioned_you'), $authorName);
$mailer->setSubject($subject);
$emailMessage = $subject;
$emailMessage .= sprintf($this->language-
__('text.click_here'), $url);
$mailer->setHtml($emailMessage);
$mailer->sendMail(array($taggedUser), $authorName);
}
}
}
}
}
}
-----Original Message-----
From: Marcel Folaron ***@***.***>
Reply-To: Leantime/leantime
***@***.***
To: Leantime/leantime ***@***.***>
Cc: as1029 ***@***.***>, Author
***@***.***>
Subject: Re: [Leantime/leantime] [BUG] issues sending
notifications from kanban board. - no notification is
emailed (Issue #2196)
Date: Tue, 16 Jan 2024 13:50:16 -0800
I assume that you all are using ldap then?
—
Reply to this email directly, view it on GitHub, or
unsubscribe.
You are receiving this because you authored the
thread.Message ID:
***@***.***>
|
Hi,
I upgraded to the new leantime yesterday 08 Jan 2024.
The new version look way better - thanks for all the hard work.
Help Please ?
I am having issues with sending notifications from kanban board. - no notification is emailed
( I am using SMTP and all was good on previous version of leantime.)
It appears that the SendMail $to variable is populated/set to the user id and not an email address
Best way so see this is to edit the file : /app/Core/Mailer.php
if I [remove above dump] and put [circa line 370 in /app/Core/Mailer.php]
then all works fine and email is sent
Probably comes from :
../Leantime/app/Domain/Notifications/Services/Notifications.php:156:
Anyways, hope you able to find issue and fix.. If not, how do I change tagged-user-id into email address? (what function so I am not messing with your code structure)?
Keep up the great work - it is an awesome system
regards
Andy
The text was updated successfully, but these errors were encountered: