Fossil SCM
Add pEditHead field to avoid repeatedly walking back to find the original post
Commit
7114bdc827e9ee2cc65715fc0106d6d20da576c31b79614654e0e06e560e9ea5
Parent
145a6ef281a66d3…
1 file changed
+2
+2
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -38,10 +38,11 @@ | ||
| 38 | 38 | int firt; /* This entry replies to firt */ |
| 39 | 39 | int mfirt; /* Root in-reply-to */ |
| 40 | 40 | int nReply; /* Number of replies to this entry */ |
| 41 | 41 | int sid; /* Serial ID number */ |
| 42 | 42 | char *zUuid; /* Artifact hash */ |
| 43 | + ForumEntry *pEditHead; /* Original, unedited entry */ | |
| 43 | 44 | ForumEntry *pEditTail; /* Most recent edit for this entry */ |
| 44 | 45 | ForumEntry *pEditNext; /* This entry is edited by pEditNext */ |
| 45 | 46 | ForumEntry *pEditPrev; /* This entry is an edit of pEditPrev */ |
| 46 | 47 | ForumEntry *pNext; /* Next in chronological order */ |
| 47 | 48 | ForumEntry *pPrev; /* Previous in chronological order */ |
| @@ -202,10 +203,11 @@ | ||
| 202 | 203 | if( pEntry->fprev ){ |
| 203 | 204 | ForumEntry *pBase = 0, *p; |
| 204 | 205 | p = forumentry_backward(pEntry->pPrev, pEntry->fprev); |
| 205 | 206 | p->pEditNext = pEntry; |
| 206 | 207 | pEntry->pEditPrev = p; |
| 208 | + pEntry->pEditHead = p->pEditHead ? p->pEditHead : p; | |
| 207 | 209 | while( p ){ |
| 208 | 210 | pBase = p; |
| 209 | 211 | p->pEditTail = pEntry; |
| 210 | 212 | p = pBase->pEditPrev; |
| 211 | 213 | } |
| 212 | 214 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | int firt; /* This entry replies to firt */ |
| 39 | int mfirt; /* Root in-reply-to */ |
| 40 | int nReply; /* Number of replies to this entry */ |
| 41 | int sid; /* Serial ID number */ |
| 42 | char *zUuid; /* Artifact hash */ |
| 43 | ForumEntry *pEditTail; /* Most recent edit for this entry */ |
| 44 | ForumEntry *pEditNext; /* This entry is edited by pEditNext */ |
| 45 | ForumEntry *pEditPrev; /* This entry is an edit of pEditPrev */ |
| 46 | ForumEntry *pNext; /* Next in chronological order */ |
| 47 | ForumEntry *pPrev; /* Previous in chronological order */ |
| @@ -202,10 +203,11 @@ | |
| 202 | if( pEntry->fprev ){ |
| 203 | ForumEntry *pBase = 0, *p; |
| 204 | p = forumentry_backward(pEntry->pPrev, pEntry->fprev); |
| 205 | p->pEditNext = pEntry; |
| 206 | pEntry->pEditPrev = p; |
| 207 | while( p ){ |
| 208 | pBase = p; |
| 209 | p->pEditTail = pEntry; |
| 210 | p = pBase->pEditPrev; |
| 211 | } |
| 212 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -38,10 +38,11 @@ | |
| 38 | int firt; /* This entry replies to firt */ |
| 39 | int mfirt; /* Root in-reply-to */ |
| 40 | int nReply; /* Number of replies to this entry */ |
| 41 | int sid; /* Serial ID number */ |
| 42 | char *zUuid; /* Artifact hash */ |
| 43 | ForumEntry *pEditHead; /* Original, unedited entry */ |
| 44 | ForumEntry *pEditTail; /* Most recent edit for this entry */ |
| 45 | ForumEntry *pEditNext; /* This entry is edited by pEditNext */ |
| 46 | ForumEntry *pEditPrev; /* This entry is an edit of pEditPrev */ |
| 47 | ForumEntry *pNext; /* Next in chronological order */ |
| 48 | ForumEntry *pPrev; /* Previous in chronological order */ |
| @@ -202,10 +203,11 @@ | |
| 203 | if( pEntry->fprev ){ |
| 204 | ForumEntry *pBase = 0, *p; |
| 205 | p = forumentry_backward(pEntry->pPrev, pEntry->fprev); |
| 206 | p->pEditNext = pEntry; |
| 207 | pEntry->pEditPrev = p; |
| 208 | pEntry->pEditHead = p->pEditHead ? p->pEditHead : p; |
| 209 | while( p ){ |
| 210 | pBase = p; |
| 211 | p->pEditTail = pEntry; |
| 212 | p = pBase->pEditPrev; |
| 213 | } |
| 214 |