Skip to content

Introduce an option to flag offensive content #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/components/chat/ReactionButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheckIcon, CloseIcon, CopyIcon, DislikeIcon, LikeIcon } from '@/components/svg'
import { CheckIcon, CloseIcon, CopyIcon, DislikeIcon, FlagIcon, LikeIcon } from '@/components/svg'
import { useDirection, useFeedbackHandler, useFeedbackService, useScreenInfo } from '@/hooks'
import { FeedbackClass, Message, ReactionButtonsState, RootState } from '@/store'
import { createGeneralThemedStyles } from '@/utils'
Expand Down Expand Up @@ -86,6 +86,10 @@ const ReactionButtons: React.FC<ReactionButtonsProps> = ({ threadId, messageId,
feedbackOptions = feedbacks.bad || []
}

if (selectedFeedbackClass === FeedbackClass.RedFlag) {
feedbackOptions = feedbacks.redflag || []
}

return (
<View className='flex-row flex-wrap gap-x-2'>
{feedbackOptions.map((option) => (
Expand Down Expand Up @@ -154,6 +158,21 @@ const ReactionButtons: React.FC<ReactionButtonsProps> = ({ threadId, messageId,
height={24}
/>
</Pressable>
<Pressable
onPress={() => {
handleFeedbackAction(FeedbackClass.RedFlag)
setEditing(true)
}}
className={`w-5 h-5 ${isRTL ? 'mr-2' : 'ml-2'}`}
hitSlop={8}
>
<FlagIcon
fill={selectedIcon === FeedbackClass.RedFlag ? theme.hoverColor : theme.iconFill}
hoverFill={theme.hoverColor}
width={24}
height={24}
/>
</Pressable>
</View>
{modalVisible && (
<View className={`w-full mt-6 ${modalVisible ? 'h-auto' : ''}`}>
Expand Down
3 changes: 2 additions & 1 deletion src/components/svg/FlagIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const FlagIcon: React.FC<Props> = (props: Props) => {
width={props.width || '24'}
height={props.height || '24'}
viewBox={props.viewBox || '0 0 24 24'}
fill={props.fill || '#08786B'}
fill={props.fill || 'currentColor'}
stroke={props.stroke || 'currentColor'}
transform={props.transform || transform}
>
<G>
Expand Down
19 changes: 13 additions & 6 deletions src/i18n/locales/ar/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "مضارب / غير آمن",
"value": "offensive"
},
{
"id": "bad2",
"label": "لا يكون صحيحاً في الواقع",
Expand All @@ -32,5 +27,17 @@
"label": "أخرى",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "مضارب / غير آمن",
"value": "offensive"
},
{
"id": "redflag2",
"label": "أخرى",
"value": "other"
}
]
}
}
19 changes: 13 additions & 6 deletions src/i18n/locales/bs/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "Neprikladno / Neposredno",
"value": "offensive"
},
{
"id": "bad2",
"label": "Nepravilno faktično",
Expand All @@ -32,5 +27,17 @@
"label": "Drugo",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "Neprikladno / Neposredno",
"value": "offensive"
},
{
"id": "redflag2",
"label": "Drugo",
"value": "other"
}
]
}
}
17 changes: 12 additions & 5 deletions src/i18n/locales/en/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "Offensive / Unsafe",
"value": "offensive"
},
{
"id": "bad2",
"label": "Not factually correct",
Expand All @@ -32,5 +27,17 @@
"label": "Other",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "Offensive / Unsafe",
"value": "offensive"
},
{
"id": "redflag2",
"label": "Other",
"value": "other"
}
]
}
19 changes: 13 additions & 6 deletions src/i18n/locales/fr/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "Offensif / Dangereux",
"value": "offensive"
},
{
"id": "bad2",
"label": "Pas exactement correct",
Expand All @@ -32,5 +27,17 @@
"label": "Autre",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "Offensif / Dangereux",
"value": "offensive"
},
{
"id": "redflag2",
"label": "Autre",
"value": "other"
}
]
}
}
19 changes: 13 additions & 6 deletions src/i18n/locales/id/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "Kasar / Tidak aman",
"value": "offensive"
},
{
"id": "bad2",
"label": "Tidak benar fakta",
Expand All @@ -32,5 +27,17 @@
"label": "Lainnya",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "Kasar / Tidak aman",
"value": "offensive"
},
{
"id": "redflag2",
"label": "Lainnya",
"value": "other"
}
]
}
}
17 changes: 12 additions & 5 deletions src/i18n/locales/tml/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "அவமதிப்பான/மனத்தை புண்படுத்துகிற/பாதுகாப்பற்ற தகவல் ",
"value": "offensive"
},
{
"id": "bad2",
"label": "உண்மையற்றது/தவறான தகவல்",
Expand All @@ -32,5 +27,17 @@
"label": "தவறான தகவல்",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "அவமதிப்பான/மனத்தை புண்படுத்துகிற/பாதுகாப்பற்ற தகவல் ",
"value": "offensive"
},
{
"id": "redflag2",
"label": "தவறான தகவல்",
"value": "other"
}
]
}
19 changes: 13 additions & 6 deletions src/i18n/locales/tur/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "Saldırgan / Tehlikeli",
"value": "offensive"
},
{
"id": "bad2",
"label": "Tamamen Doğru Değil",
Expand All @@ -32,5 +27,17 @@
"label": "Diğer",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "Saldırgan / Tehlikeli",
"value": "offensive"
},
{
"id": "redflag2",
"label": "Diğer",
"value": "other"
}
]
}
}
19 changes: 13 additions & 6 deletions src/i18n/locales/ur/feedback.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
}
],
"bad": [
{
"id": "bad1",
"label": "توہین آمیز / نا محفوظ",
"value": "offensive"
},
{
"id": "bad2",
"label": "حقائقی طور پر غلط",
Expand All @@ -32,5 +27,17 @@
"label": "دیگر",
"value": "other"
}
],
"redflag": [
{
"id": "redflag1",
"label": "توہین آمیز / نا محفوظ",
"value": "offensive"
},
{
"id": "redflag2",
"label": "دیگر",
"value": "other"
}
]
}
}
1 change: 1 addition & 0 deletions src/services/FeedbackService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type Feedback = {
export type FeedbacksByCategory = {
good: Feedback[]
bad: Feedback[]
redflag: Feedback[]
[key: string]: Feedback[]
}

Expand Down