openfoodfacts / openfoodfacts-server

Open Food Facts database, API server and web interface - 🐪🦋 Perl, CSS and JS coders welcome 😊 For helping in Python, see Robotoff or taxonomy-editor
http://openfoodfacts.github.io/openfoodfacts-server/
GNU Affero General Public License v3.0
658 stars 387 forks source link

Prevention - New edit rules to ignore or notify edits that match given conditions #798

Open stephanegigandet opened 7 years ago

stephanegigandet commented 7 years ago

What

We need a new system to easily add rules that can be triggered when products are edited and when the edits match given conditions.

In particular this is needed to ignore unwanted edits from apps.

Proposed features and format:


@edit_rules = (

{
    name => "App XYZ",
    conditions => [
        user_id => "xyz",
    ],
    actions => {
        ignore_if_existing_ingredients_texts_fr => 1,
        ignore_if_0_nutriments_fruits-vegetables-nuts_100g => 1,        
        warn_if_match_nutriments_fruits-vegetables-nuts_100g => 100,
        ignore_if_regexp_match_packaging => "^(artikel|produit|producto|produkt|produkte)$",
    },
    notifications => qw (
        some@email.address
        slack_channel_edit-alert
        slack_channel_edit-alert-xyz
    ),
},

);

Part of

teolemon commented 7 years ago

Can we close ?