Fossil SCM
Do not posts that are awaiting moderation to users without moderator privilege unless they are the same user that generated the post in the first place.
Commit
16c42a08084c2f996a222d795766020d0c0cbeafeb6ac082f36e0fdd12963b49
Parent
f8994f8975d86d2…
1 file changed
+20
-6
+20
-6
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -272,13 +272,16 @@ | ||
| 272 | 272 | ** Display all posts in a forum thread in chronological order |
| 273 | 273 | */ |
| 274 | 274 | static void forum_display_chronological(int froot, int target){ |
| 275 | 275 | ForumThread *pThread = forumthread_create(froot, 0); |
| 276 | 276 | ForumEntry *p; |
| 277 | + int notAnon = login_is_individual(); | |
| 277 | 278 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 278 | 279 | char *zDate; |
| 279 | 280 | Manifest *pPost; |
| 281 | + int isPrivate; /* True for posts awaiting moderation */ | |
| 282 | + int sameUser; /* True if author is also the reader */ | |
| 280 | 283 | |
| 281 | 284 | pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 282 | 285 | if( pPost==0 ) continue; |
| 283 | 286 | if( p->fpid==target ){ |
| 284 | 287 | @ <div id="forum%d(p->fpid)" class="forumTime forumSel"> |
| @@ -312,15 +315,20 @@ | ||
| 312 | 315 | @ <a href="%R/artifact/%h(p->zUuid)">artifact</a></span> |
| 313 | 316 | } |
| 314 | 317 | if( p->fpid!=target ){ |
| 315 | 318 | @ %z(href("%R/forumpost/%S?t",p->zUuid))[link]</a> |
| 316 | 319 | } |
| 317 | - forum_render(0, pPost->zMimetype, pPost->zWiki, 0); | |
| 320 | + isPrivate = content_is_private(p->fpid); | |
| 321 | + sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; | |
| 322 | + if( isPrivate && !g.perm.ModForum && !sameUser ){ | |
| 323 | + @ <p><span class="modpending">Awaiting Moderator Approval</span></p> | |
| 324 | + }else{ | |
| 325 | + forum_render(0, pPost->zMimetype, pPost->zWiki, 0); | |
| 326 | + } | |
| 318 | 327 | if( g.perm.WrForum && p->pLeaf==0 ){ |
| 319 | 328 | int sameUser = login_is_individual() |
| 320 | 329 | && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 321 | - int isPrivate = content_is_private(p->fpid); | |
| 322 | 330 | @ <p><form action="%R/forumedit" method="POST"> |
| 323 | 331 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 324 | 332 | if( !isPrivate ){ |
| 325 | 333 | /* Reply and Edit are only available if the post has already |
| 326 | 334 | ** been approved */ |
| @@ -356,10 +364,11 @@ | ||
| 356 | 364 | Manifest *pPost, *pOPost; |
| 357 | 365 | int fpid; |
| 358 | 366 | const char *zUuid; |
| 359 | 367 | char *zDate; |
| 360 | 368 | const char *zSel; |
| 369 | + int notAnon = login_is_individual(); | |
| 361 | 370 | |
| 362 | 371 | pThread = forumthread_create(froot, 1); |
| 363 | 372 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 364 | 373 | if( p->fpid==target ){ |
| 365 | 374 | while( p->pEdit ) p = p->pEdit; |
| @@ -366,10 +375,12 @@ | ||
| 366 | 375 | target = p->fpid; |
| 367 | 376 | break; |
| 368 | 377 | } |
| 369 | 378 | } |
| 370 | 379 | for(p=pThread->pDisplay; p; p=p->pDisplay){ |
| 380 | + int isPrivate; /* True for posts awaiting moderation */ | |
| 381 | + int sameUser; /* True if reader is also the poster */ | |
| 371 | 382 | pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 372 | 383 | if( p->pLeaf ){ |
| 373 | 384 | fpid = p->pLeaf->fpid; |
| 374 | 385 | zUuid = p->pLeaf->zUuid; |
| 375 | 386 | pPost = manifest_get(fpid, CFTYPE_FORUM, 0); |
| @@ -412,15 +423,18 @@ | ||
| 412 | 423 | manifest_destroy(pOPost); |
| 413 | 424 | } |
| 414 | 425 | if( fpid!=target ){ |
| 415 | 426 | @ %z(href("%R/forumpost/%S",zUuid))[link]</a> |
| 416 | 427 | } |
| 417 | - forum_render(0, pPost->zMimetype, pPost->zWiki, 0); | |
| 428 | + isPrivate = content_is_private(fpid); | |
| 429 | + sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; | |
| 430 | + if( isPrivate && !g.perm.ModForum && !sameUser ){ | |
| 431 | + @ <p><span class="modpending">Awaiting Moderator Approval</span></p> | |
| 432 | + }else{ | |
| 433 | + forum_render(0, pPost->zMimetype, pPost->zWiki, 0); | |
| 434 | + } | |
| 418 | 435 | if( g.perm.WrForum ){ |
| 419 | - int sameUser = login_is_individual() | |
| 420 | - && fossil_strcmp(pPost->zUser, g.zLogin)==0; | |
| 421 | - int isPrivate = content_is_private(fpid); | |
| 422 | 436 | @ <p><form action="%R/forumedit" method="POST"> |
| 423 | 437 | @ <input type="hidden" name="fpid" value="%s(zUuid)"> |
| 424 | 438 | if( !isPrivate ){ |
| 425 | 439 | /* Reply and Edit are only available if the post has already |
| 426 | 440 | ** been approved */ |
| 427 | 441 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -272,13 +272,16 @@ | |
| 272 | ** Display all posts in a forum thread in chronological order |
| 273 | */ |
| 274 | static void forum_display_chronological(int froot, int target){ |
| 275 | ForumThread *pThread = forumthread_create(froot, 0); |
| 276 | ForumEntry *p; |
| 277 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 278 | char *zDate; |
| 279 | Manifest *pPost; |
| 280 | |
| 281 | pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 282 | if( pPost==0 ) continue; |
| 283 | if( p->fpid==target ){ |
| 284 | @ <div id="forum%d(p->fpid)" class="forumTime forumSel"> |
| @@ -312,15 +315,20 @@ | |
| 312 | @ <a href="%R/artifact/%h(p->zUuid)">artifact</a></span> |
| 313 | } |
| 314 | if( p->fpid!=target ){ |
| 315 | @ %z(href("%R/forumpost/%S?t",p->zUuid))[link]</a> |
| 316 | } |
| 317 | forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
| 318 | if( g.perm.WrForum && p->pLeaf==0 ){ |
| 319 | int sameUser = login_is_individual() |
| 320 | && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 321 | int isPrivate = content_is_private(p->fpid); |
| 322 | @ <p><form action="%R/forumedit" method="POST"> |
| 323 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 324 | if( !isPrivate ){ |
| 325 | /* Reply and Edit are only available if the post has already |
| 326 | ** been approved */ |
| @@ -356,10 +364,11 @@ | |
| 356 | Manifest *pPost, *pOPost; |
| 357 | int fpid; |
| 358 | const char *zUuid; |
| 359 | char *zDate; |
| 360 | const char *zSel; |
| 361 | |
| 362 | pThread = forumthread_create(froot, 1); |
| 363 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 364 | if( p->fpid==target ){ |
| 365 | while( p->pEdit ) p = p->pEdit; |
| @@ -366,10 +375,12 @@ | |
| 366 | target = p->fpid; |
| 367 | break; |
| 368 | } |
| 369 | } |
| 370 | for(p=pThread->pDisplay; p; p=p->pDisplay){ |
| 371 | pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 372 | if( p->pLeaf ){ |
| 373 | fpid = p->pLeaf->fpid; |
| 374 | zUuid = p->pLeaf->zUuid; |
| 375 | pPost = manifest_get(fpid, CFTYPE_FORUM, 0); |
| @@ -412,15 +423,18 @@ | |
| 412 | manifest_destroy(pOPost); |
| 413 | } |
| 414 | if( fpid!=target ){ |
| 415 | @ %z(href("%R/forumpost/%S",zUuid))[link]</a> |
| 416 | } |
| 417 | forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
| 418 | if( g.perm.WrForum ){ |
| 419 | int sameUser = login_is_individual() |
| 420 | && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 421 | int isPrivate = content_is_private(fpid); |
| 422 | @ <p><form action="%R/forumedit" method="POST"> |
| 423 | @ <input type="hidden" name="fpid" value="%s(zUuid)"> |
| 424 | if( !isPrivate ){ |
| 425 | /* Reply and Edit are only available if the post has already |
| 426 | ** been approved */ |
| 427 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -272,13 +272,16 @@ | |
| 272 | ** Display all posts in a forum thread in chronological order |
| 273 | */ |
| 274 | static void forum_display_chronological(int froot, int target){ |
| 275 | ForumThread *pThread = forumthread_create(froot, 0); |
| 276 | ForumEntry *p; |
| 277 | int notAnon = login_is_individual(); |
| 278 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 279 | char *zDate; |
| 280 | Manifest *pPost; |
| 281 | int isPrivate; /* True for posts awaiting moderation */ |
| 282 | int sameUser; /* True if author is also the reader */ |
| 283 | |
| 284 | pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 285 | if( pPost==0 ) continue; |
| 286 | if( p->fpid==target ){ |
| 287 | @ <div id="forum%d(p->fpid)" class="forumTime forumSel"> |
| @@ -312,15 +315,20 @@ | |
| 315 | @ <a href="%R/artifact/%h(p->zUuid)">artifact</a></span> |
| 316 | } |
| 317 | if( p->fpid!=target ){ |
| 318 | @ %z(href("%R/forumpost/%S?t",p->zUuid))[link]</a> |
| 319 | } |
| 320 | isPrivate = content_is_private(p->fpid); |
| 321 | sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 322 | if( isPrivate && !g.perm.ModForum && !sameUser ){ |
| 323 | @ <p><span class="modpending">Awaiting Moderator Approval</span></p> |
| 324 | }else{ |
| 325 | forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
| 326 | } |
| 327 | if( g.perm.WrForum && p->pLeaf==0 ){ |
| 328 | int sameUser = login_is_individual() |
| 329 | && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 330 | @ <p><form action="%R/forumedit" method="POST"> |
| 331 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)"> |
| 332 | if( !isPrivate ){ |
| 333 | /* Reply and Edit are only available if the post has already |
| 334 | ** been approved */ |
| @@ -356,10 +364,11 @@ | |
| 364 | Manifest *pPost, *pOPost; |
| 365 | int fpid; |
| 366 | const char *zUuid; |
| 367 | char *zDate; |
| 368 | const char *zSel; |
| 369 | int notAnon = login_is_individual(); |
| 370 | |
| 371 | pThread = forumthread_create(froot, 1); |
| 372 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 373 | if( p->fpid==target ){ |
| 374 | while( p->pEdit ) p = p->pEdit; |
| @@ -366,10 +375,12 @@ | |
| 375 | target = p->fpid; |
| 376 | break; |
| 377 | } |
| 378 | } |
| 379 | for(p=pThread->pDisplay; p; p=p->pDisplay){ |
| 380 | int isPrivate; /* True for posts awaiting moderation */ |
| 381 | int sameUser; /* True if reader is also the poster */ |
| 382 | pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0); |
| 383 | if( p->pLeaf ){ |
| 384 | fpid = p->pLeaf->fpid; |
| 385 | zUuid = p->pLeaf->zUuid; |
| 386 | pPost = manifest_get(fpid, CFTYPE_FORUM, 0); |
| @@ -412,15 +423,18 @@ | |
| 423 | manifest_destroy(pOPost); |
| 424 | } |
| 425 | if( fpid!=target ){ |
| 426 | @ %z(href("%R/forumpost/%S",zUuid))[link]</a> |
| 427 | } |
| 428 | isPrivate = content_is_private(fpid); |
| 429 | sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 430 | if( isPrivate && !g.perm.ModForum && !sameUser ){ |
| 431 | @ <p><span class="modpending">Awaiting Moderator Approval</span></p> |
| 432 | }else{ |
| 433 | forum_render(0, pPost->zMimetype, pPost->zWiki, 0); |
| 434 | } |
| 435 | if( g.perm.WrForum ){ |
| 436 | @ <p><form action="%R/forumedit" method="POST"> |
| 437 | @ <input type="hidden" name="fpid" value="%s(zUuid)"> |
| 438 | if( !isPrivate ){ |
| 439 | /* Reply and Edit are only available if the post has already |
| 440 | ** been approved */ |
| 441 |