Skip to content

Commit 981168b

Browse files
authored
Merge pull request #342 from RickMohr/use-treephoto-meta-perm
Use correct info to enable/disable adding tree photos
2 parents 4a36731 + dccd87f commit 981168b

3 files changed

Lines changed: 3 additions & 8 deletions

File tree

OpenTreeMap/src/OTM/Controllers/OTMTreeDetailViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ - (void)setKeys:(NSArray *)k
277277
speciesRow.detailDataKey = @"tree.sci_name";
278278
}
279279

280-
if ([[OTMEnvironment sharedEnvironment] photoFieldIsWritable]) {
280+
if ([[OTMEnvironment sharedEnvironment] canAddTreePhoto]) {
281281
pictureRow = [[OTMStaticClickCellRenderer alloc]
282282
initWithName:@"Tree Picture"
283283
key:@""

OpenTreeMap/src/OTM/OTMEnvironment.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ extern NSString * const OTMEnvironmentDateStringShort;
139139
@property (nonatomic, strong) NSDictionary* config;
140140
@property (nonatomic, strong) NSURL *instanceLogoUrl;
141141
@property BOOL speciesFieldWritable;
142-
@property BOOL photoFieldWritable;
142+
@property BOOL canAddTreePhoto;
143143
@property BOOL canAddTree;
144144

145145

@@ -164,6 +164,5 @@ extern NSString * const OTMEnvironmentDateStringShort;
164164
- (NSString *)absolutePhotoUrlFromPhotoUrl:(NSString *)url;
165165

166166
- (BOOL) speciesFieldIsWritable;
167-
- (BOOL) photoFieldIsWritable;
168167

169168
@end

OpenTreeMap/src/OTM/OTMEnvironment.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ - (void)updateEnvironmentWithDictionary:(NSDictionary *)dict {
210210
self.config = [dict objectForKey:@"config"];
211211
self.mapViewTitle = [dict objectForKey:@"name"];
212212
self.canAddTree = [[[[dict objectForKey:@"meta_perms"] objectForKey:@"can_add_tree"] stringValue] isEqualToString:@"0"] ? NO : YES;
213-
self.photoFieldWritable = [[[[self.fieldData objectForKey:@"treephoto.image"] objectForKey:@"can_write"] stringValue] isEqualToString:@"0"] ? NO : YES;
213+
self.canAddTreePhoto = [[[[dict objectForKey:@"meta_perms"] objectForKey:@"can_edit_tree_photo"] stringValue] isEqualToString:@"0"] ? NO : YES;
214214
[self setSearchRegionRadiusInMeters:[[dict objectForKey:@"extent_radius"] doubleValue]];
215215

216216
NSDictionary *missingAndStandardFilters = [dict objectForKey:@"search"];
@@ -670,10 +670,6 @@ - (BOOL) speciesFieldIsWritable {
670670
return self.speciesFieldWritable;
671671
}
672672

673-
- (BOOL) photoFieldIsWritable {
674-
return self.photoFieldWritable;
675-
}
676-
677673
//
678674
// Functions from DB5
679675
// https://github.com/quartermaster/DB5/blob/7e41cef54e7ae9d3e97c2f8f23fc5cf14df72114/Source/VSTheme.m

0 commit comments

Comments
 (0)