Fossil SCM
Fix the in-reply-to link for hierarchical forum display to maintain the hierarchical display. Make the link say "previous" if linking to the previous post in the thread.
Commit
1b63ab701bc99994e40ede6ef7720af71da57c8e01bb9ce502fd80cc3eee3b76
Parent
97697b7956d3ea4…
1 file changed
+16
-2
+16
-2
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -304,10 +304,11 @@ | ||
| 304 | 304 | */ |
| 305 | 305 | static void forum_display_chronological(int froot, int target){ |
| 306 | 306 | ForumThread *pThread = forumthread_create(froot, 0); |
| 307 | 307 | ForumEntry *p; |
| 308 | 308 | int notAnon = login_is_individual(); |
| 309 | + int iPrev = -1; | |
| 309 | 310 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 310 | 311 | char *zDate; |
| 311 | 312 | Manifest *pPost; |
| 312 | 313 | int isPrivate; /* True for posts awaiting moderation */ |
| 313 | 314 | int sameUser; /* True if author is also the reader */ |
| @@ -332,13 +333,19 @@ | ||
| 332 | 333 | } |
| 333 | 334 | if( p->firt ){ |
| 334 | 335 | ForumEntry *pIrt = p->pPrev; |
| 335 | 336 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 336 | 337 | if( pIrt ){ |
| 337 | - @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))%d(p->firt)</a> | |
| 338 | + @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))\ | |
| 339 | + if( p->firt==iPrev ){ | |
| 340 | + @ previous</a> | |
| 341 | + }else{ | |
| 342 | + @ %d(p->firt)</a> | |
| 343 | + } | |
| 338 | 344 | } |
| 339 | 345 | } |
| 346 | + iPrev = p->fpid; | |
| 340 | 347 | if( p->pLeaf ){ |
| 341 | 348 | @ updated by %z(href("%R/forumpost/%S?t=c",p->pLeaf->zUuid))\ |
| 342 | 349 | @ %d(p->pLeaf->fpid)</a> |
| 343 | 350 | } |
| 344 | 351 | if( g.perm.Debug ){ |
| @@ -397,10 +404,11 @@ | ||
| 397 | 404 | int fpid; |
| 398 | 405 | const char *zUuid; |
| 399 | 406 | char *zDate; |
| 400 | 407 | const char *zSel; |
| 401 | 408 | int notAnon = login_is_individual(); |
| 409 | + int iPrev = -1; | |
| 402 | 410 | |
| 403 | 411 | pThread = forumthread_create(froot, 1); |
| 404 | 412 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 405 | 413 | if( p->fpid==target ){ |
| 406 | 414 | while( p->pEdit ) p = p->pEdit; |
| @@ -459,13 +467,19 @@ | ||
| 459 | 467 | } |
| 460 | 468 | if( p->firt ){ |
| 461 | 469 | ForumEntry *pIrt = p->pPrev; |
| 462 | 470 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 463 | 471 | if( pIrt ){ |
| 464 | - @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))%d(p->firt)</a> | |
| 472 | + @ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\ | |
| 473 | + if( p->firt==iPrev ){ | |
| 474 | + @ previous</a> | |
| 475 | + }else{ | |
| 476 | + @ %d(p->firt)</a> | |
| 477 | + } | |
| 465 | 478 | } |
| 466 | 479 | } |
| 480 | + iPrev = p->fpid; | |
| 467 | 481 | isPrivate = content_is_private(fpid); |
| 468 | 482 | sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 469 | 483 | if( isPrivate && !g.perm.ModForum && !sameUser ){ |
| 470 | 484 | @ <p><span class="modpending">Awaiting Moderator Approval</span></p> |
| 471 | 485 | }else{ |
| 472 | 486 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -304,10 +304,11 @@ | |
| 304 | */ |
| 305 | static void forum_display_chronological(int froot, int target){ |
| 306 | ForumThread *pThread = forumthread_create(froot, 0); |
| 307 | ForumEntry *p; |
| 308 | int notAnon = login_is_individual(); |
| 309 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 310 | char *zDate; |
| 311 | Manifest *pPost; |
| 312 | int isPrivate; /* True for posts awaiting moderation */ |
| 313 | int sameUser; /* True if author is also the reader */ |
| @@ -332,13 +333,19 @@ | |
| 332 | } |
| 333 | if( p->firt ){ |
| 334 | ForumEntry *pIrt = p->pPrev; |
| 335 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 336 | if( pIrt ){ |
| 337 | @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))%d(p->firt)</a> |
| 338 | } |
| 339 | } |
| 340 | if( p->pLeaf ){ |
| 341 | @ updated by %z(href("%R/forumpost/%S?t=c",p->pLeaf->zUuid))\ |
| 342 | @ %d(p->pLeaf->fpid)</a> |
| 343 | } |
| 344 | if( g.perm.Debug ){ |
| @@ -397,10 +404,11 @@ | |
| 397 | int fpid; |
| 398 | const char *zUuid; |
| 399 | char *zDate; |
| 400 | const char *zSel; |
| 401 | int notAnon = login_is_individual(); |
| 402 | |
| 403 | pThread = forumthread_create(froot, 1); |
| 404 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 405 | if( p->fpid==target ){ |
| 406 | while( p->pEdit ) p = p->pEdit; |
| @@ -459,13 +467,19 @@ | |
| 459 | } |
| 460 | if( p->firt ){ |
| 461 | ForumEntry *pIrt = p->pPrev; |
| 462 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 463 | if( pIrt ){ |
| 464 | @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))%d(p->firt)</a> |
| 465 | } |
| 466 | } |
| 467 | isPrivate = content_is_private(fpid); |
| 468 | sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 469 | if( isPrivate && !g.perm.ModForum && !sameUser ){ |
| 470 | @ <p><span class="modpending">Awaiting Moderator Approval</span></p> |
| 471 | }else{ |
| 472 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -304,10 +304,11 @@ | |
| 304 | */ |
| 305 | static void forum_display_chronological(int froot, int target){ |
| 306 | ForumThread *pThread = forumthread_create(froot, 0); |
| 307 | ForumEntry *p; |
| 308 | int notAnon = login_is_individual(); |
| 309 | int iPrev = -1; |
| 310 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 311 | char *zDate; |
| 312 | Manifest *pPost; |
| 313 | int isPrivate; /* True for posts awaiting moderation */ |
| 314 | int sameUser; /* True if author is also the reader */ |
| @@ -332,13 +333,19 @@ | |
| 333 | } |
| 334 | if( p->firt ){ |
| 335 | ForumEntry *pIrt = p->pPrev; |
| 336 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 337 | if( pIrt ){ |
| 338 | @ in reply to %z(href("%R/forumpost/%S?t=c",pIrt->zUuid))\ |
| 339 | if( p->firt==iPrev ){ |
| 340 | @ previous</a> |
| 341 | }else{ |
| 342 | @ %d(p->firt)</a> |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | iPrev = p->fpid; |
| 347 | if( p->pLeaf ){ |
| 348 | @ updated by %z(href("%R/forumpost/%S?t=c",p->pLeaf->zUuid))\ |
| 349 | @ %d(p->pLeaf->fpid)</a> |
| 350 | } |
| 351 | if( g.perm.Debug ){ |
| @@ -397,10 +404,11 @@ | |
| 404 | int fpid; |
| 405 | const char *zUuid; |
| 406 | char *zDate; |
| 407 | const char *zSel; |
| 408 | int notAnon = login_is_individual(); |
| 409 | int iPrev = -1; |
| 410 | |
| 411 | pThread = forumthread_create(froot, 1); |
| 412 | for(p=pThread->pFirst; p; p=p->pNext){ |
| 413 | if( p->fpid==target ){ |
| 414 | while( p->pEdit ) p = p->pEdit; |
| @@ -459,13 +467,19 @@ | |
| 467 | } |
| 468 | if( p->firt ){ |
| 469 | ForumEntry *pIrt = p->pPrev; |
| 470 | while( pIrt && pIrt->fpid!=p->firt ) pIrt = pIrt->pPrev; |
| 471 | if( pIrt ){ |
| 472 | @ in reply to %z(href("%R/forumpost/%S?t=h",pIrt->zUuid))\ |
| 473 | if( p->firt==iPrev ){ |
| 474 | @ previous</a> |
| 475 | }else{ |
| 476 | @ %d(p->firt)</a> |
| 477 | } |
| 478 | } |
| 479 | } |
| 480 | iPrev = p->fpid; |
| 481 | isPrivate = content_is_private(fpid); |
| 482 | sameUser = notAnon && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 483 | if( isPrivate && !g.perm.ModForum && !sameUser ){ |
| 484 | @ <p><span class="modpending">Awaiting Moderator Approval</span></p> |
| 485 | }else{ |
| 486 |