Fossil SCM
Prevent blank user names from being displayed for items awaiting moderation.
Commit
89ed7dc59168865a308e6d8bda86a9b108328b52
Parent
60f71ba20a9d9c9…
2 files changed
+4
-2
+6
-4
+4
-2
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -71,10 +71,11 @@ | ||
| 71 | 71 | const char *zFilename = db_column_text(&q, 3); |
| 72 | 72 | const char *zComment = db_column_text(&q, 4); |
| 73 | 73 | const char *zUser = db_column_text(&q, 5); |
| 74 | 74 | const char *zUuid = db_column_text(&q, 6); |
| 75 | 75 | int attachid = db_column_int(&q, 7); |
| 76 | + const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; | |
| 76 | 77 | int i; |
| 77 | 78 | char *zUrlTail; |
| 78 | 79 | for(i=0; zFilename[i]; i++){ |
| 79 | 80 | if( zFilename[i]=='/' && zFilename[i+1]!=0 ){ |
| 80 | 81 | zFilename = &zFilename[i+1]; |
| @@ -115,11 +116,11 @@ | ||
| 115 | 116 | @ Deleted |
| 116 | 117 | }else { |
| 117 | 118 | @ Added |
| 118 | 119 | } |
| 119 | 120 | } |
| 120 | - @ by %h(zUser) on | |
| 121 | + @ by %h(zDispUser) on | |
| 121 | 122 | hyperlink_to_date(zDate, "."); |
| 122 | 123 | free(zUrlTail); |
| 123 | 124 | } |
| 124 | 125 | db_finalize(&q); |
| 125 | 126 | @ </ol> |
| @@ -557,17 +558,18 @@ | ||
| 557 | 558 | const char *zDate = db_column_text(&q, 0); |
| 558 | 559 | const char *zFile = db_column_text(&q, 1); |
| 559 | 560 | const char *zUser = db_column_text(&q, 2); |
| 560 | 561 | const char *zUuid = db_column_text(&q, 3); |
| 561 | 562 | const char *zSrc = db_column_text(&q, 4); |
| 563 | + const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; | |
| 562 | 564 | if( cnt==0 ){ |
| 563 | 565 | @ %s(zHeader) |
| 564 | 566 | } |
| 565 | 567 | cnt++; |
| 566 | 568 | @ <li> |
| 567 | 569 | @ %z(href("%R/artifact/%s",zSrc))%h(zFile)</a> |
| 568 | - @ added by %h(zUser) on | |
| 570 | + @ added by %h(zDispUser) on | |
| 569 | 571 | hyperlink_to_date(zDate, "."); |
| 570 | 572 | @ [%z(href("%R/ainfo/%s",zUuid))details</a>] |
| 571 | 573 | @ </li> |
| 572 | 574 | } |
| 573 | 575 | if( cnt ){ |
| 574 | 576 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -71,10 +71,11 @@ | |
| 71 | const char *zFilename = db_column_text(&q, 3); |
| 72 | const char *zComment = db_column_text(&q, 4); |
| 73 | const char *zUser = db_column_text(&q, 5); |
| 74 | const char *zUuid = db_column_text(&q, 6); |
| 75 | int attachid = db_column_int(&q, 7); |
| 76 | int i; |
| 77 | char *zUrlTail; |
| 78 | for(i=0; zFilename[i]; i++){ |
| 79 | if( zFilename[i]=='/' && zFilename[i+1]!=0 ){ |
| 80 | zFilename = &zFilename[i+1]; |
| @@ -115,11 +116,11 @@ | |
| 115 | @ Deleted |
| 116 | }else { |
| 117 | @ Added |
| 118 | } |
| 119 | } |
| 120 | @ by %h(zUser) on |
| 121 | hyperlink_to_date(zDate, "."); |
| 122 | free(zUrlTail); |
| 123 | } |
| 124 | db_finalize(&q); |
| 125 | @ </ol> |
| @@ -557,17 +558,18 @@ | |
| 557 | const char *zDate = db_column_text(&q, 0); |
| 558 | const char *zFile = db_column_text(&q, 1); |
| 559 | const char *zUser = db_column_text(&q, 2); |
| 560 | const char *zUuid = db_column_text(&q, 3); |
| 561 | const char *zSrc = db_column_text(&q, 4); |
| 562 | if( cnt==0 ){ |
| 563 | @ %s(zHeader) |
| 564 | } |
| 565 | cnt++; |
| 566 | @ <li> |
| 567 | @ %z(href("%R/artifact/%s",zSrc))%h(zFile)</a> |
| 568 | @ added by %h(zUser) on |
| 569 | hyperlink_to_date(zDate, "."); |
| 570 | @ [%z(href("%R/ainfo/%s",zUuid))details</a>] |
| 571 | @ </li> |
| 572 | } |
| 573 | if( cnt ){ |
| 574 |
| --- src/attach.c | |
| +++ src/attach.c | |
| @@ -71,10 +71,11 @@ | |
| 71 | const char *zFilename = db_column_text(&q, 3); |
| 72 | const char *zComment = db_column_text(&q, 4); |
| 73 | const char *zUser = db_column_text(&q, 5); |
| 74 | const char *zUuid = db_column_text(&q, 6); |
| 75 | int attachid = db_column_int(&q, 7); |
| 76 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 77 | int i; |
| 78 | char *zUrlTail; |
| 79 | for(i=0; zFilename[i]; i++){ |
| 80 | if( zFilename[i]=='/' && zFilename[i+1]!=0 ){ |
| 81 | zFilename = &zFilename[i+1]; |
| @@ -115,11 +116,11 @@ | |
| 116 | @ Deleted |
| 117 | }else { |
| 118 | @ Added |
| 119 | } |
| 120 | } |
| 121 | @ by %h(zDispUser) on |
| 122 | hyperlink_to_date(zDate, "."); |
| 123 | free(zUrlTail); |
| 124 | } |
| 125 | db_finalize(&q); |
| 126 | @ </ol> |
| @@ -557,17 +558,18 @@ | |
| 558 | const char *zDate = db_column_text(&q, 0); |
| 559 | const char *zFile = db_column_text(&q, 1); |
| 560 | const char *zUser = db_column_text(&q, 2); |
| 561 | const char *zUuid = db_column_text(&q, 3); |
| 562 | const char *zSrc = db_column_text(&q, 4); |
| 563 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 564 | if( cnt==0 ){ |
| 565 | @ %s(zHeader) |
| 566 | } |
| 567 | cnt++; |
| 568 | @ <li> |
| 569 | @ %z(href("%R/artifact/%s",zSrc))%h(zFile)</a> |
| 570 | @ added by %h(zDispUser) on |
| 571 | hyperlink_to_date(zDate, "."); |
| 572 | @ [%z(href("%R/ainfo/%s",zUuid))details</a>] |
| 573 | @ </li> |
| 574 | } |
| 575 | if( cnt ){ |
| 576 |
+6
-4
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -85,10 +85,11 @@ | ||
| 85 | 85 | ** Generate a hyperlink to a user. This will link to a timeline showing |
| 86 | 86 | ** events by that user. If the date+time is specified, then the timeline |
| 87 | 87 | ** is centered on that date+time. |
| 88 | 88 | */ |
| 89 | 89 | void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ |
| 90 | + if( zU==0 || zU[0]==0 ) zU = "anonymous"; | |
| 90 | 91 | if( zSuf==0 ) zSuf = ""; |
| 91 | 92 | if( g.perm.Hyperlink ){ |
| 92 | 93 | if( zD && zD[0] ){ |
| 93 | 94 | @ %z(href("%R/timeline?c=%T&u=%T",zD,zU))%h(zU)</a>%s(zSuf) |
| 94 | 95 | }else{ |
| @@ -237,10 +238,11 @@ | ||
| 237 | 238 | const char *zDate = db_column_text(pQuery, 2); |
| 238 | 239 | const char *zType = db_column_text(pQuery, 7); |
| 239 | 240 | const char *zUser = db_column_text(pQuery, 4); |
| 240 | 241 | const char *zTagList = db_column_text(pQuery, 8); |
| 241 | 242 | int tagid = db_column_int(pQuery, 9); |
| 243 | + const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; | |
| 242 | 244 | const char *zBr = 0; /* Branch */ |
| 243 | 245 | int commentColumn = 3; /* Column containing comment text */ |
| 244 | 246 | int modPending; /* Pending moderation */ |
| 245 | 247 | char zTime[8]; |
| 246 | 248 | |
| @@ -372,15 +374,15 @@ | ||
| 372 | 374 | |
| 373 | 375 | /* Generate the "user: USERNAME" at the end of the comment, together |
| 374 | 376 | ** with a hyperlink to another timeline for that user. |
| 375 | 377 | */ |
| 376 | 378 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 377 | - if( g.perm.Hyperlink && fossil_strcmp(zUser, zThisUser)!=0 ){ | |
| 378 | - char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zUser, zDate); | |
| 379 | - @ (user: %z(href("%z",zLink))%h(zUser)</a>%s(zTagList?",":"\051") | |
| 379 | + if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){ | |
| 380 | + char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zDispUser, zDate); | |
| 381 | + @ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051") | |
| 380 | 382 | }else{ |
| 381 | - @ (user: %h(zUser)%s(zTagList?",":"\051") | |
| 383 | + @ (user: %h(zDispUser)%s(zTagList?",":"\051") | |
| 382 | 384 | } |
| 383 | 385 | |
| 384 | 386 | /* Generate a "detail" link for tags. */ |
| 385 | 387 | if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){ |
| 386 | 388 | @ [%z(href("%R/info/%S",zUuid))details</a>] |
| 387 | 389 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -85,10 +85,11 @@ | |
| 85 | ** Generate a hyperlink to a user. This will link to a timeline showing |
| 86 | ** events by that user. If the date+time is specified, then the timeline |
| 87 | ** is centered on that date+time. |
| 88 | */ |
| 89 | void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ |
| 90 | if( zSuf==0 ) zSuf = ""; |
| 91 | if( g.perm.Hyperlink ){ |
| 92 | if( zD && zD[0] ){ |
| 93 | @ %z(href("%R/timeline?c=%T&u=%T",zD,zU))%h(zU)</a>%s(zSuf) |
| 94 | }else{ |
| @@ -237,10 +238,11 @@ | |
| 237 | const char *zDate = db_column_text(pQuery, 2); |
| 238 | const char *zType = db_column_text(pQuery, 7); |
| 239 | const char *zUser = db_column_text(pQuery, 4); |
| 240 | const char *zTagList = db_column_text(pQuery, 8); |
| 241 | int tagid = db_column_int(pQuery, 9); |
| 242 | const char *zBr = 0; /* Branch */ |
| 243 | int commentColumn = 3; /* Column containing comment text */ |
| 244 | int modPending; /* Pending moderation */ |
| 245 | char zTime[8]; |
| 246 | |
| @@ -372,15 +374,15 @@ | |
| 372 | |
| 373 | /* Generate the "user: USERNAME" at the end of the comment, together |
| 374 | ** with a hyperlink to another timeline for that user. |
| 375 | */ |
| 376 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 377 | if( g.perm.Hyperlink && fossil_strcmp(zUser, zThisUser)!=0 ){ |
| 378 | char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zUser, zDate); |
| 379 | @ (user: %z(href("%z",zLink))%h(zUser)</a>%s(zTagList?",":"\051") |
| 380 | }else{ |
| 381 | @ (user: %h(zUser)%s(zTagList?",":"\051") |
| 382 | } |
| 383 | |
| 384 | /* Generate a "detail" link for tags. */ |
| 385 | if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){ |
| 386 | @ [%z(href("%R/info/%S",zUuid))details</a>] |
| 387 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -85,10 +85,11 @@ | |
| 85 | ** Generate a hyperlink to a user. This will link to a timeline showing |
| 86 | ** events by that user. If the date+time is specified, then the timeline |
| 87 | ** is centered on that date+time. |
| 88 | */ |
| 89 | void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){ |
| 90 | if( zU==0 || zU[0]==0 ) zU = "anonymous"; |
| 91 | if( zSuf==0 ) zSuf = ""; |
| 92 | if( g.perm.Hyperlink ){ |
| 93 | if( zD && zD[0] ){ |
| 94 | @ %z(href("%R/timeline?c=%T&u=%T",zD,zU))%h(zU)</a>%s(zSuf) |
| 95 | }else{ |
| @@ -237,10 +238,11 @@ | |
| 238 | const char *zDate = db_column_text(pQuery, 2); |
| 239 | const char *zType = db_column_text(pQuery, 7); |
| 240 | const char *zUser = db_column_text(pQuery, 4); |
| 241 | const char *zTagList = db_column_text(pQuery, 8); |
| 242 | int tagid = db_column_int(pQuery, 9); |
| 243 | const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous"; |
| 244 | const char *zBr = 0; /* Branch */ |
| 245 | int commentColumn = 3; /* Column containing comment text */ |
| 246 | int modPending; /* Pending moderation */ |
| 247 | char zTime[8]; |
| 248 | |
| @@ -372,15 +374,15 @@ | |
| 374 | |
| 375 | /* Generate the "user: USERNAME" at the end of the comment, together |
| 376 | ** with a hyperlink to another timeline for that user. |
| 377 | */ |
| 378 | if( zTagList && zTagList[0]==0 ) zTagList = 0; |
| 379 | if( g.perm.Hyperlink && fossil_strcmp(zDispUser, zThisUser)!=0 ){ |
| 380 | char *zLink = mprintf("%R/timeline?u=%h&c=%t&nd", zDispUser, zDate); |
| 381 | @ (user: %z(href("%z",zLink))%h(zDispUser)</a>%s(zTagList?",":"\051") |
| 382 | }else{ |
| 383 | @ (user: %h(zDispUser)%s(zTagList?",":"\051") |
| 384 | } |
| 385 | |
| 386 | /* Generate a "detail" link for tags. */ |
| 387 | if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){ |
| 388 | @ [%z(href("%R/info/%S",zUuid))details</a>] |
| 389 |