collaboration icon indicating copy to clipboard operation
collaboration copied to clipboard

No connection for Global content

Open mikemartin opened this issue 3 years ago • 4 comments

It seems collaboration does not work for Global content. Perhaps this is because the content is structured differently and stored in the data array?

Screen Shot 2021-08-10 at 4 02 53 pm

mikemartin avatar Aug 10 '21 06:08 mikemartin

To expand a little bit on this, the auth ajax request throws an 403 error.

duncan412 avatar Apr 11 '22 14:04 duncan412

Hi, as a workaround, put this in the boot method of any service provider:

Broadcast::channel('globals.{id}.{site}', function ($user, $id, $site) {
    return [
        'name' => $user->name(),
        'id' => $user->id(),
        'title' => $user->title(),
        'email' => $user->email(),
        'avatar' => $user->avatar(),
        'initials' => $user->initials(),
    ];
});

ben182 avatar Jun 26 '22 17:06 ben182

Running into this problem, too, but the workaround doesn't seem to be working.

theutz avatar Nov 09 '23 17:11 theutz

Running into this problem, too, but the workaround doesn't seem to be working.

Upon further investigation, it seems that the front-end is looking for a channel with four segments: globals.{set}.{id}.{site}. I assume, at least, that this is what each of the segments mean.

- Broadcast::channel('globals.{id}.{site}', function ($user, $id, $site) {
+ Broadcast::channel('globals.{set}.{id}.{site}', function ($user, $set, $id, $site) {

So, to updated @ben182 's helpful comment from before, you might need to put the following in routes/channels.php if you have it, or in the boot method of the BroadcastServiceProvider:

Broadcast::channel('globals.{set}.{id}.{site}', function ($user, $set, $id, $site) {
    return [
        'name' => $user->name(),
        'id' => $user->id(),
        'title' => $user->title(),
        'email' => $user->email(),
        'avatar' => $user->avatar(),
        'initials' => $user->initials(),
    ];
});

theutz avatar Nov 09 '23 17:11 theutz