Fossil SCM

Fix rendering of the status tag for the read-only case.

stephan 2026-05-26 13:39 UTC forum-statuses
Commit aec2127bedf1441ea588306100586de50075ad25e16603151dad5e016d29cd81
1 file changed +5 -5
+5 -5
--- src/forum.c
+++ src/forum.c
@@ -905,12 +905,11 @@
905905
}
906906
}
907907
if( !sCurrent ) sCurrent = &fss->aStatus[0];
908908
assert( sCurrent );
909909
@ <span class='forum-status-selection'>
910
- if( forum_may_set_status(fp->fpid)
911
- /* FIXME: only do this if fp is the currently-selected post */ ){
910
+ if( forum_may_set_status(fp->fpid) ){
912911
@ <form method="post" action='%R/forumpost_status'>
913912
login_insert_csrf_secret();
914913
@ <input type='hidden' name='fpid' value='%s(fp->zUuid)' />
915914
@ <select name='status' data-fpid='%s(fp->zUuid)>'\
916915
@ data-initial-value='%h(zCurrent ? zCurrent : "")'>
@@ -926,11 +925,11 @@
926925
/* ^^^ This must be <input>, not <button>, or else tapping it
927926
** will unconditionally submit. */
928927
@ </form>
929928
/* Form is activated in fossil.page.forumpost.js */
930929
}else{
931
- @ Status: %h(sCurrent->zLabel);
930
+ @ <button disabled>Status: %h(sCurrent->zLabel)</button>
932931
}
933932
@ </span>
934933
fossil_free(zCurrent);
935934
}
936935
}
@@ -1272,11 +1271,10 @@
12721271
login_insert_csrf_secret();
12731272
@ </form>
12741273
12751274
if( bSelect ){
12761275
const ForumPost *pHead = p->pEditHead ? p->pEditHead : p;
1277
- const int bIsOwner = forumpost_is_owner(p/*not pHead*/->fpid, 0);
12781276
if( forumpost_may_close() && iClosed>=0 ){
12791277
@ <form method="post" \
12801278
@ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'>
12811279
login_insert_csrf_secret();
12821280
@ <input type="hidden" name="fpid" value="%s(p->zUuid)" />
@@ -1286,11 +1284,13 @@
12861284
@ %s(iClosed ? "action-reopen" : "action-close")'/>
12871285
/* ^^^ activated by fossil.page.forumpost.js */
12881286
}
12891287
@ </form>
12901288
}
1291
- if( g.perm.Admin || (login_is_individual() && bIsOwner) ){
1289
+ if( g.perm.Admin
1290
+ || (login_is_individual()
1291
+ && forumpost_is_owner(p/*not pHead*/->fpid, 0)) ){
12921292
/* When an admin edits someone else's post, the admin
12931293
** effectively takes over ownership of it (and we currently
12941294
** have no way of passing it back). Because of this, we
12951295
** check the ownership of `p` instead of `pHead`. */
12961296
@ <form method="post" action="%R/attachadd">\
12971297
--- src/forum.c
+++ src/forum.c
@@ -905,12 +905,11 @@
905 }
906 }
907 if( !sCurrent ) sCurrent = &fss->aStatus[0];
908 assert( sCurrent );
909 @ <span class='forum-status-selection'>
910 if( forum_may_set_status(fp->fpid)
911 /* FIXME: only do this if fp is the currently-selected post */ ){
912 @ <form method="post" action='%R/forumpost_status'>
913 login_insert_csrf_secret();
914 @ <input type='hidden' name='fpid' value='%s(fp->zUuid)' />
915 @ <select name='status' data-fpid='%s(fp->zUuid)>'\
916 @ data-initial-value='%h(zCurrent ? zCurrent : "")'>
@@ -926,11 +925,11 @@
926 /* ^^^ This must be <input>, not <button>, or else tapping it
927 ** will unconditionally submit. */
928 @ </form>
929 /* Form is activated in fossil.page.forumpost.js */
930 }else{
931 @ Status: %h(sCurrent->zLabel);
932 }
933 @ </span>
934 fossil_free(zCurrent);
935 }
936 }
@@ -1272,11 +1271,10 @@
1272 login_insert_csrf_secret();
1273 @ </form>
1274
1275 if( bSelect ){
1276 const ForumPost *pHead = p->pEditHead ? p->pEditHead : p;
1277 const int bIsOwner = forumpost_is_owner(p/*not pHead*/->fpid, 0);
1278 if( forumpost_may_close() && iClosed>=0 ){
1279 @ <form method="post" \
1280 @ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'>
1281 login_insert_csrf_secret();
1282 @ <input type="hidden" name="fpid" value="%s(p->zUuid)" />
@@ -1286,11 +1284,13 @@
1286 @ %s(iClosed ? "action-reopen" : "action-close")'/>
1287 /* ^^^ activated by fossil.page.forumpost.js */
1288 }
1289 @ </form>
1290 }
1291 if( g.perm.Admin || (login_is_individual() && bIsOwner) ){
 
 
1292 /* When an admin edits someone else's post, the admin
1293 ** effectively takes over ownership of it (and we currently
1294 ** have no way of passing it back). Because of this, we
1295 ** check the ownership of `p` instead of `pHead`. */
1296 @ <form method="post" action="%R/attachadd">\
1297
--- src/forum.c
+++ src/forum.c
@@ -905,12 +905,11 @@
905 }
906 }
907 if( !sCurrent ) sCurrent = &fss->aStatus[0];
908 assert( sCurrent );
909 @ <span class='forum-status-selection'>
910 if( forum_may_set_status(fp->fpid) ){
 
911 @ <form method="post" action='%R/forumpost_status'>
912 login_insert_csrf_secret();
913 @ <input type='hidden' name='fpid' value='%s(fp->zUuid)' />
914 @ <select name='status' data-fpid='%s(fp->zUuid)>'\
915 @ data-initial-value='%h(zCurrent ? zCurrent : "")'>
@@ -926,11 +925,11 @@
925 /* ^^^ This must be <input>, not <button>, or else tapping it
926 ** will unconditionally submit. */
927 @ </form>
928 /* Form is activated in fossil.page.forumpost.js */
929 }else{
930 @ <button disabled>Status: %h(sCurrent->zLabel)</button>
931 }
932 @ </span>
933 fossil_free(zCurrent);
934 }
935 }
@@ -1272,11 +1271,10 @@
1271 login_insert_csrf_secret();
1272 @ </form>
1273
1274 if( bSelect ){
1275 const ForumPost *pHead = p->pEditHead ? p->pEditHead : p;
 
1276 if( forumpost_may_close() && iClosed>=0 ){
1277 @ <form method="post" \
1278 @ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'>
1279 login_insert_csrf_secret();
1280 @ <input type="hidden" name="fpid" value="%s(p->zUuid)" />
@@ -1286,11 +1284,13 @@
1284 @ %s(iClosed ? "action-reopen" : "action-close")'/>
1285 /* ^^^ activated by fossil.page.forumpost.js */
1286 }
1287 @ </form>
1288 }
1289 if( g.perm.Admin
1290 || (login_is_individual()
1291 && forumpost_is_owner(p/*not pHead*/->fpid, 0)) ){
1292 /* When an admin edits someone else's post, the admin
1293 ** effectively takes over ownership of it (and we currently
1294 ** have no way of passing it back). Because of this, we
1295 ** check the ownership of `p` instead of `pHead`. */
1296 @ <form method="post" action="%R/attachadd">\
1297

Keyboard Shortcuts

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