Flagging a message

flag and unflag a message

While having moderators surveying your chats is great, it doesn't scale well. A way to overcome this is to let your users do the work for your moderators. By letting users flag other users or specific messages, the work of moderators is significantly reduced and democratized, thus allowing administrators to only respond to issues when deemed critical or absolutely necessary.

Flag and Unflag Messages

In order to flag a message, create an instance of EkoMessageFlagger by calling EkoMessage.report(); Beware that each EkoMessageFlagger is tied to only one specific message.

EkoMessage message;
EkoMessageFlagger flagger = message.report();

Flag a message

To flag a message, call the following method:

// flag a message
flgger.flag()
      .doOnComplete(() -> {
        // Message is already flagged. you may update the UI accordingly here
      })
      .subscribe();

Unflag a message

To unflag a message, call the following method:

// un-flag a message
flagger.unflag()
       .subscribe();

Check if the message has been flagged

The User can also check if they have previously flagged a message before by calling the following asynchronous method:

// check whether we already have flagged this message 
boolean isFlaggedByMe = message.isFlaggedByMe();

If this method has been called before in the current session, the user can also check the cached result on the message payload itself.

// get the number of people who already have flagged this message
int totalFlagCount = message.getFlagCount();

Last updated