From 031fa61dfb5f031421d48a9a1aecdccf691a08f3 Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Mon, 3 Jun 2024 10:20:38 -0400 Subject: [PATCH 1/7] regression: fix the threadId logic (#5715) --- app/views/ShareView/index.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/views/ShareView/index.tsx b/app/views/ShareView/index.tsx index bbe8c3e9f3..8a66192fc1 100644 --- a/app/views/ShareView/index.tsx +++ b/app/views/ShareView/index.tsx @@ -88,7 +88,7 @@ class ShareView extends Component { attachments: [], text: props.route.params?.text ?? '', room: props.route.params?.room ?? {}, - thread: props.route.params?.thread ?? '', + thread: props.route.params?.thread ?? {}, maxFileSize: this.isShareExtension ? this.serverInfo?.FileUpload_MaxFileSize : props.FileUpload_MaxFileSize, mediaAllowList: this.isShareExtension ? this.serverInfo?.FileUpload_MediaTypeWhiteList @@ -114,6 +114,16 @@ class ShareView extends Component { } }; + getThreadId = (thread: TThreadModel | string | undefined) => { + let threadId = undefined; + if (typeof thread === 'object') { + threadId = thread?.id; + } else if (typeof thread === 'string') { + threadId = thread; + } + return threadId; + }; + setHeader = () => { const { room, thread, readOnly, attachments } = this.state; const { navigation, theme } = this.props; @@ -265,7 +275,7 @@ class ShareView extends Component { store: 'Uploads', msg }, - (thread as TThreadModel)?.id || (thread as string), + this.getThreadId(thread), server, { id: user.id, token: user.token } ); @@ -276,7 +286,7 @@ class ShareView extends Component { // Send text message } else if (text.length) { - await sendMessage(room.rid, text, (thread as TThreadModel)?.id || (thread as string), { + await sendMessage(room.rid, text, this.getThreadId(thread), { id: user.id, token: user.token } as IUser); @@ -347,7 +357,7 @@ class ShareView extends Component { value={{ rid: room.rid, t: room.t, - tmid: (thread as TThreadModel)?.id || (thread as string), + tmid: this.getThreadId(thread), sharing: true, action: route.params?.action, selectedMessages, From 7ccd562888d26df978e4bd5abf90c905e0aff83d Mon Sep 17 00:00:00 2001 From: Alex Plekhov <33345177+Lao-Ax@users.noreply.github.com> Date: Mon, 3 Jun 2024 19:28:52 +0300 Subject: [PATCH 2/7] fix(i18n): correct Russian localization strings for user role updates (#5582) Fix errors in RU translation Co-authored-by: Diego Mello --- app/i18n/locales/ru.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/i18n/locales/ru.json b/app/i18n/locales/ru.json index f1f5f17417..6c2d619131 100644 --- a/app/i18n/locales/ru.json +++ b/app/i18n/locales/ru.json @@ -628,12 +628,12 @@ "Uploading": "Загрузка", "Use": "Использовать", "User": "Пользователь", - "User__username__is_now_a_leader_of__room_name_": "Пользователь {{username}} больше не лидер в чате {{room_name}}", - "User__username__is_now_a_moderator_of__room_name_": "Пользователь {{username}} больше не модератор в чате {{room_name}}", - "User__username__is_now_a_owner_of__room_name_": "Пользователь {{username}} больше не владелец в чате {{room_name}}", - "User__username__removed_from__room_name__leaders": "Пользователь {{username}} удален из {{room_name}} лидеров", - "User__username__removed_from__room_name__moderators": "Пользователь {{username}} удален из {{room_name}} модераторов", - "User__username__removed_from__room_name__owners": "Пользователь {{username}} удален из {{room_name}} владельцев", + "User__username__is_now_a_leader_of__room_name_": "Пользователь {{username}} теперь лидер в чате {{room_name}}", + "User__username__is_now_a_moderator_of__room_name_": "Пользователь {{username}} теперь модератор в чате {{room_name}}", + "User__username__is_now_a_owner_of__room_name_": "Пользователь {{username}} теперь владелец в чате {{room_name}}", + "User__username__removed_from__room_name__leaders": "Пользователь {{username}} удален из лидеров чата {{room_name}}", + "User__username__removed_from__room_name__moderators": "Пользователь {{username}} удален из модераторов чата {{room_name}}", + "User__username__removed_from__room_name__owners": "Пользователь {{username}} удален из владельцев чата {{room_name}}", "User_has_been_ignored": "Пользователь теперь игнорируется", "User_has_been_key": "Пользователь был {{key}}", "User_has_been_removed_from_s": "Пользователь удален из {{s}}", From dd87847065723b895fd53dab4767c5bd00e5a07b Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Mon, 3 Jun 2024 17:57:20 -0300 Subject: [PATCH 3/7] chore: Log event of server/token logout to help tracking bugs (#5716) --- app/lib/methods/helpers/log/events.ts | 2 ++ app/sagas/login.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/app/lib/methods/helpers/log/events.ts b/app/lib/methods/helpers/log/events.ts index ce6156223c..f028d0e41b 100644 --- a/app/lib/methods/helpers/log/events.ts +++ b/app/lib/methods/helpers/log/events.ts @@ -6,6 +6,8 @@ export default { // LOGIN VIEW LOGIN_DEFAULT_LOGIN: 'login_default_login', LOGIN_DEFAULT_LOGIN_F: 'login_default_login_f', + LOGOUT_BY_SERVER: 'logout_by_server', + LOGOUT_TOKEN_EXPIRED: 'logout_token_expired', // FORGOT PASSWORD VIEW FP_FORGOT_PASSWORD: 'fp_forgot_password', diff --git a/app/sagas/login.js b/app/sagas/login.js index 3dd84034b0..768a444d1d 100644 --- a/app/sagas/login.js +++ b/app/sagas/login.js @@ -122,8 +122,10 @@ const handleLoginRequest = function* handleLoginRequest({ } } catch (e) { if (e?.data?.message && /you've been logged out by the server/i.test(e.data.message)) { + logEvent(events.LOGOUT_BY_SERVER); yield put(logoutAction(true, 'Logged_out_by_server')); } else if (e?.data?.message && /your session has expired/i.test(e.data.message)) { + logEvent(events.LOGOUT_TOKEN_EXPIRED); yield put(logoutAction(true, 'Token_expired')); } else { logEvent(events.LOGIN_DEFAULT_LOGIN_F); From f1c4e1d82ebee09f0d2208bfcd53ae728e1e7166 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Tue, 4 Jun 2024 12:46:17 -0300 Subject: [PATCH 4/7] Bump version to 4.49.1 --- android/app/build.gradle | 2 +- ios/RocketChatRN.xcodeproj/project.pbxproj | 4 ++-- ios/RocketChatRN/Info.plist | 2 +- ios/ShareRocketChatRN/Info.plist | 2 +- package.json | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index cd60135257..689f44677d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -147,7 +147,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode VERSIONCODE as Integer - versionName "4.49.0" + versionName "4.49.1" vectorDrawables.useSupportLibrary = true if (!isFoss) { manifestPlaceholders = [BugsnagAPIKey: BugsnagAPIKey as String] diff --git a/ios/RocketChatRN.xcodeproj/project.pbxproj b/ios/RocketChatRN.xcodeproj/project.pbxproj index bb3e5f8350..d3aefa79f6 100644 --- a/ios/RocketChatRN.xcodeproj/project.pbxproj +++ b/ios/RocketChatRN.xcodeproj/project.pbxproj @@ -2910,7 +2910,7 @@ INFOPLIST_FILE = NotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 4.49.0; + MARKETING_VERSION = 4.49.1; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_DEBUG"; @@ -2950,7 +2950,7 @@ INFOPLIST_FILE = NotificationService/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 12.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"; - MARKETING_VERSION = 4.49.0; + MARKETING_VERSION = 4.49.1; MTL_FAST_MATH = YES; OTHER_SWIFT_FLAGS = "$(inherited) -D EXPO_CONFIGURATION_RELEASE"; PRODUCT_BUNDLE_IDENTIFIER = chat.rocket.reactnative.NotificationService; diff --git a/ios/RocketChatRN/Info.plist b/ios/RocketChatRN/Info.plist index e23b4bb69b..454f1fa6e8 100644 --- a/ios/RocketChatRN/Info.plist +++ b/ios/RocketChatRN/Info.plist @@ -26,7 +26,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 4.49.0 + 4.49.1 CFBundleSignature ???? CFBundleURLTypes diff --git a/ios/ShareRocketChatRN/Info.plist b/ios/ShareRocketChatRN/Info.plist index 776ca2a075..ac9590cff2 100644 --- a/ios/ShareRocketChatRN/Info.plist +++ b/ios/ShareRocketChatRN/Info.plist @@ -26,7 +26,7 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 4.49.0 + 4.49.1 CFBundleVersion 1 KeychainGroup diff --git a/package.json b/package.json index ae0d66ebf9..a83f939e68 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rocket-chat-reactnative", - "version": "4.49.0", + "version": "4.49.1", "private": true, "scripts": { "start": "react-native start", From b05bfc1f15217d38b7192dba3af5a2c06be3c6b2 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 5 Jun 2024 13:27:33 -0300 Subject: [PATCH 5/7] feat: Read messages on room close to prevent fetching already seen messages (#5723) --- app/lib/methods/subscriptions/room.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/lib/methods/subscriptions/room.ts b/app/lib/methods/subscriptions/room.ts index d38a84644c..7810258dbc 100644 --- a/app/lib/methods/subscriptions/room.ts +++ b/app/lib/methods/subscriptions/room.ts @@ -74,6 +74,7 @@ export default class RoomSubscription { unsubscribe = async () => { console.log(`[RCRN] Unsubscribing from room ${this.rid}`); + readMessages(this.rid, new Date(), true).catch(e => console.log(e)); this.isAlive = false; reduxStore.dispatch(unsubscribeRoom(this.rid)); if (this.promises) { From 8677bd7fd87894416ebc2be55de4d481d4323b0d Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Wed, 5 Jun 2024 13:27:29 -0400 Subject: [PATCH 6/7] feat: request password change (#5722) * feat: add ChangePasswordRequired container * chore: add support do multiple inputs on ActionSheetContentWithInputAndSubmit * chore: add requirePasswordChange definition * chore: add setUserPassword function for setting user password * fix: handle error message with optional chaining in showErrorAlertWithEMessage * chore: Update defaultSettings.ts with new account-related values * feat: add requirePasswordChange prop * feat: add ChangePasswordRequired component * chore: finish some implementations on requirePasswordChange * action: organized translations * fix lint * lint * test: add e2e * feat add pt-br * action: organized translations * fix lint * time * fix tests * improve key name * Update app/containers/ChangePasswordRequired.tsx Co-authored-by: Diego Mello --------- Co-authored-by: GleidsonDaniel Co-authored-by: Diego Mello --- .../index.tsx | 110 +++++++++++++----- app/containers/ChangePasswordRequired.tsx | 107 +++++++++++++++++ app/definitions/ILoggedUser.ts | 1 + app/i18n/locales/en.json | 5 + app/i18n/locales/pt-BR.json | 5 + app/lib/constants/defaultSettings.ts | 6 + app/lib/database/model/servers/User.js | 2 + app/lib/database/model/servers/migrations.js | 11 ++ app/lib/database/schema/servers.js | 5 +- app/lib/methods/helpers/info.ts | 2 +- app/lib/services/connect.ts | 3 +- app/lib/services/restApi.ts | 2 + app/sagas/login.js | 16 ++- app/sagas/selectServer.ts | 3 +- .../DeleteAccountActionSheetContent/index.tsx | 2 +- app/views/ProfileView/index.tsx | 13 +-- app/views/RoomsListView/index.tsx | 30 +++-- e2e/helpers/data_setup.ts | 5 +- e2e/tests/assorted/03-profile.spec.ts | 10 +- .../08-change-password-required.spec.ts | 63 ++++++++++ 20 files changed, 333 insertions(+), 68 deletions(-) create mode 100644 app/containers/ChangePasswordRequired.tsx create mode 100644 e2e/tests/onboarding/08-change-password-required.spec.ts diff --git a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx index 9003827a15..ae0f2c3bb2 100644 --- a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx +++ b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useRef } from 'react'; import { StyleSheet, Text, View } from 'react-native'; import { CustomIcon, TIconsName } from '../../CustomIcon'; @@ -42,22 +42,28 @@ const FooterButtons = ({ confirmTitle = '', disabled = false, cancelBackgroundColor = '', - confirmBackgroundColor = '' + confirmBackgroundColor = '', + testID = '' }): React.ReactElement => { const { colors } = useTheme(); return (