// Abuse reports
//
'use strict';


const Mongoose = require('mongoose');
const Schema   = Mongoose.Schema;


module.exports = function (N, collectionName) {

  let AbuseReport = new Schema({

    // _id of reported content
    src: Schema.ObjectId,

    // N.shared.content_type (FORUM_POST, BLOG_ENTRY, ...)
    type: Number,

    // Report text
    text: String,

    // Parser options
    params_ref: Schema.ObjectId,

    // User _id
    from: Schema.ObjectId
  }, {
    versionKey: false
  });


  N.wire.on('init:models', function emit_init_AbuseReport() {
    return N.wire.emit('init:models.' + collectionName, AbuseReport);
  });

  N.wire.on('init:models.' + collectionName, function init_model_AbuseReport(schema) {
    N.models[collectionName] = Mongoose.model(collectionName, schema);
  });
};

@@ -360,16 +360,112 @@
 tring,%0A%0A
+    // Flag defining whether this report was created automatically%0A    auto_reported: Boolean,%0A%0A
     // P
@@ -590,16 +590,138 @@
 %0A  %7D);%0A%0A
+  // Duplicate check for auto-created abuse reports%0A  AbuseReport.index(%7B src: 1, auto_reported: 1 %7D, %7B sparse: true %7D);%0A%0A
 %0A  N.wir

Add auto abuse reports after multiple downvotes