Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anchetaWern/6ec1f2b65ad54b5b034dc68ed5ca2a7b to your computer and use it in GitHub Desktop.
Save anchetaWern/6ec1f2b65ad54b5b034dc68ed5ca2a7b to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: deal with user behavior
let warn_count = (user.warn_count) ? user.warn_count : 0;
warn_count += 1;
if (warn_count < 3) {
const updated_user_data = await server_side_client.updateUsers([{
id: user.id,
warn_count: warn_count
}]);
} else {
const ban_data = await server_side_client.banUser(user.id, {
user_id: user.id,
// timeout: 5, // you can add this for testing or just unban user
reason: 'Colorful words',
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment