File tree Expand file tree Collapse file tree 6 files changed +39
-28
lines changed
Sources/StreamChat/WebSocketClient/EventMiddlewares
Tests/StreamChatTests/WebSocketClient/EventMiddlewares Expand file tree Collapse file tree 6 files changed +39
-28
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
6
## StreamChat
7
7
### 🐞 Fixed
8
8
- Fix swipe to reply enabled when quoting a message is disabled [ #3662 ] ( https://github.com/GetStream/stream-chat-swift/pull/3662 )
9
+ - Fix shadowed messages increasing the channel messages unread count [ #3665 ] ( https://github.com/GetStream/stream-chat-swift/pull/3665 )
9
10
10
11
# [ 4.78.0] ( https://github.com/GetStream/stream-chat-swift/releases/tag/4.78.0 )
11
12
_ April 24, 2025_
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
7
7
gem 'danger' , group : :danger_dependencies
8
8
gem 'fastlane' , group : :fastlane_dependencies
9
- gem 'jazzy'
10
9
gem 'json'
11
10
gem 'rubocop' , '1.38' , group : :rubocop_dependencies
12
11
gem 'sinatra' , group : :sinatra_dependencies
Original file line number Diff line number Diff line change 266
266
mutex_m
267
267
i18n (1.14.7 )
268
268
concurrent-ruby (~> 1.0 )
269
- jazzy (0.15.3 )
270
- cocoapods (~> 1.5 )
271
- mustache (~> 1.1 )
272
- open4 (~> 1.3 )
273
- redcarpet (~> 3.4 )
274
- rexml (>= 3.2.7 , < 4.0 )
275
- rouge (>= 2.0.6 , < 5.0 )
276
- sassc (~> 2.1 )
277
- sqlite3 (~> 1.3 )
278
- xcinvoke (~> 0.3.0 )
279
269
jmespath (1.6.2 )
280
270
json (2.11.3 )
281
271
jwt (2.10.1 )
284
274
rexml (>= 3.3.9 )
285
275
kramdown-parser-gfm (1.1.0 )
286
276
kramdown (~> 2.0 )
287
- liferaft (0.0.6 )
288
277
logger (1.7.0 )
289
278
method_source (1.1.0 )
290
279
mini_magick (4.13.2 )
294
283
molinillo (0.8.0 )
295
284
multi_json (1.15.0 )
296
285
multipart-post (2.4.1 )
297
- mustache (1.1.1 )
298
286
mustermann (3.0.3 )
299
287
ruby2_keywords (~> 0.0.1 )
300
288
mutex_m (0.3.0 )
@@ -329,20 +317,19 @@ GEM
329
317
puma (6.6.0 )
330
318
nio4r (~> 2.0 )
331
319
racc (1.8.1 )
332
- rack (3.1.13 )
320
+ rack (3.1.14 )
333
321
rack-protection (4.1.1 )
334
322
base64 (>= 0.1.0 )
335
323
logger (>= 1.6.0 )
336
324
rack (>= 3.0.0 , < 4 )
337
- rack-session (2.1.0 )
325
+ rack-session (2.1.1 )
338
326
base64 (>= 0.1.0 )
339
327
rack (>= 3.0.0 )
340
328
rackup (2.2.1 )
341
329
rack (>= 3 )
342
330
rainbow (3.1.1 )
343
331
rake (13.2.1 )
344
332
rchardet (1.9.0 )
345
- redcarpet (3.6.1 )
346
333
regexp_parser (2.10.0 )
347
334
representable (3.2.0 )
348
335
declarative (< 0.1.0 )
373
360
ruby-progressbar (1.13.0 )
374
361
ruby2_keywords (0.0.5 )
375
362
rubyzip (2.4.1 )
376
- sassc (2.4.0 )
377
- ffi (~> 1.9 )
378
363
sawyer (0.9.2 )
379
364
addressable (>= 2.3.5 )
380
365
faraday (>= 0.17.3 , < 3 )
402
387
nokogiri (>= 1.14.3 )
403
388
xcodeproj (~> 1.27 )
404
389
sorbet-runtime (0.5.12043 )
405
- sqlite3 (1.7.3 )
406
- mini_portile2 (~> 2.8.0 )
407
390
stream-chat-ruby (3.0.0 )
408
391
faraday
409
392
faraday-multipart
432
415
websocket-extensions (>= 0.1.0 )
433
416
websocket-extensions (0.1.5 )
434
417
word_wrap (1.0.0 )
435
- xcinvoke (0.3.0 )
436
- liferaft (~> 0.0.6 )
437
418
xcodeproj (1.27.0 )
438
419
CFPropertyList (>= 2.3.3 , < 4.0 )
439
420
atomos (~> 0.1.3 )
@@ -462,7 +443,6 @@ DEPENDENCIES
462
443
fastlane-plugin-stream_actions (= 0.3.79 )
463
444
fastlane-plugin-versioning
464
445
faye-websocket
465
- jazzy
466
446
json
467
447
plist
468
448
puma
Original file line number Diff line number Diff line change @@ -222,6 +222,10 @@ struct ChannelReadUpdaterMiddleware: EventMiddleware {
222
222
return . messageIsSystem
223
223
}
224
224
225
+ if message. isShadowed {
226
+ return . messageIsShadowed
227
+ }
228
+
225
229
if message. createdAt <= channelRead. lastReadAt. bridgeDate {
226
230
return . messageIsSeen
227
231
}
@@ -237,6 +241,7 @@ private enum UnreadSkippingReason: CustomStringConvertible {
237
241
case messageIsSilent
238
242
case messageIsThreadReply
239
243
case messageIsSystem
244
+ case messageIsShadowed
240
245
case messageIsSeen
241
246
case messageIsSoftDeleted
242
247
@@ -254,6 +259,8 @@ private enum UnreadSkippingReason: CustomStringConvertible {
254
259
return " Thread replies do not affect unread counts "
255
260
case . messageIsSystem:
256
261
return " System messages do not affect unread counts "
262
+ case . messageIsShadowed:
263
+ return " Shadowed messages do not affect unread counts "
257
264
case . messageIsSeen:
258
265
return " Seen messages do not affect unread counts "
259
266
case . messageIsSoftDeleted:
Original file line number Diff line number Diff line change @@ -591,6 +591,35 @@ final class ChannelReadUpdaterMiddleware_Tests: XCTestCase {
591
591
XCTAssertEqual ( Int ( read. unreadMessageCount) , currentUserReadPayload. unreadMessagesCount)
592
592
}
593
593
594
+ func test_messageNewEvent_whenMessageIsShadowed_doesNotIncrementUnreadCount( ) throws {
595
+ // WHEN
596
+ let shadowedMessage : MessagePayload = . dummy(
597
+ type: . regular,
598
+ messageId: . unique,
599
+ authorUserId: anotherUserPayload. id,
600
+ createdAt: currentUserReadPayload. lastReadAt. addingTimeInterval ( 1 ) ,
601
+ isShadowed: true
602
+ )
603
+
604
+ let messageNewEvent = try MessageNewEventDTO (
605
+ from: . init(
606
+ eventType: . messageNew,
607
+ cid: channelPayload. channel. cid,
608
+ user: anotherUserPayload,
609
+ message: shadowedMessage,
610
+ createdAt: shadowedMessage. createdAt
611
+ )
612
+ )
613
+
614
+ try database. writeSynchronously { session in
615
+ _ = self . middleware. handle ( event: messageNewEvent, session: session)
616
+ }
617
+
618
+ // THEN
619
+ let read = try XCTUnwrap ( currentUserReadDTO)
620
+ XCTAssertEqual ( Int ( read. unreadMessageCount) , currentUserReadPayload. unreadMessagesCount)
621
+ }
622
+
594
623
func test_messageNewEvent_whenMessageIsRead_doesNotIncrementUnreadCount( ) throws {
595
624
// WHEN
596
625
let regularMessageEarlierThanLastRead : MessagePayload = . dummy(
You can’t perform that action at this time.
0 commit comments