Repository navigation
fix: allow retrying/deleting stuck (TEMP) messages #7560
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
Changes from all commits
fa971de
92b5904
c413fbb
a97b15e
e6e2266
61c64a3
b60577d
0974bbe
e08ad19
b1a62b5
2779f74
2b5c53e
0d364fb
5ce5b22
b5e1825
331a202
7fdf2dc
34a0bc5
7442f2c
2629140
74418fe
27dbe0d
e946128
88fa0fc
a2ab4d3
298b779
4d62874
76c4ce7
522c9da
151d92e
f533181
9a0ac50
cba1ca8
b11a292
b5e0aff
f3fae09
05984d0
743c1cb
7acaf5d
f6bbacb
2b58039
1f0af92
303bdd3
5992129
871cad4
7e9bcf1
5232fef
0825ed7
ff1722b
9218cec
0ca4d4b
2369dc4
7a8827d
1e24e77
7d3369f
46f5c1b
e58dfd4
ac9f939
fa56778
52a9336
ab29723
218ca5c
fa2c7f9
d30152d
024be32
5338bf5
20c981a
bad7b85
6b27209
2f7f4e3
34c6e29
24f9750
9e0364b
813fc64
a2eb8db
6792a6e
c6314ea
275c3a9
1b2f757
79ae2a5
acbd950
bbe524e
8ca06bd
8f6e5c9
501d0a4
0b39140
0fd01b1
9bc6991
5891366
3811a40
3f5d92c
3ae82fe
f34b5b5
9cf6981
27e9171
6a94315
5db534f
0b08874
93d8cc6
aef355c
ac9e568
b93504d
82acdb5
3de4e22
0f82611
f883a91
69062ff
26ca0d0
da5e06f
c5e1b9e
88ec8ef
acdfc6d
0b278f0
fd81c46
aa60ea2
3bc1cb9
4ffaefb
df2960d
83b09fd
a0bd495
71a780f
d643f13
e32b37c
3943876
ad8bef1
360bc7a
2845166
c842eaf
28db99f
6f07ebb
3bcbfb8
9e5ad53
1016ed4
8502e4a
5f34072
ddc0766
82e06e8
fe191f8
8d2be36
160858b
580254a
68a4d49
417d2a8
90083ad
a277369
c0c57ed
945a0b3
89b87a3
af8233d
1d568c9
087c8d2
d600f1f
d3e0992
3a10163
233b858
6965551
e742288
d34ff3d
d1867f5
04fa983
9867aa6
29577e8
9abba83
a4a9456
9191d47
031fa61
7ccd562
dd87847
f1c4e1d
b05bfc1
8677bd7
4275a8d
1119492
46bd9ae
cb57df3
8f22564
658b526
ff15e2b
b2d6b72
5eaeb47
deb8ea4
92ebf5e
bc47e13
b161e11
e3d46cb
006ecf1
8dfa17e
4ce3e9a
b8bb9c7
b58b2e6
07a33b6
c796e91
e700805
c975a7a
3a9ade9
0a2d11e
3c29677
bab3de5
ae9875d
53722ec
d858a24
c53294f
5f81d4d
a21a84e
1ca8b8c
30db414
2ec7001
df051b9
7111c4b
fd7c55f
0e5e5c8
357fcdb
ac1de22
022467c
df40672
246363f
1e73388
9c032d1
15217be
46a3b31
c34e462
2c803f1
f106f3c
a35becc
d52671a
b089e80
66a2b06
45c9899
25e2d07
9439677
b01b793
8fafbc4
9a472ea
0cde14c
76f5a7a
ab6a711
75e5164
a8dd1f8
66d94e6
fb12527
15ab0d6
f5f92ad
b755414
9010ce4
4fc7372
dc7a300
32579a6
a5fea7f
058daa2
2d92500
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,4 +165,3 @@ class NotificationIntentHandler { | |
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| jest.mock('expo-av', () => { | ||
| const Audio = { | ||
| playAsync: jest.fn(), | ||
| stopAsync: jest.fn(), | ||
| unloadAsync: jest.fn(), | ||
| setIsLoopingAsync: jest.fn(), | ||
| setPositionAsync: jest.fn(), | ||
| setVolumeAsync: jest.fn(), | ||
| getStatusAsync: jest.fn(() => Promise.resolve({})), | ||
| AndroidOutputFormat: { AAC_ADTS: 0, MPEG_4: 1, THREE_GPP: 2 }, | ||
| AndroidAudioEncoder: { AAC: 0, AMR_NB: 1 }, | ||
| IOSOutputFormat: { MPEG4AAC: 0 }, | ||
| IOSAudioEncoder: { AAC: 0 }, | ||
| IOSAudioQuality: { LOW: 0, MEDIUM: 1, HIGH: 2 }, | ||
| RecordingOptionsPresets: { | ||
| LOW_QUALITY: { | ||
| android: { sampleRate: 8000, numberOfChannels: 1, bitRate: 128000 }, | ||
| ios: { sampleRate: 8000, numberOfChannels: 1, bitRate: 128000 } | ||
| }, | ||
| HIGH_QUALITY: { | ||
| android: { sampleRate: 44100, numberOfChannels: 2, bitRate: 256000 }, | ||
| ios: { sampleRate: 44100, numberOfChannels: 2, bitRate: 256000 } | ||
| } | ||
| } | ||
| }; | ||
| return { | ||
| Audio, | ||
| Sound: class { | ||
| loadAsync = jest.fn(); | ||
| playAsync = jest.fn(); | ||
| unloadAsync = jest.fn(); | ||
| }, | ||
| InterruptionModeIOS: { MixWithOthers: 0, DoNotMix: 1 }, | ||
| InterruptionModeAndroid: { MixWithOthers: 0, DoNotMix: 1 }, | ||
| requestPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted', granted: true, canAskAgain: true })), | ||
| getPermissionsAsync: jest.fn(() => Promise.resolve({ status: 'granted', granted: true, canAskAgain: true })) | ||
| }; | ||
| }); | ||
|
|
||
| import { MessageContainer } from './index'; | ||
| import { messagesStatus } from '../../lib/constants/messagesStatus'; | ||
|
Comment on lines
+40
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)app/containers/message/index.test.tsx$|(^|/)package.json$|(^|/).oxlintrc.json$|jest|babel|metro|babel.config'
echo "== test file outline/lines =="
if [ -f app/containers/message/index.test.tsx ]; then
wc -l app/containers/message/index.test.tsx
sed -n '1,120p' app/containers/message/index.test.tsx | cat -n
fi
echo "== oxlint config =="
if [ -f .oxlintrc.json ]; then
cat -n .oxlintrc.json
fi
echo "== relevant transform/mocking files =="
for f in \
package.json \
metro.config.js \
babel.config.js \
babel.config.ts \
.babelrc \
jest.config.js \
jest.config.ts \
app.config.js \
app.config.ts; do
if [ -f "$f" ]; then
echo "-- $f --"
sed -n '1,220p' "$f" | cat -n
fi
done
echo "== expo-av mock references =="
rg -n "expo-av|Audio|Sound|messagesStatus|jest.mock\\(" . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200Repository: RocketChat/Rocket.Chat.ReactNative Length of output: 33238 🌐 Web query:
💡 Result: The ESLint rule Citations:
Move the imports before
🧰 Tools🪛 ESLint[error] 40-40: Import in body of module; reorder to top. (import/first) [error] 41-41: Import in body of module; reorder to top. (import/first) 🤖 Prompt for AI AgentsSources: Coding guidelines, Linters/SAST tools |
||
|
|
||
| const makeMessage = (status: number) => | ||
| ({ | ||
| _id: 'msg1', | ||
| id: 'msg1', | ||
| rid: 'rid1', | ||
| msg: 'hello', | ||
| u: { _id: 'u1', username: 'user', name: 'User' }, | ||
| ts: 0, | ||
| status | ||
| } as any); | ||
|
|
||
| describe('Message.hasError', () => { | ||
| it('is true for ERROR status messages (retry/delete available)', () => { | ||
| const wrapper = new MessageContainer({ item: makeMessage(messagesStatus.ERROR) } as any); | ||
| expect(wrapper.hasError).toBe(true); | ||
| }); | ||
|
|
||
| it('is true for TEMP (stuck sending) status messages so they can be retried/deleted', () => { | ||
| const wrapper = new MessageContainer({ item: makeMessage(messagesStatus.TEMP) } as any); | ||
| expect(wrapper.hasError).toBe(true); | ||
| }); | ||
|
|
||
| it('is false for a successfully SENT message', () => { | ||
| const wrapper = new MessageContainer({ item: makeMessage(messagesStatus.SENT) } as any); | ||
| expect(wrapper.hasError).toBe(false); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: RocketChat/Rocket.Chat.ReactNative
Length of output: 6576
🏁 Script executed:
Repository: RocketChat/Rocket.Chat.ReactNative
Length of output: 10983
Keep the media-action dismissal delay Android-specific.
ActionsButtonis rendered from shared MessageComposer UI, so the unconditional 550 ms delays also run on iOS. Preserve the original 250 ms behavior on non-Android platforms and define a shared platform-specific delay constant for the three media callbacks.🤖 Prompt for AI Agents