Fossil SCM
Fix rendering of the status tag for the read-only case.
Commit
aec2127bedf1441ea588306100586de50075ad25e16603151dad5e016d29cd81
Parent
25b18d427cd3de8…
1 file changed
+5
-5
+5
-5
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -905,12 +905,11 @@ | ||
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | 907 | if( !sCurrent ) sCurrent = &fss->aStatus[0]; |
| 908 | 908 | assert( sCurrent ); |
| 909 | 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 */ ){ | |
| 910 | + if( forum_may_set_status(fp->fpid) ){ | |
| 912 | 911 | @ <form method="post" action='%R/forumpost_status'> |
| 913 | 912 | login_insert_csrf_secret(); |
| 914 | 913 | @ <input type='hidden' name='fpid' value='%s(fp->zUuid)' /> |
| 915 | 914 | @ <select name='status' data-fpid='%s(fp->zUuid)>'\ |
| 916 | 915 | @ data-initial-value='%h(zCurrent ? zCurrent : "")'> |
| @@ -926,11 +925,11 @@ | ||
| 926 | 925 | /* ^^^ This must be <input>, not <button>, or else tapping it |
| 927 | 926 | ** will unconditionally submit. */ |
| 928 | 927 | @ </form> |
| 929 | 928 | /* Form is activated in fossil.page.forumpost.js */ |
| 930 | 929 | }else{ |
| 931 | - @ Status: %h(sCurrent->zLabel); | |
| 930 | + @ <button disabled>Status: %h(sCurrent->zLabel)</button> | |
| 932 | 931 | } |
| 933 | 932 | @ </span> |
| 934 | 933 | fossil_free(zCurrent); |
| 935 | 934 | } |
| 936 | 935 | } |
| @@ -1272,11 +1271,10 @@ | ||
| 1272 | 1271 | login_insert_csrf_secret(); |
| 1273 | 1272 | @ </form> |
| 1274 | 1273 | |
| 1275 | 1274 | if( bSelect ){ |
| 1276 | 1275 | const ForumPost *pHead = p->pEditHead ? p->pEditHead : p; |
| 1277 | - const int bIsOwner = forumpost_is_owner(p/*not pHead*/->fpid, 0); | |
| 1278 | 1276 | if( forumpost_may_close() && iClosed>=0 ){ |
| 1279 | 1277 | @ <form method="post" \ |
| 1280 | 1278 | @ action='%R/forumpost_%s(iClosed > 0 ? "reopen" : "close")'> |
| 1281 | 1279 | login_insert_csrf_secret(); |
| 1282 | 1280 | @ <input type="hidden" name="fpid" value="%s(p->zUuid)" /> |
| @@ -1286,11 +1284,13 @@ | ||
| 1286 | 1284 | @ %s(iClosed ? "action-reopen" : "action-close")'/> |
| 1287 | 1285 | /* ^^^ activated by fossil.page.forumpost.js */ |
| 1288 | 1286 | } |
| 1289 | 1287 | @ </form> |
| 1290 | 1288 | } |
| 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)) ){ | |
| 1292 | 1292 | /* When an admin edits someone else's post, the admin |
| 1293 | 1293 | ** effectively takes over ownership of it (and we currently |
| 1294 | 1294 | ** have no way of passing it back). Because of this, we |
| 1295 | 1295 | ** check the ownership of `p` instead of `pHead`. */ |
| 1296 | 1296 | @ <form method="post" action="%R/attachadd">\ |
| 1297 | 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 | /* 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 |