Skip to content

Commit a813f68

Browse files
committed
Reload parent board unreads when a thread is read from a Smart Board
1 parent de3d50a commit a813f68

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

Sources/WCBoardThread.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
@class WCBoard, WCBoardThreadFilter, WCBoardPost;
3030

3131
@interface WCBoardThread : WCServerConnectionObject {
32+
NSString *_board;
3233
NSString *_threadID;
3334
NSUInteger _replies;
3435
NSString *_subject;
@@ -50,6 +51,8 @@
5051

5152
+ (WCBoardThread *)threadWithMessage:(WIP7Message *)message connection:(WCServerConnection *)connection;
5253

54+
- (NSString *)board;
55+
- (void)setBoard:(NSString *)board;
5356
- (NSString *)threadID;
5457
- (void)setSubject:(NSString *)subject;
5558
- (NSString *)subject;

Sources/WCBoardThread.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ - (id)_initWithMessage:(WIP7Message *)message connection:(WCServerConnection *)c
5656
[message getBool:&ownThread forName:@"wired.board.own_thread"];
5757

5858
_replies = replies;
59+
_board = [[message stringForName:@"wired.board.board"] retain];
5960
_threadID = [[message UUIDForName:@"wired.board.thread"] retain];
6061
_subject = [[message stringForName:@"wired.board.subject"] retain];
6162
_postDate = [[message dateForName:@"wired.board.post_date"] retain];
@@ -82,6 +83,7 @@ + (WCBoardThread *)threadWithMessage:(WIP7Message *)message connection:(WCServer
8283

8384

8485
- (void)dealloc {
86+
[_board release];
8587
[_threadID release];
8688
[_posts release];
8789

@@ -118,6 +120,17 @@ - (NSString *)description {
118120

119121
#pragma mark -
120122

123+
- (NSString *)board {
124+
return _board;
125+
}
126+
127+
- (void)setBoard:(NSString *)board {
128+
[board retain];
129+
[_board release];
130+
131+
_board = board;
132+
}
133+
121134
- (NSString *)threadID {
122135
return _threadID;
123136
}

Sources/WCBoards.m

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ - (void)_reloadFilters {
620620
[self _reloadBoard:board];
621621
}
622622
}
623-
//[_boardsOutlineView setNeedsDisplay:YES];
624623
}
625624

626625

@@ -1849,11 +1848,11 @@ - (void)accountsControllerAccountsDidChange:(NSNotification *)notification {
18491848

18501849

18511850
- (void)boardsDidChangeUnreadCount:(NSNotification *)notification {
1852-
NSArray *threads;
1853-
NSSet *readIDs;
1854-
1855-
NSLog(@"boardsDidChangeUnreadCount");
1856-
1851+
WCBoardThread *thread;
1852+
WCBoard *parent;
1853+
NSArray *threads;
1854+
NSSet *readIDs;
1855+
18571856
threads = nil;
18581857

18591858
if([[notification object] isKindOfClass:[NSSet class]]) {
@@ -1871,9 +1870,16 @@ - (void)boardsDidChangeUnreadCount:(NSNotification *)notification {
18711870
[self _reloadThreads:threads];
18721871
}
18731872
if([[notification object] isKindOfClass:[WCBoardThread class]]) {
1874-
threads = @[[notification object]];
1873+
thread = [notification object];
1874+
parent = [_boards boardForPath:[thread board]];
1875+
1876+
if (parent)
1877+
[self _reloadBoard:parent];
1878+
1879+
threads = @[thread];
18751880
[self _reloadThreads:threads];
18761881
}
1882+
18771883
[self _reloadBoard:[self selectedBoard]];
18781884
[self _reloadFilters];
18791885
}

WiredClient.xcodeproj/project.pbxproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@
23442344
CODE_SIGN_IDENTITY = "Developer ID Application";
23452345
CODE_SIGN_STYLE = Manual;
23462346
COMBINE_HIDPI_IMAGES = YES;
2347-
CURRENT_PROJECT_VERSION = 50;
2347+
CURRENT_PROJECT_VERSION = 51;
23482348
DEVELOPMENT_TEAM = 7KTXA5Y36K;
23492349
ENABLE_HARDENED_RUNTIME = YES;
23502350
FRAMEWORK_SEARCH_PATHS = (
@@ -2598,7 +2598,7 @@
25982598
CODE_SIGN_IDENTITY = "Developer ID Application";
25992599
CODE_SIGN_STYLE = Manual;
26002600
COMBINE_HIDPI_IMAGES = YES;
2601-
CURRENT_PROJECT_VERSION = 50;
2601+
CURRENT_PROJECT_VERSION = 51;
26022602
DEVELOPMENT_TEAM = 7KTXA5Y36K;
26032603
ENABLE_HARDENED_RUNTIME = YES;
26042604
FRAMEWORK_SEARCH_PATHS = (
@@ -2700,7 +2700,7 @@
27002700
ALWAYS_SEARCH_USER_PATHS = NO;
27012701
CODE_SIGN_ENTITLEMENTS = "Wired Client.entitlements";
27022702
CODE_SIGN_IDENTITY = "-";
2703-
CURRENT_PROJECT_VERSION = 50;
2703+
CURRENT_PROJECT_VERSION = 51;
27042704
ENABLE_HARDENED_RUNTIME = YES;
27052705
FRAMEWORK_SEARCH_PATHS = (
27062706
"$(inherited)",

0 commit comments

Comments
 (0)