1. Home
  2. Docs
  3. Documentation
  4. Core Modules
  5. User Reporting

User Reporting

User blocking and reporting is a feature that is required by Apple and Google in all mobile applications where users can create and share their own content with others. This is extremely important in applications such as:

  • messaging
  • dating apps
  • social networks
  • marketplace apps
  • photo sharing apps

We’ve abstracted out this functionality into the User Reporting module, which lives in src/Core/user-reporting.

The module contains only a few important pieces:

  • userReports reducer
    • your app needs to support this reducer in its redux configuration, in order for the module to work properly
  • firebase / reportingManager
    • by default, our app uses Firebase for storing all user reports.
    • the Firestore table name is “reports“, which gets automatically created when you report a user for the first time
    • to use the default Firebase reporting manager, simply use the code snippet below:
      import { reportingManager } from 'path to Core/user-reporting';
      
      ...
      
      reportingManager.markAbuse(myUserID, otherUserID, type).then(response => {
          // myUserID user just blocked the otherUserID user
      });

Dependencies

Given that this feature is required by Apple and Google for certain functionalities where users can share content between them, the user-reporting module is added as a dependency to the following Core Modules:

  • Chat
  • Video Chat
  • Feed
  • Social Graph

This means that if your app imports one of those modules, you’ll need to import the user-reporting module too.

The user reports are being used by those modules to filter out content from the blocked users, such as :

  • posts
  • chat messages
  • user lists
  • notifications
  • stories

Changing to Your Own Backend

If you are planning to use your own backend for the entire application, you’ll need to migrate the user reporting module to your own server endpoints. Fortunately, all you need to do is override these two methods in Core/user-reporting/firebase.js:

export const markAbuse = (fromUserID, toUserID, abuseType) => {
  // call the endpoint that blocks an user
}

export const unsubscribeAbuseDB = (userID, callback) => {
 // call the endpoint that retrieves the list of all users blocked by userID
}

 

Was this article helpful to you? Yes No

How can we help?