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.

drh 2018-08-16 16:45 trunk
Commit 16c42a08084c2f996a222d795766020d0c0cbeafeb6ac082f36e0fdd12963b49
1 file changed +20 -6
+20 -6
--- src/forum.c
+++ src/forum.c
@@ -272,13 +272,16 @@
272272
** Display all posts in a forum thread in chronological order
273273
*/
274274
static void forum_display_chronological(int froot, int target){
275275
ForumThread *pThread = forumthread_create(froot, 0);
276276
ForumEntry *p;
277
+ int notAnon = login_is_individual();
277278
for(p=pThread->pFirst; p; p=p->pNext){
278279
char *zDate;
279280
Manifest *pPost;
281
+ int isPrivate; /* True for posts awaiting moderation */
282
+ int sameUser; /* True if author is also the reader */
280283
281284
pPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
282285
if( pPost==0 ) continue;
283286
if( p->fpid==target ){
284287
@ <div id="forum%d(p->fpid)" class="forumTime forumSel">
@@ -312,15 +315,20 @@
312315
@ <a href="%R/artifact/%h(p->zUuid)">artifact</a></span>
313316
}
314317
if( p->fpid!=target ){
315318
@ %z(href("%R/forumpost/%S?t",p->zUuid))[link]</a>
316319
}
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
+ }
318327
if( g.perm.WrForum && p->pLeaf==0 ){
319328
int sameUser = login_is_individual()
320329
&& fossil_strcmp(pPost->zUser, g.zLogin)==0;
321
- int isPrivate = content_is_private(p->fpid);
322330
@ <p><form action="%R/forumedit" method="POST">
323331
@ <input type="hidden" name="fpid" value="%s(p->zUuid)">
324332
if( !isPrivate ){
325333
/* Reply and Edit are only available if the post has already
326334
** been approved */
@@ -356,10 +364,11 @@
356364
Manifest *pPost, *pOPost;
357365
int fpid;
358366
const char *zUuid;
359367
char *zDate;
360368
const char *zSel;
369
+ int notAnon = login_is_individual();
361370
362371
pThread = forumthread_create(froot, 1);
363372
for(p=pThread->pFirst; p; p=p->pNext){
364373
if( p->fpid==target ){
365374
while( p->pEdit ) p = p->pEdit;
@@ -366,10 +375,12 @@
366375
target = p->fpid;
367376
break;
368377
}
369378
}
370379
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 */
371382
pOPost = manifest_get(p->fpid, CFTYPE_FORUM, 0);
372383
if( p->pLeaf ){
373384
fpid = p->pLeaf->fpid;
374385
zUuid = p->pLeaf->zUuid;
375386
pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
@@ -412,15 +423,18 @@
412423
manifest_destroy(pOPost);
413424
}
414425
if( fpid!=target ){
415426
@ %z(href("%R/forumpost/%S",zUuid))[link]</a>
416427
}
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
+ }
418435
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);
422436
@ <p><form action="%R/forumedit" method="POST">
423437
@ <input type="hidden" name="fpid" value="%s(zUuid)">
424438
if( !isPrivate ){
425439
/* Reply and Edit are only available if the post has already
426440
** been approved */
427441
--- 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

Keyboard Shortcuts

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