Skip to content

Commit dd9faee

Browse files
committed
Only create space for badges and detailed commit message if they exist.
1 parent 9203177 commit dd9faee

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

PBWebCommitController.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ - (NSString *)htmlForHeader:(NSArray *)header withRefs:(NSString *)badges
232232
NSMutableString *auths=[NSMutableString string];
233233
NSMutableString *refs=[NSMutableString string];
234234
NSMutableString *subject=[NSMutableString string];
235+
NSMutableString *all=[NSMutableString string];
235236

236237
for (NSDictionary *item in header) {
237238
if ([[item objectForKey:kHeaderKeyName] isEqualToString:@"subject"]) {
@@ -269,7 +270,17 @@ - (NSString *)htmlForHeader:(NSArray *)header withRefs:(NSString *)badges
269270
}
270271
}
271272

272-
return [NSString stringWithFormat:@"<div id='header' class='clearfix'><table class='references'>%@</table><p class='subject'>%@</p>%@<div id='badges'>%@</div></div><p>%@</p>",refs,subjectFirst,auths,badges,subject];
273+
[all appendString:[NSString stringWithFormat:@"<div id='header' class='clearfix'><table class='references'>%@</table><p class='subject'>%@</p>%@",refs,subjectFirst,auths]];
274+
275+
if (![badges isEqualToString:@""])
276+
[all appendString:[NSString stringWithFormat:@"<div id='badges'>%@</div>",badges]];
277+
278+
[all appendString:@"</div>"];
279+
280+
if (![subject isEqualToString:@""])
281+
[all appendString:[NSString stringWithFormat:@"<p>%@</p>",subject]];
282+
283+
return all;
273284
}
274285

275286
- (NSString *) arbitraryHashForString:(NSString*)concat {

0 commit comments

Comments
 (0)