Created
June 26, 2019 05:49
-
-
Save anchetaWern/6ec1f2b65ad54b5b034dc68ed5ca2a7b to your computer and use it in GitHub Desktop.
React Native Stream Chat Profanity Filtering: deal with user behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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