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

How to Exclude Notifications only for Files and Images #5334

Open
Gilbertdelyon opened this issue Oct 8, 2021 · 12 comments
Open

How to Exclude Notifications only for Files and Images #5334

Gilbertdelyon opened this issue Oct 8, 2021 · 12 comments

Comments

@Gilbertdelyon
Copy link

Gilbertdelyon commented Oct 8, 2021

Thanks to streamExcludes in common.php new files and new images are excluded from the stream,
So far so good...
... but notifications are still there.

Recently one of our member added 40 new images to an existing gallery.
The result was that each member of the space recieved 40 emails. Not good for the planet and very annoying.

Uploading several images in one set does not change anything.

Please, is there a way to avoid notification for Files and Images and to keep them for posts ??

As well as streamExcludes in common.php, something like this would be useful:

 'notification' => [
        'notificationExcludes' => [
            'humhub\modules\cfiles\bla...bla\File',
            'humhub\modules\gallery\bla...bla\Media',
         ]
    ],

May be possible, but I cannot find

@luke-
Copy link
Contributor

luke- commented Oct 8, 2021

Unfortunately, this is not possible at the moment.
It relates to the NewContent Notification or?

@Gilbertdelyon
Copy link
Author

Thanks for this prompt answer,
I hope this will be improved in a future version.
in the meantime would it be a way to modify the code of gallery module (not a good practice, I know !) so that it doesn't send any notification when content is added?

@luke-
Copy link
Contributor

luke- commented Oct 8, 2021

You can try to add public $silentContentCreation = true; here:
https://github.com/humhub-contrib/gallery/blob/master/models/Media.php#L41

@Gilbertdelyon
Copy link
Author

It works! thanks,
Can we expect this enhancement to be part of a future release or should I extend this class in a custom module or somewhere else ?

@luke-
Copy link
Contributor

luke- commented Oct 8, 2021

I can't say when and if/how the feature will be available...

@marc-farre
Copy link
Collaborator

marc-farre commented Jun 8, 2024

@luke- I've tested this in protected/config/common.php:

    'container' => [
        'definitions' => [
            \humhub\modules\cfiles\models\File::class => [
                'silentContentCreation' => true,
            ],
            \humhub\modules\gallery\models\Media::class => [
                'silentContentCreation' => true,
            ],
        ]
    ],

But it doesn't work. Do you know why?

@ArchBlood
Copy link
Contributor

@luke- I've tested this in protected/config/common.php:

    'container' => [
        'definitions' => [
            \humhub\modules\cfiles\models\File::class => [
                'silentContentCreation' => true,
            ],
            \humhub\modules\gallery\models\Media::class => [
                'silentContentCreation' => true,
            ],
        ]
    ],

But it doesn't work. Do you know why?

Maybe it's like class_exists() where ::class can't be used?

<?php

return [
    // Other configurations...

    'container' => [
        'definitions' => [
            'humhub\modules\cfiles\models\File' => [
                'silentContentCreation' => true,
            ],
            'humhub\modules\gallery\models\Media' => [
                'silentContentCreation' => true,
            ],
        ],
    ],

    // More configurations...
];

@marc-farre
Copy link
Collaborator

Maybe it's like class_exists() where ::class can't be used?

@ArchBlood Thanks. But it should work with ::class too, see this example: https://community.humhub.com/s/installation-and-setup/wiki/80/Configuration+Examples#hide-activity-box-on-given-space

@ArchBlood
Copy link
Contributor

Maybe it's like class_exists() where ::class can't be used?

@ArchBlood Thanks. But it should work with ::class too, see this example: https://community.humhub.com/s/installation-and-setup/wiki/80/Configuration+Examples#hide-activity-box-on-given-space

Did you make sure that there was a silentContentCreation property in those models?

@ArchBlood
Copy link
Contributor

Maybe it's like class_exists() where ::class can't be used?

@ArchBlood Thanks. But it should work with ::class too, see this example: https://community.humhub.com/s/installation-and-setup/wiki/80/Configuration+Examples#hide-activity-box-on-given-space

Did you make sure that there was a silentContentCreation property in those models?

Otherwise I'd see the following being possible if silentContentCreation property isn't in the original model;

<?php

return [
    // Other configurations...

    'container' => [
        'definitions' => [
            'humhub\modules\cfiles\models\File' => 'humhub\modules\cfiles\models\CustomFile',
            'humhub\modules\gallery\models\Media' => 'humhub\modules\gallery\models\CustomMedia',
        ],
    ],

    // More configurations...
];

@marc-farre
Copy link
Collaborator

Did you make sure that there was a silentContentCreation property in those models?

Yes because these classes extends the ContentActiveRecord one.

@ArchBlood
Copy link
Contributor

Did you make sure that there was a silentContentCreation property in those models?

Yes because these classes extends the ContentActiveRecord one.

This just means that neither class inherited silentContentCreation from the parent class ContentActiveRecord even though they extend from it.

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

No branches or pull requests

4 participants