mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-16 20:49:49 -04:00
Add banned user handling in profile and messaging components.
This commit is contained in:
@@ -466,6 +466,8 @@
|
||||
"messages.action.delete": "Löschen",
|
||||
"messages.action.edit": "Bearbeiten",
|
||||
"messages.cannot_message_deleted": "Sie können ihnen keine Nachricht senden, da sie ihr Konto gelöscht haben.",
|
||||
"messages.cannot_message_banned": "Sie können ihnen keine Nachricht senden, da sie gesperrt wurden.",
|
||||
"messages.cannot_message_you_banned": "Sie können ihnen keine Nachricht senden, da Sie gesperrt wurden.",
|
||||
"messages.create": "Erstellen",
|
||||
"messages.delete_confirm": "Sind Sie sicher, dass Sie diese Nachricht löschen möchten?",
|
||||
"messages.delete_failed": "Löschen der Nachricht fehlgeschlagen",
|
||||
|
||||
@@ -466,6 +466,8 @@
|
||||
"messages.action.delete": "Supprimer",
|
||||
"messages.action.edit": "Modifier",
|
||||
"messages.cannot_message_deleted": "Vous ne pouvez pas leur envoyer de message car ils ont supprimé leur compte.",
|
||||
"messages.cannot_message_banned": "Vous ne pouvez pas leur envoyer de message car ils ont été bannis.",
|
||||
"messages.cannot_message_you_banned": "Vous ne pouvez pas leur envoyer de message car vous avez été banni.",
|
||||
"messages.create": "Créer",
|
||||
"messages.delete_confirm": "Êtes-vous sûr de vouloir supprimer ce message ?",
|
||||
"messages.delete_failed": "Échec de la suppression du message",
|
||||
|
||||
@@ -111,16 +111,24 @@ export const ProfileGrid = (props: {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!isLoadingMore && !isReloading && other_profiles.length === 0 && (
|
||||
{user?.isBannedFromPosting ? (
|
||||
<div className="py-8 text-center">
|
||||
<p>{t('profile_grid.no_profiles', 'No profiles found.')}</p>
|
||||
<p>
|
||||
{t(
|
||||
'profile_grid.notification_cta',
|
||||
"Feel free to click on Get Notified and we'll notify you when new users match your search!",
|
||||
)}
|
||||
</p>
|
||||
<p>You can't see profiles as you got banned.</p>
|
||||
</div>
|
||||
) : (
|
||||
!isLoadingMore &&
|
||||
!isReloading &&
|
||||
other_profiles.length === 0 && (
|
||||
<div className="py-8 text-center">
|
||||
<p>{t('profile_grid.no_profiles', 'No profiles found.')}</p>
|
||||
<p>
|
||||
{t(
|
||||
'profile_grid.notification_cta',
|
||||
"Feel free to click on Get Notified and we'll notify you when new users match your search!",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -92,6 +92,11 @@ export function ProfilesHome() {
|
||||
const id = useRef(0)
|
||||
useEffect(() => {
|
||||
if (!user) return
|
||||
if (user.isBannedFromPosting) {
|
||||
setProfiles([])
|
||||
setProfileCount(0)
|
||||
return
|
||||
}
|
||||
setIsReloading(true)
|
||||
const current = ++id.current
|
||||
const args = removeNullOrUndefinedProps({
|
||||
@@ -123,6 +128,12 @@ export function ProfilesHome() {
|
||||
const limit = 20
|
||||
|
||||
const loadMore = useCallback(async () => {
|
||||
if (!user) return false
|
||||
if (user.isBannedFromPosting) {
|
||||
setProfiles([])
|
||||
setProfileCount(0)
|
||||
return false
|
||||
}
|
||||
if (!profiles || isLoadingMore) return false
|
||||
if (fromSignup && isClearedFilters && sendScrollWarning) {
|
||||
setSendScrollWarning(false)
|
||||
|
||||
@@ -147,6 +147,9 @@ export const PrivateChat = (props: {
|
||||
const members = filterDefined(otherUsers?.filter((user) => memberIds.includes(user.id)) ?? [])
|
||||
const router = useRouter()
|
||||
|
||||
// Check ban status for messaging restrictions
|
||||
const allUsersBanned = members.length > 0 && members.every((member) => member.isBannedFromPosting)
|
||||
|
||||
const {topVisibleRef, showMessages, innerDiv, outerDiv} = usePaginatedScrollingMessages(
|
||||
messages,
|
||||
user?.id,
|
||||
@@ -436,6 +439,18 @@ export const PrivateChat = (props: {
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
) : allUsersBanned ? (
|
||||
<div className="border-ink-200 p-4 text-center">
|
||||
<span className="text-ink-600">
|
||||
{t('messages.cannot_message_banned', "You can't text them as they got banned.")}
|
||||
</span>
|
||||
</div>
|
||||
) : user.isBannedFromPosting ? (
|
||||
<div className="border-ink-200 p-4 text-center">
|
||||
<span className="text-ink-600">
|
||||
{t('messages.cannot_message_you_banned', "You can't text them as you got banned.")}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<CommentInputTextArea
|
||||
editor={editor}
|
||||
|
||||
Reference in New Issue
Block a user