Skip to content
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

Mails will be send to all users in a project #106

Closed
HeldvonKosmos opened this issue Feb 25, 2024 · 1 comment
Closed

Mails will be send to all users in a project #106

HeldvonKosmos opened this issue Feb 25, 2024 · 1 comment
Assignees

Comments

@HeldvonKosmos
Copy link

Hey there,
thank you for the wonderful WebApp. It is the one thing that makes my life much easier at this moment.
I have only one problem.
The Mails will be send to every user that is in a project.
It would be much better to send only to users, that have subscribed to a ticket.
Thanks in advance.

@HeldvonKosmos
Copy link
Author

I have solved the problem. Just modify the function watchers() from Line 146 in /app/Models/Ticket.php as follows:

public function watchers(): Attribute
{
    return new Attribute(
        get: function () {
            $users = collect();
            $users->push($this->owner);
            if ($this->responsible) {
                $users->push($this->responsible);
            }

            $subscribers = TicketSubscriber::where('ticket_id', $this->id)->get();
            foreach ($subscribers as $subscriber) {
                $users->push($subscriber->user);
            }

            return $users->unique('id');
        }
    );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant