Fossil SCM

Prevent blank user names from being displayed for items awaiting moderation.

mistachkin 2012-11-19 23:58 UTC trunk
Commit 89ed7dc59168865a308e6d8bda86a9b108328b52
2 files changed +4 -2 +6 -4
+4 -2
--- src/attach.c
+++ src/attach.c
@@ -71,10 +71,11 @@
7171
const char *zFilename = db_column_text(&q, 3);
7272
const char *zComment = db_column_text(&q, 4);
7373
const char *zUser = db_column_text(&q, 5);
7474
const char *zUuid = db_column_text(&q, 6);
7575
int attachid = db_column_int(&q, 7);
76
+ const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
7677
int i;
7778
char *zUrlTail;
7879
for(i=0; zFilename[i]; i++){
7980
if( zFilename[i]=='/' && zFilename[i+1]!=0 ){
8081
zFilename = &zFilename[i+1];
@@ -115,11 +116,11 @@
115116
@ Deleted
116117
}else {
117118
@ Added
118119
}
119120
}
120
- @ by %h(zUser) on
121
+ @ by %h(zDispUser) on
121122
hyperlink_to_date(zDate, ".");
122123
free(zUrlTail);
123124
}
124125
db_finalize(&q);
125126
@ </ol>
@@ -557,17 +558,18 @@
557558
const char *zDate = db_column_text(&q, 0);
558559
const char *zFile = db_column_text(&q, 1);
559560
const char *zUser = db_column_text(&q, 2);
560561
const char *zUuid = db_column_text(&q, 3);
561562
const char *zSrc = db_column_text(&q, 4);
563
+ const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
562564
if( cnt==0 ){
563565
@ %s(zHeader)
564566
}
565567
cnt++;
566568
@ <li>
567569
@ %z(href("%R/artifact/%s",zSrc))%h(zFile)</a>
568
- @ added by %h(zUser) on
570
+ @ added by %h(zDispUser) on
569571
hyperlink_to_date(zDate, ".");
570572
@ [%z(href("%R/ainfo/%s",zUuid))details</a>]
571573
@ </li>
572574
}
573575
if( cnt ){
574576
--- 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 @@
8585
** Generate a hyperlink to a user. This will link to a timeline showing
8686
** events by that user. If the date+time is specified, then the timeline
8787
** is centered on that date+time.
8888
*/
8989
void hyperlink_to_user(const char *zU, const char *zD, const char *zSuf){
90
+ if( zU==0 || zU[0]==0 ) zU = "anonymous";
9091
if( zSuf==0 ) zSuf = "";
9192
if( g.perm.Hyperlink ){
9293
if( zD && zD[0] ){
9394
@ %z(href("%R/timeline?c=%T&u=%T",zD,zU))%h(zU)</a>%s(zSuf)
9495
}else{
@@ -237,10 +238,11 @@
237238
const char *zDate = db_column_text(pQuery, 2);
238239
const char *zType = db_column_text(pQuery, 7);
239240
const char *zUser = db_column_text(pQuery, 4);
240241
const char *zTagList = db_column_text(pQuery, 8);
241242
int tagid = db_column_int(pQuery, 9);
243
+ const char *zDispUser = zUser && zUser[0] ? zUser : "anonymous";
242244
const char *zBr = 0; /* Branch */
243245
int commentColumn = 3; /* Column containing comment text */
244246
int modPending; /* Pending moderation */
245247
char zTime[8];
246248
@@ -372,15 +374,15 @@
372374
373375
/* Generate the "user: USERNAME" at the end of the comment, together
374376
** with a hyperlink to another timeline for that user.
375377
*/
376378
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")
380382
}else{
381
- @ (user: %h(zUser)%s(zTagList?",":"\051")
383
+ @ (user: %h(zDispUser)%s(zTagList?",":"\051")
382384
}
383385
384386
/* Generate a "detail" link for tags. */
385387
if( (zType[0]=='g' || zType[0]=='w' || zType[0]=='t') && g.perm.Hyperlink ){
386388
@ [%z(href("%R/info/%S",zUuid))details</a>]
387389
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button