From 499a25ddcbda2051a2084897dcafb367aa95ba08 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 3 Sep 2024 23:17:50 -0700 Subject: [PATCH 1/7] Add collective moderation to mobile --- ios/Podfile.lock | 10 + locales/en.json | 34 ++- locales/es.json | 34 ++- package.json | 1 + .../FlagGroupContent/FlagGroupContent.js | 257 ++++++++++++++++++ src/components/FlagGroupContent/index.js | 3 + .../ImageAttachments/ImageAttachments.js | 1 + .../ModerationList/ModerationList.js | 120 ++++++++ src/components/ModerationList/index.js | 3 + .../ModerationListItem/ModerationListItem.js | 210 ++++++++++++++ src/components/ModerationListItem/index.js | 3 + src/components/MultiSelect/MultiSelect.js | 103 +++++++ src/components/MultiSelect/index.js | 3 + src/components/PostCard/PostBody/PostBody.js | 10 +- .../PostBodyProposal/PostBodyProposal.js | 3 +- src/components/PostCard/PostCard.js | 24 +- src/components/PostCard/PostCard.styles.js | 39 ++- src/components/PostCard/PostCardForDetails.js | 20 +- .../PostCard/PostHeader/PostHeader.js | 30 +- .../PostCard/PostHeader/PostHeader.styles.js | 7 +- src/components/PostListRow/PostListRow.js | 247 +++++++++++++++++ src/components/PostListRow/index.js | 3 + src/components/StreamList/PostRow/PostRow.js | 1 + src/components/StreamList/StreamList.js | 14 +- src/graphql/fragments/postFieldsFragment.js | 2 + src/graphql/queries/MeQuery.js | 8 + src/navigation/AuthRootNavigator.js | 2 + src/navigation/HomeNavigator.js | 4 +- src/navigation/linking/index.js | 1 + .../GroupNavigation/GroupNavigation.js | 6 + src/screens/PostDetails/PostDetails.js | 1 + src/screens/Stream/Stream.js | 69 +++-- src/store/actions/fetchPlatformAgreements.js | 20 ++ src/store/actions/moderationActions.js | 132 +++++++++ src/store/constants.js | 8 + src/store/models/ModerationAction.js | 19 ++ src/store/models/PlatformAgreement.js | 17 ++ src/store/models/index.js | 4 + src/store/presenters/presentPost.js | 1 + src/store/reducers/ormReducer/index.js | 33 ++- src/store/selectors/getModerationActions.js | 24 ++ src/store/selectors/getPlatformAgreements.js | 11 + src/style/colors.js | 3 + yarn.lock | 15 + 44 files changed, 1517 insertions(+), 43 deletions(-) create mode 100644 src/components/FlagGroupContent/FlagGroupContent.js create mode 100644 src/components/FlagGroupContent/index.js create mode 100644 src/components/ModerationList/ModerationList.js create mode 100644 src/components/ModerationList/index.js create mode 100644 src/components/ModerationListItem/ModerationListItem.js create mode 100644 src/components/ModerationListItem/index.js create mode 100644 src/components/MultiSelect/MultiSelect.js create mode 100644 src/components/MultiSelect/index.js create mode 100644 src/components/PostListRow/PostListRow.js create mode 100644 src/components/PostListRow/index.js create mode 100644 src/store/actions/fetchPlatformAgreements.js create mode 100644 src/store/actions/moderationActions.js create mode 100644 src/store/models/ModerationAction.js create mode 100644 src/store/models/PlatformAgreement.js create mode 100644 src/store/selectors/getModerationActions.js create mode 100644 src/store/selectors/getPlatformAgreements.js diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2a1cc6b9b..77ae7f6df 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -5,6 +5,7 @@ PODS: - AppAuth/Core (1.7.5) - AppAuth/ExternalUserAgent (1.7.5): - AppAuth/Core + - BEMCheckBox (1.4.1) - boost (1.83.0) - BVLinearGradient (2.8.3): - React-Core @@ -1317,6 +1318,9 @@ PODS: - React-Core - RNCAsyncStorage (1.24.0): - React-Core + - RNCCheckbox (0.5.17): + - BEMCheckBox (~> 1.4) + - React-Core - RNCClipboard (1.14.1): - React-Core - RNCPicker (2.7.7): @@ -1490,6 +1494,7 @@ DEPENDENCIES: - "RNAppleAuthentication (from `../node_modules/@invertase/react-native-apple-authentication`)" - RNBootSplash (from `../node_modules/react-native-bootsplash`) - "RNCAsyncStorage (from `../node_modules/@react-native-async-storage/async-storage`)" + - "RNCCheckbox (from `../node_modules/@react-native-community/checkbox`)" - "RNCClipboard (from `../node_modules/@react-native-clipboard/clipboard`)" - "RNCPicker (from `../node_modules/@react-native-picker/picker`)" - RNDeviceInfo (from `../node_modules/react-native-device-info`) @@ -1507,6 +1512,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - AppAuth + - BEMCheckBox - GoogleSignIn - GTMAppAuth - GTMSessionFetcher @@ -1663,6 +1669,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-bootsplash" RNCAsyncStorage: :path: "../node_modules/@react-native-async-storage/async-storage" + RNCCheckbox: + :path: "../node_modules/@react-native-community/checkbox" RNCClipboard: :path: "../node_modules/@react-native-clipboard/clipboard" RNCPicker: @@ -1692,6 +1700,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa + BEMCheckBox: 5ba6e37ade3d3657b36caecc35c8b75c6c2b1a4e boost: d3f49c53809116a5d38da093a8aa78bf551aed09 BVLinearGradient: 880f91a7854faff2df62518f0281afb1c60d49a3 DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5 @@ -1770,6 +1779,7 @@ SPEC CHECKSUMS: RNAppleAuthentication: e99eaf3c4c01ad8ecb6125dd6f0cfd98871685b5 RNBootSplash: 7abfdb0e67dd2316dde619a54d5ef68b13e39b5f RNCAsyncStorage: ec53e44dc3e75b44aa2a9f37618a49c3bc080a7a + RNCCheckbox: a3ca9978cb0846b981d28da4e9914bd437403d77 RNCClipboard: 0a720adef5ec193aa0e3de24c3977222c7e52a37 RNCPicker: b7873ba797dc586bfaf3307d737cbdc620a9ff3e RNDeviceInfo: 59344c19152c4b2b32283005f9737c5c64b42fba diff --git a/locales/en.json b/locales/en.json index 61757ddc8..a3404b70b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1,10 +1,10 @@ { " (explanation required)": " (explanation required)", + "(Moderators will see your name)": "(Moderators will see your name)", "1 other": "1 other", "< Back": "< Back", "A link to reset your password has been sent to you at {{email}}": "A link to reset your password has been sent to you at {{email}}", "ABOUT ME": "ABOUT ME", - "announcementExplainer": "This means that all members of this group will receive an instant email and push notification about this Post. \n (This feature is available to stewards only.)", "Accept all agreements": "Accept all agreements", "Add Participant": "Add Participant", "Add a description": "Add a description", @@ -19,6 +19,8 @@ "An account may already exist for this email address, Login or try resetting your password": "An account may already exist for this email address, Login or try resetting your password", "Announcement?": "Announcement?", "Announcements": "Announcements", + "Anonymous": "Anonymous", + "Anonymous (moderators will see your name)": "Anonymous (moderators will see your name)", "Are you sure you want to block {{name}}?": "Are you sure you want to block {{name}}?", "Are you sure you want to delete this comment?": "Are you sure you want to delete this comment?", "Are you sure you want to delete this post?": "Are you sure you want to delete this post?", @@ -44,10 +46,12 @@ "Clear Search": "Clear Search", "Click on a user name or user the search bar": "Click on a user name or user the search bar", "Comments": "Comments", + "Complaint": "Complaint", "Confirm Delete": "Confirm Delete", "Confirm Password": "Confirm Password", "Confirm Removal": "Confirm Removal", "Contact your coordinator for another one": "Contact your coordinator for another one", + "Contents obscured": "Contents obscured", "Continue": "Continue", "Continue Editing": "Continue Editing", "Contribute": "Contribute", @@ -58,6 +62,7 @@ "Create": "Create", "Create a post": "Create a post", "Current Selection": "Current Selection", + "Decisions": "Decisions", "Delete": "Delete", "Deleted User": "Deleted User", "Description": "Description", @@ -82,6 +87,7 @@ "Exit": "Exit", "Exit this Group & Return Home": "Exit this Group & Return Home", "Expired or invalid code": "Expired or invalid code", + "Explanation for Flagging": "Explanation for Flagging", "Explore": "Explore", "FLAG THIS": "FLAG THIS", "Files": "Files", @@ -91,9 +97,11 @@ "Forgot your password?": "Forgot your password?", "Go Back": "Go Back", "Going": "Going", + "Governance": "Governance", "Group": "Group", - "Group_plural": "Groups", + "Group Agreements broken": "Group Agreements broken", "Group Purpose": "Group Purpose", + "Group_plural": "Groups", "Groups": "Groups", "Hi {{firstName}}, press here to post": "Hi {{firstName}}, press here", "Hi {{firstName}}, want to create an event?": "Hi {{firstName}}, want to create an event?", @@ -122,12 +130,13 @@ "Lets Do This!": "Let's Do This!", "Lets do this!": "Let's do this!", "Lets get started!": "Let's get started!", + "Link to group agreements": "Link to group agreements", + "Link to platform agreements": "Link to platform agreements", "Location": "Location", "Log In": "Log In", "Log in now": "Log in now", "Log in to Hylo": "Log in to Hylo", "Logout": "Logout", - "makeAnAnnouncement": "MAKE AN ANNOUNCEMENT", "MY SKILLS": "MY SKILLS", "Make Public": "Make Public:", "Manage Notifications": "Manage Notifications", @@ -141,6 +150,7 @@ "Membership Requested": "Membership Requested", "Mentions": "Mentions", "Missing message recipient!": "Missing message recipient!", + "Moderation": "Moderation", "Moderator: Confirm Delete": "Moderator: Confirm Delete", "Multiple people are typing": "Multiple people are typing...", "My Home": "My Home", @@ -158,6 +168,9 @@ "No topics match your search": "No topics match your search", "Not Going": "Not Going", "Not a Member": "Not a Member", + "Not permitted anywhere on the platform": "Not permitted anywhere on the platform", + "Not permitted in Public Spaces": "Not permitted in Public Spaces", + "Not permitted in {{groupName}}": "Not permitted in {{groupName}}", "Nothing new for you!": "Nothing new for you!", "Notifications": "Notifications", "Offensive": "Offensive", @@ -180,12 +193,14 @@ "People": "People", "Pick a Topic": "Pick a Topic", "Pin": "Pin", + "Platform Agreements broken": "Platform Agreements broken", "Please answer all the join questions to continue": "Please answer all the join questions to continue", "Please select below:": "Please select below:", "Popular": "Popular", "Post": "Post", "Post Date": "Post Date", "Post In": "Post In", + "Post flagged": "- Post flagged -", "Post in Groups": "Post in Groups", "Posted In": "Posted In:", "Posts": "Posts", @@ -209,6 +224,8 @@ "Remove image": "Remove image", "Reply": "Reply", "Replying to": "Replying to", + "Reported by": "Reported by", + "Reported content": "Reported content", "Request": "Request", "Requests": "Requests", "Resend code": "Resend code", @@ -231,6 +248,7 @@ "Settings": "Settings", "Share": "Share", "Short Description": "Short Description", + "Show more": "Show more", "Sign in with Google": "Sign in with Google", "Sign up now": "Sign up now", "Sign up with Google": "Sign up with Google", @@ -264,8 +282,10 @@ "Upcoming Events": "Upcoming Events", "Upload a Photo": "Upload a Photo", "Upvotes": "Upvotes", + "View post": "View post", "View project management tool": "View project management tool", "View tasks": "View tasks", + "Violations of platform agreements": "Violations of platform agreements", "Voting ended": "Voting ended", "Voting open": "Voting open", "Welcome to": "Welcome to", @@ -279,6 +299,7 @@ "What is your event called?": "What is your event called?", "What is your proposal?": "What is your proposal?", "What resource is available?": "What resource is available?", + "What was wrong?": "What was wrong?", "What would you like to call your project?": "What would you like to call your project?", "Whats the URL of your group?": "What's the URL of your group?", "Whats the address for your group": "What's the address for your group?", @@ -306,22 +327,27 @@ "Your data is safe with Hylo By clicking the Sign Up button above you are agreeing to these terms:": "Your data is safe with Hylo. By clicking the \"Sign Up\" button above you are agreeing to these terms:", "Your purpose statement is a concise summary of why your group": "Your purpose statement is a concise summary of why your group exists and what you hope to accomplish. A clear and specific purpose helps align members of your group to coordinate effectively to achieve your goals.", "and": "and", + "announcementExplainer": "This means that all members of this group will receive an instant email and push notification about this Post. \n (This feature is available to stewards only.)", "are a member": "are a member", "are attending": "are attending", "are members": "are members", "attending": "attending", "by": "by", "characters max": "characters max", + "clickthroughExplainer": "This post may not align with group or platform agreements.", "comment": "comment", "commented": "commented", "discussion": "discussion", "edit": "edit", "event": "event", + "flaggingExplainer": "Reporting a post will blur it for all group members. Members will be able to see the report and its details. Moderators can clear reports or take other actions if necessary.", + "flagsNeedACategory": "All reports need to be linked to at least one agreement (group or platform)", "forgotPasswordDescription": "Enter your email address below and we'll send you an \n email message with a link for resetting your password.", "is a member": "is a member", "is attending": "is attending", "is typing": "is typing", "loading": "loading", + "makeAnAnnouncement": "MAKE AN ANNOUNCEMENT", "manyCommentersInTheFooter": "{{firstPerson}}, {{secondPerson}} and {{count}} other", "manyCommentersInTheFooter_plural": "{{firstPerson}}, {{secondPerson}} and {{count}} others", "offer": "offer", @@ -336,6 +362,8 @@ "shareDialogTitle": "Share \"{{title}}\" by {{name}}", "shareMessage": "\"{{title}}\" by {{name}} on hylo.com: {{url}}", "shareSubject": "\"{{title}}\" by {{name}} on hylo.com", + "status-active": "Status: Active", + "status-cleared": "Status: Cleared by Moderator", "we just need to know your name and password and youre account will be created": "we just need to know your name and password and you're account will be created", "welcome page backup text": "Please take a moment to explore and see what’s alive in our group. \n \n Introduce yourself by clicking Create, and posting a Discussion to share who you are and what you brings you here. \n \n Don’t forget to fill our your profile, so likeminded folks can connect with you", "{{childGroupsLength}} Group(s) are a part of {{currentGroupName}}": "{{childGroupsLength}} Group(s) are a part of {{currentGroupName}}", diff --git a/locales/es.json b/locales/es.json index c65a59598..5923e0bfb 100644 --- a/locales/es.json +++ b/locales/es.json @@ -1,10 +1,10 @@ { " (explanation required)": "(explicación requerida)", + "(Moderators will see your name)": "(Los moderadores verán tu nombre)", "1 other": "1 más", "< Back": "< Atrás", "A link to reset your password has been sent to you at {{email}}": "Se le ha enviado un enlace para restablecer su contraseña a {{email}}", "ABOUT ME": "ACERCA DE MÍ", - "announcementExplainer": "Esto significa que todos los miembros de este grupo recibirán un correo electrónico instantáneo y una notificación automática sobre esta publicación.\n \n(Esta función está disponible solo para moderadores).", "Accept all agreements": "Aceptar todos los acuerdos", "Add Participant": "Añada participante", "Add a description": "Agregar una descripción", @@ -19,6 +19,8 @@ "An account may already exist for this email address, Login or try resetting your password": "Es posible que ya exista una cuenta para esta dirección de correo electrónico. Inicie sesión o intente restablecer su contraseña.", "Announcement?": "¿Anuncio?", "Announcements": "Anuncios", + "Anonymous": "Anónimo", + "Anonymous (moderators will see your name)": "Anónimo (los moderadores verán tu nombre)", "Are you sure you want to block {{name}}?": "¿Estás seguro de que quieres bloquear a {{name}}?", "Are you sure you want to delete this comment?": "¿Estás seguro de que quieres eliminar este comentario?", "Are you sure you want to delete this post?": "¿Estás seguro de que deseas eliminar esta publicación?", @@ -44,10 +46,12 @@ "Clear Search": "Borrar búsqueda", "Click on a user name or user the search bar": "Haga clic en un nombre de usuario o usuario en la barra de búsqueda.", "Comments": "Comentarios", + "Complaint": "Queja", "Confirm Delete": "Confirmar eliminación", "Confirm Password": "confirmar Contraseña", "Confirm Removal": "Confirmar eliminación", "Contact your coordinator for another one": "Contacta a tu moderador para otro", + "Contents obscured": "Contenidos oscurecidos", "Continue": "Continuar", "Continue Editing": "Continua editando", "Contribute": "Contribuir", @@ -58,6 +62,7 @@ "Create": "Crear", "Create a post": "Crear una publicación", "Current Selection": "Selección actual", + "Decisions": "Decisiones", "Delete": "Eliminar", "Deleted User": "Usuario eliminado", "Description": "Descripción", @@ -82,6 +87,7 @@ "Exit": "Salida", "Exit this Group & Return Home": "Salir de este grupo", "Expired or invalid code": "Código caducado o no válido", + "Explanation for Flagging": "Explicación para marcar", "Explore": "Explorar", "FLAG THIS": "MARCAR ESTO", "Files": "Archivos", @@ -91,9 +97,11 @@ "Forgot your password?": "¿Olvidaste tu contraseña?", "Go Back": "Regresa", "Going": "Yendo", + "Governance": "Gobernancia", "Group": "Grupo", - "Group_plural": "Grupos", + "Group Agreements broken": "Acuerdos de grupo rotos", "Group Purpose": "Propósito del grupo", + "Group_plural": "Grupos", "Groups": "Grupos", "Hi {{firstName}}, press here to post": "Hola {{firstName}}, presiona aquí", "Hi {{firstName}}, want to create an event?": "Hola {{firstName}}, ¿quieres crear un evento?", @@ -122,12 +130,13 @@ "Lets Do This!": "¡Hagámoslo!", "Lets do this!": "¡Hagámoslo!", "Lets get started!": "¡Empecemos!", + "Link to group agreements": "Enlace a acuerdos de grupo", + "Link to platform agreements": "Enlace a acuerdos de plataforma", "Location": "Ubicación", "Log In": "Acceso", "Log in now": "Inicia sesión ahora", "Log in to Hylo": "Iniciar sesión en Hylo", "Logout": "Cerrar sesión", - "makeAnAnnouncement": "HACER UN ANUNCIO", "MY SKILLS": "MIS HABILIDADES", "Make Public": "Hacer Público:", "Manage Notifications": "Administrar notificaciones", @@ -141,6 +150,7 @@ "Membership Requested": "Membresía solicitada", "Mentions": "Menciones", "Missing message recipient!": "¡Falta destinatario del mensaje!", + "Moderation": "Moderación", "Moderator: Confirm Delete": "Moderador: Confirmar eliminación", "Multiple people are typing": "Varias personas están escribiendo...", "My Home": "Mi hogar", @@ -158,6 +168,9 @@ "No topics match your search": "Ningún tema coincide con tu búsqueda", "Not Going": "No voy", "Not a Member": "No es un miembro", + "Not permitted anywhere on the platform": "No permitido en ningún lugar de la plataforma.", + "Not permitted in Public Spaces": "No permitido en espacios públicos.", + "Not permitted in {{groupName}}": "No permitido en {{groupName}}", "Nothing new for you!": "¡Nada nuevo para ti!", "Notifications": "Notificaciones", "Offensive": "Ofensivo", @@ -180,12 +193,14 @@ "People": "Gente", "Pick a Topic": "Elige un tema", "Pin": "Alfiler", + "Platform Agreements broken": "Acuerdos de plataforma rotos", "Please answer all the join questions to continue": "Por favor responda todas las preguntas sobre cómo unirse para continuar.", "Please select below:": "Por favor seleccione a continuación:", "Popular": "Popular", "Post": "Publicacion", "Post Date": "Fecha de publicación", "Post In": "Publicar", + "Post flagged": "- Publicación marcada -", "Post in Groups": "Publicar en grupos", "Posted In": "Publicado en:", "Posts": "Publicaciones", @@ -209,6 +224,8 @@ "Remove image": "Quita la imagen", "Reply": "Responder", "Replying to": "Respondiendo a", + "Reported by": "Reportado por", + "Reported content": "Contenido reportado", "Request": "Pedido", "Requests": "Peticiones", "Resend code": "Reenviar codigo", @@ -231,6 +248,7 @@ "Settings": "Ajustes", "Share": "Compartir", "Short Description": "Breve descripción", + "Show more": "Mostrar más", "Sign in with Google": "Inicia sesión con Google", "Sign up now": "Regístrate ahora", "Sign up with Google": "Regístrate con Google", @@ -264,8 +282,10 @@ "Upcoming Events": "Próximos Eventos", "Upload a Photo": "Sube una foto", "Upvotes": "Votos a favor", + "View post": "Ver publicación", "View project management tool": "Ver herramienta de gestión de proyectos", "View tasks": "Ver tareas", + "Violations of platform agreements": "Violaciones de acuerdos de plataforma.", "Voting ended": "La votación terminó", "Voting open": "Votación abierta", "Welcome to": "Bienvenido a", @@ -279,6 +299,7 @@ "What is your event called?": "¿Cómo se llama tu evento?", "What is your proposal?": "Cual es tu propuesta?", "What resource is available?": "¿Qué recurso está disponible?", + "What was wrong?": "¿Qué pasó?", "What would you like to call your project?": "¿Cómo te gustaría llamar tu proyecto?", "Whats the URL of your group?": "¿Cuál es la URL de tu grupo?", "Whats the address for your group": "¿Cuál es la dirección de su grupo?", @@ -306,22 +327,27 @@ "Your data is safe with Hylo By clicking the Sign Up button above you are agreeing to these terms:": "Tus datos están seguros con Hylo. Al hacer clic en el botón \"Registrarse\" arriba, acepta estos términos:", "Your purpose statement is a concise summary of why your group": "Su declaración de propósito es un resumen conciso de por qué existe su grupo y qué espera lograr. \nUn propósito claro y específico ayuda a alinear a los miembros de su grupo para coordinarse de manera efectiva y lograr sus objetivos.", "and": "y", + "announcementExplainer": "Esto significa que todos los miembros de este grupo recibirán un correo electrónico instantáneo y una notificación automática sobre esta publicación.\n \n(Esta función está disponible solo para moderadores).", "are a member": "eres miembro", "are attending": "estan asistiendo", "are members": "son miembros", "attending": "asistiendo", "by": "por", "characters max": "caracteres máximo", + "clickthroughExplainer": "Es posible que esta publicación no se ajuste a los acuerdos del grupo o la plataforma.", "comment": "comentario", "commented": "comentó", "discussion": "discusión", "edit": "editar", "event": "evento", + "flaggingExplainer": "Informar una publicación la borrará para todos los miembros del grupo. \nLos miembros podrán ver el informe y sus detalles. \nLos moderadores pueden borrar informes o tomar otras acciones si es necesario.", + "flagsNeedACategory": "Todos los informes deben estar vinculados al menos a un acuerdo (grupo o plataforma)", "forgotPasswordDescription": "Ingrese su dirección de correo electrónico a continuación y \n le enviaremos un mensaje de correo electrónico con un enlace para restablecer su contraseña.", "is a member": "es miembro", "is attending": "asiste", "is typing": "esta escribiendo", "loading": "cargando", + "makeAnAnnouncement": "HACER UN ANUNCIO", "manyCommentersInTheFooter": "{{firstPerson}}, {{secondPerson}} y {{count}} otro", "manyCommentersInTheFooter_plural": "{{firstPerson}}, {{secondPerson}} y {{count}} otros", "offer": "oferta", @@ -336,6 +362,8 @@ "shareDialogTitle": "Compartir \"{{title}}\" por {{name}}", "shareMessage": "\"{{title}}\" de {{name}} en hylo.com: {{url}}", "shareSubject": "\"{{title}}\" de {{name}} en hylo.com", + "status-active": "Estado: Activo", + "status-cleared": "Estado: Borrado por el moderador", "we just need to know your name and password and youre account will be created": "sólo necesitamos saber su nombre y contraseña y se creará su cuenta", "welcome page backup text": "Tómese un momento para explorar y ver qué hay vivo en nuestro grupo.\n \n Preséntate haciendo clic en Crear y publicando una discusión para compartir quién eres y qué te trae aquí.\n \n No olvide completar nuestro perfil para que personas con ideas afines puedan conectarse con usted.", "{{childGroupsLength}} Group(s) are a part of {{currentGroupName}}": "Los grupos {{childGroupsLength}} son parte de {{currentGroupName}}", diff --git a/package.json b/package.json index 1673d2980..c5873ac6d 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@native-html/iframe-plugin": "^2.6.1", "@react-native-async-storage/async-storage": "^1.24.0", "@react-native-clipboard/clipboard": "^1.14.1", + "@react-native-community/checkbox": "^0.5.17", "@react-native-community/hooks": "^2.8.0", "@react-native-google-signin/google-signin": "^8.0.1", "@react-native-picker/picker": "^2.7.7", diff --git a/src/components/FlagGroupContent/FlagGroupContent.js b/src/components/FlagGroupContent/FlagGroupContent.js new file mode 100644 index 000000000..6d68aa284 --- /dev/null +++ b/src/components/FlagGroupContent/FlagGroupContent.js @@ -0,0 +1,257 @@ +import React, { useState } from 'react' +import { View, Text, TouchableOpacity, ScrollView, Linking, Modal, TextInput } from 'react-native' +import { regentGray, mangoOrange } from 'style/colors' +import { useDispatch, useSelector } from 'react-redux' +import { useTranslation } from 'react-i18next' +import Icon from 'components/Icon' +import Button from 'components/Button' +import CheckBox from '@react-native-community/checkbox' +import MultiSelect from 'components/MultiSelect/MultiSelect' +import { createModerationAction } from 'store/actions/moderationActions' +import getGroup from 'store/selectors/getGroup' +import { agreementsURL } from 'store/constants' +import presentGroup from 'store/presenters/presentGroup' +import getPlatformAgreements from 'store/selectors/getPlatformAgreements' +import { groupUrl } from 'util/navigation' +import { isEmpty } from 'lodash' + +const FlagGroupContent = ({ onClose, linkData, type = 'content' }) => { + const { t } = useTranslation() + const dispatch = useDispatch() + const { id, slug } = linkData || {} + + const platformAgreements = useSelector(getPlatformAgreements) + const currentGroup = useSelector(state => getGroup(state, { slug })) + console.log(currentGroup, 'jjahahahahahahggggg', Object.keys(currentGroup)) + const group = presentGroup(currentGroup) + + const agreements = group?.agreements || [] + const groupAgreementsUrl = group ? groupUrl(group.slug) + `/group/${group.slug}` : '' + const [anonymous, setAnonymous] = useState(false) + const [explanation, setExplanation] = useState('') + const [subtitle, setSubtitle] = useState(t('What was wrong?')) + const [agreementsSelected, setAgreementsSelected] = useState([]) + const [platformAgreementsSelected, setPlatformAgreementsSelected] = useState([]) + + const isValid = () => { + if (isEmpty(agreementsSelected) && isEmpty(platformAgreementsSelected)) return false + if (explanation.length < 5) return false + return true + } + + const closeModal = () => { + if (onClose) { + onClose() + } + } + + const handleAgreementsSelect = (selected) => { + if (agreementsSelected.includes(selected)) { + setAgreementsSelected(agreementsSelected.filter(ag => ag !== selected)) + } else { + setAgreementsSelected([...agreementsSelected, selected]) + } + } + + const handlePlatformAgreementsSelect = (selected) => { + if (platformAgreementsSelected.includes(selected)) { + setPlatformAgreementsSelected(platformAgreementsSelected.filter(ag => ag !== selected)) + } else { + setPlatformAgreementsSelected([...platformAgreementsSelected, selected]) + } + } + + const submit = () => { + dispatch(createModerationAction({ text: explanation, postId: id, groupId: group.id, agreements: agreementsSelected, platformAgreements: platformAgreementsSelected, anonymous })) + closeModal() + return true + } + + return ( + + + + + {t('Explanation for Flagging')} + + + + + + {t('flaggingExplainer')} + {t('flagsNeedACategory')} + + + + {group && agreements.length > 0 && ( + <> + {t('Not permitted in {{groupName}}', { groupName: group?.name })} + Linking.openURL(groupAgreementsUrl)}> + {t('Link to group agreements')} + + + + )} + + {t('Violations of platform agreements')} + Linking.openURL(agreementsURL)}> + {t('Link to platform agreements')} + + + {t('Not permitted in Public Spaces')} + ag.type !== 'anywhere')} + selected={platformAgreementsSelected} + handleSelect={handlePlatformAgreementsSelect} + /> + + {t('Not permitted anywhere on the platform')} + ag.type === 'anywhere')} + selected={platformAgreementsSelected} + handleSelect={handlePlatformAgreementsSelect} + /> + + + + setAnonymous(value)} + labelStyle={styles.anonLabel} + /> + {t('Anonymous')} + + {t('(Moderators will see your name)')} +