mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-24 12:55:24 +00:00
fix(calendar): Fix search issue on repeated events when one title is changed the event could not be found
This commit is contained in:
@@ -1575,7 +1575,8 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
{
|
||||
if ([filters isEqualToString:@"title_Category_Location"] || [filters isEqualToString:@"entireContent"])
|
||||
{
|
||||
[baseWhere addObject: [NSString stringWithFormat: @"(c_title isCaseInsensitiveLike: '*%@*' OR c_category isCaseInsensitiveLike: '*%@*' OR c_location isCaseInsensitiveLike: '*%@*')",
|
||||
[baseWhere addObject: [NSString stringWithFormat: @"(c_title isCaseInsensitiveLike: '*%@*' OR c_category isCaseInsensitiveLike: '*%@*' OR c_location isCaseInsensitiveLike: '*%@*' OR c_content isCaseInsensitiveLike: '*SUMMARY:*%@*')",
|
||||
[title asSafeSQLLikeString],
|
||||
[title asSafeSQLLikeString],
|
||||
[title asSafeSQLLikeString],
|
||||
[title asSafeSQLLikeString]]];
|
||||
@@ -1698,6 +1699,23 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
else
|
||||
ma = [NSMutableArray array];
|
||||
|
||||
if (title && [title length] > 0) {
|
||||
// Case when multiple summary are set in c_content
|
||||
// Need to filter on title
|
||||
int i;
|
||||
NSDictionary *currentItem;
|
||||
for (i = [ma count] - 1; i >= 0; i--) {
|
||||
currentItem = [ma objectAtIndex: i];
|
||||
if (currentItem && [currentItem objectForKey: @"c_title"]
|
||||
&& [[currentItem objectForKey: @"c_title"] length] > 0) {
|
||||
if ([[currentItem objectForKey: @"c_title"] rangeOfString: title options: NSCaseInsensitiveSearch].location == NSNotFound) {
|
||||
[ma removeObjectAtIndex: i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ma;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user