Giter Site home page Giter Site logo

Comments (11)

syntaxlexx avatar syntaxlexx commented on September 26, 2024 4

Hi @bhdrnzl ,

An update has been released and you can update to the latest release.

Cheers.

from laravel-5-messenger.

syntaxlexx avatar syntaxlexx commented on September 26, 2024 1

Hello there,

Would you post a snippet of your code to illustrate this? Thank you.

from laravel-5-messenger.

bhdrnzl avatar bhdrnzl commented on September 26, 2024 1

Hi @lexxyungcarter ..
I guess I couldn't tell you what the problem was. When a user leaves the chat, the other people continue to chat and the user continues to send new message notifications. The message does not appear because the user has left the chat, but the notification icon is lit.

With this code, the user leaves the conversation.
`

public function leave($id)
{
    $thread = Thread::find($id);
    $thread->removeParticipant(Auth::id());

    if ($thread) {

        toastr()->success('Ok..');

        return back();
    } else {

        toastr()->error('No..');

        return back();
    }
}`

I can see in the database that I left talking, but the notification continues to go.
PhpMyadmin screenshot: https://ibb.co/RhXFKS5

i removed this code:
$thread->activateAllParticipants();

still notifications are coming..

from laravel-5-messenger.

bhdrnzl avatar bhdrnzl commented on September 26, 2024 1

Cheers, sir. I am grateful to you for preparing such a package because I use it in all my projects. And thank you for paying attention to the problem.

from laravel-5-messenger.

bhdrnzl avatar bhdrnzl commented on September 26, 2024
public function leave($id)
    {
        $thread = Thread::find($id);
        $thread->removeParticipant(Auth::id());
        if ($thread) {

            toastr()->success('You left the conversation');

            return back();

        } else {

            toastr()->error('You cant leave conversation');

            return back();
        }
    }

from laravel-5-messenger.

bhdrnzl avatar bhdrnzl commented on September 26, 2024

@lexxyungcarter Is there a clue about this error?

from laravel-5-messenger.

syntaxlexx avatar syntaxlexx commented on September 26, 2024

Hi @bhdrnzl ,
Let me set up a simple demo to replicate the issue.

from laravel-5-messenger.

syntaxlexx avatar syntaxlexx commented on September 26, 2024

Hello @bhdrnzl ,
When sending the message, could you be calling

$thread->activateAllParticipants();

Because if you do so, all previously removed participants will be included back to the conversation. try commenting the piece of code and see the results.

I have set up a simple demo app over here.
The complete working demo is demonstrated here.

Also, make sure to update to the latest version of the package (version 1.0.7). It includes some important updates.

from laravel-5-messenger.

bhdrnzl avatar bhdrnzl commented on September 26, 2024

Hi @lexxyungcarter,
Thank you for working. I copied the MessagesController.php file in your example and added it to my own project. The notification continues to go to the user leaving the chat.

from laravel-5-messenger.

syntaxlexx avatar syntaxlexx commented on September 26, 2024

Ok. If that is the case, you can simply comment that line in the update() method

// comment or remove this to avoid activating all participants 
// (including those who have been removed from a thread conversation
$thread->activateAllParticipants();

and then test your app.

from laravel-5-messenger.

syntaxlexx avatar syntaxlexx commented on September 26, 2024

@bhdrnzl It's always a pleasure helping others out.
Cheers!

from laravel-5-messenger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.