| | @@ -1265,22 +1265,10 @@ |
| 1265 | 1265 | @ %s(iClosed ? "action-reopen" : "action-close")'/> |
| 1266 | 1266 | /* ^^^ activated by fossil.page.forumpost.js */ |
| 1267 | 1267 | } |
| 1268 | 1268 | @ </form> |
| 1269 | 1269 | } |
| 1270 | | - if( !p->pIrt && g.perm.Setup ){ |
| 1271 | | - const int isPinned = forum_rid_is_tagged(pHead->fpid, "pinned", 0); |
| 1272 | | - @ <form method="post" \ |
| 1273 | | - @ action='%R/forumpost_%s(isPinned ? "unpin" : "pin")'> |
| 1274 | | - login_insert_csrf_secret(); |
| 1275 | | - @ <input type="hidden" name="fpid" value="%s(p->zUuid)" /> |
| 1276 | | - @ <input type="button" value='%s(isPinned ? "Unpin" : "Pin")' \ |
| 1277 | | - @ class='submit hidden \ |
| 1278 | | - @ %s(isPinned ? "action-unpin" : "action-pin")'/> |
| 1279 | | - /* ^^^ activated by fossil.page.forumpost.js */ |
| 1280 | | - @ </form> |
| 1281 | | - } |
| 1282 | 1270 | if( g.perm.Admin || |
| 1283 | 1271 | (login_is_individual() |
| 1284 | 1272 | && forumpost_is_owner(p/*not pHead*/->fpid, 0)) ){ |
| 1285 | 1273 | /* When an admin edits someone else's post, the admin |
| 1286 | 1274 | ** effectively takes over ownership of it (and we currently |
| | @@ -1850,31 +1838,10 @@ |
| 1850 | 1838 | char const *zReason = bIsAdd ? 0 : PD("reason", 0); |
| 1851 | 1839 | forumpost_action_helper("closed", zReason, bIsAdd, 0); |
| 1852 | 1840 | } |
| 1853 | 1841 | } |
| 1854 | 1842 | |
| 1855 | | -/* |
| 1856 | | -** WEBPAGE: forumpost_pin hidden |
| 1857 | | -** WEBPAGE: forumpost_unpin hidden |
| 1858 | | -** |
| 1859 | | -** fpid=X Hash of the post to be edited. REQUIRED |
| 1860 | | -** |
| 1861 | | -** Pins or unpins the given forum post, within the bounds of the |
| 1862 | | -** API for forumpost_tag(). After (perhaps) modifying the "pinned" |
| 1863 | | -** tag of the given thread, it redirects to that post's thread |
| 1864 | | -** view. Requires setup privileges. |
| 1865 | | -*/ |
| 1866 | | -void forum_page_pin(void){ |
| 1867 | | - login_check_credentials(); |
| 1868 | | - if( !g.perm.Setup ){ |
| 1869 | | - login_needed(g.anon.Setup); |
| 1870 | | - }else{ |
| 1871 | | - const int bIsAdd = sqlite3_strglob("*_pin*", g.zPath)==0; |
| 1872 | | - forumpost_action_helper("pinned", 0, bIsAdd, 0); |
| 1873 | | - } |
| 1874 | | -} |
| 1875 | | - |
| 1876 | 1843 | /* |
| 1877 | 1844 | ** WEBPAGE: forumpost_status hidden |
| 1878 | 1845 | ** |
| 1879 | 1846 | ** fpid=X Hash of the post to be edited. REQUIRED |
| 1880 | 1847 | ** status=Y New status value. REQUIRED |
| | @@ -2500,69 +2467,60 @@ |
| 2500 | 2467 | zStatusFilter = 0; |
| 2501 | 2468 | } |
| 2502 | 2469 | if( db_table_exists("repository","forumpost") ){ |
| 2503 | 2470 | db_prepare(&q, |
| 2504 | 2471 | "WITH " |
| 2505 | | - "pinned(pinnedid) AS MATERIALIZED (\n" |
| 2506 | | - " SELECT DISTINCT tagxref.rid\n" |
| 2507 | | - " FROM tag, tagxref\n" |
| 2508 | | - " WHERE tag.tagname='pinned'\n" |
| 2509 | | - " AND tagxref.tagid=tag.tagid\n" |
| 2510 | | - " AND tagxref.tagtype>=1\n" |
| 2511 | | - "),\n" |
| 2512 | | - "thread(age,duration,cnt,root,last,pinned) AS (\n" |
| 2472 | + "thread(age,duration,cnt,root,last) AS (\n" |
| 2513 | 2473 | " SELECT\n" |
| 2514 | 2474 | " julianday('now') - max(fmtime),\n" |
| 2515 | 2475 | " max(fmtime) - min(fmtime),\n" |
| 2516 | 2476 | " sum(fprev IS NULL),\n" |
| 2517 | 2477 | " froot,\n" |
| 2518 | 2478 | " (SELECT fpid FROM forumpost AS y\n" |
| 2519 | 2479 | " WHERE y.froot=x.froot %s\n" |
| 2520 | | - " ORDER BY y.fmtime DESC LIMIT 1),\n" |
| 2521 | | - " froot IN pinned\n" |
| 2480 | + " ORDER BY y.fmtime DESC LIMIT 1)\n" |
| 2522 | 2481 | " FROM forumpost AS x\n" |
| 2523 | 2482 | " WHERE firt IS NULL AND %s/*ModForum*/\n" |
| 2524 | 2483 | " GROUP BY froot\n" |
| 2525 | | - " ORDER BY 6 DESC, 1 LIMIT %d OFFSET %d\n" |
| 2484 | + " ORDER BY 1\n" |
| 2485 | + " LIMIT %d OFFSET %d\n" |
| 2526 | 2486 | ")\n" |
| 2527 | 2487 | "SELECT\n" |
| 2528 | 2488 | " thread.age,\n" /* 0 */ |
| 2529 | 2489 | " thread.duration,\n" /* 1 */ |
| 2530 | 2490 | " thread.cnt,\n" /* 2 */ |
| 2531 | 2491 | " blob.uuid,\n" /* 3 */ |
| 2532 | 2492 | " substr(event.comment,instr(event.comment,':')+1),\n" /* 4 */ |
| 2533 | 2493 | " thread.last,\n" /* 5 */ |
| 2534 | | - " thread.pinned,\n" /* 6 */ |
| 2535 | 2494 | " (SELECT coalesce(fs.value,dfs.value)\n" |
| 2536 | 2495 | " FROM tag, tagxref, forumstatus fs\n" |
| 2537 | 2496 | " WHERE tag.tagname='status'\n" |
| 2538 | 2497 | " AND tagxref.tagid=tag.tagid\n" |
| 2539 | 2498 | " AND tagxref.tagtype>=1\n" |
| 2540 | | - " AND fs.value=tagxref.value)," /* 7 */ |
| 2499 | + " AND fs.value=tagxref.value)," /* 6 */ |
| 2541 | 2500 | " (SELECT coalesce(fs.label,dfs.label)\n" |
| 2542 | 2501 | " FROM tag, tagxref, forumstatus fs\n" |
| 2543 | 2502 | " WHERE tag.tagname='status'\n" |
| 2544 | 2503 | " AND tagxref.tagid=tag.tagid\n" |
| 2545 | 2504 | " AND tagxref.tagtype>=1\n" |
| 2546 | | - " AND fs.value=tagxref.value)" /* 8 */ |
| 2505 | + " AND fs.value=tagxref.value)" /* 7 */ |
| 2547 | 2506 | " FROM thread, blob, event\n" |
| 2548 | 2507 | " LEFT JOIN forumstatus AS dfs ON (dfs.ord=1)\n" |
| 2549 | 2508 | " WHERE blob.rid=thread.last\n" |
| 2550 | 2509 | " AND event.objid=thread.last\n" |
| 2551 | | - " ORDER BY 7/*pinned*/ DESC, 1;", |
| 2510 | + " ORDER BY 1;", |
| 2552 | 2511 | g.perm.ModForum ? "" : "AND y.fpid NOT IN private" /*safe-for-%s*/, |
| 2553 | 2512 | g.perm.ModForum ? "true" : "fpid NOT IN private" /*safe-for-%s*/, |
| 2554 | 2513 | iLimit+1, iOfst |
| 2555 | 2514 | ); |
| 2556 | 2515 | while( db_step(&q)==SQLITE_ROW ){ |
| 2557 | 2516 | char *zAge = human_readable_age(db_column_double(&q,0)); |
| 2558 | 2517 | int nMsg = db_column_int(&q, 2); |
| 2559 | | - int bPinned = db_column_int(&q, 6); |
| 2560 | 2518 | const char *zUuid = db_column_text(&q, 3); |
| 2561 | 2519 | const char *zTitle = db_column_text(&q, 4); |
| 2562 | | - const char *zStatus = bHasStatus ? db_column_text(&q, 7) : NULL; |
| 2563 | | - const char *zStatusLbl = bHasStatus ? db_column_text(&q, 8) : NULL; |
| 2520 | + const char *zStatus = bHasStatus ? db_column_text(&q, 6) : NULL; |
| 2521 | + const char *zStatusLbl = bHasStatus ? db_column_text(&q, 7) : NULL; |
| 2564 | 2522 | const int bShowStatus = bHasStatus && !zStatusFilter; |
| 2565 | 2523 | const int nCols = bShowStatus ? 4 : 3; |
| 2566 | 2524 | if( iCnt==0 ){ |
| 2567 | 2525 | char * zTail = zStatusFilter |
| 2568 | 2526 | ? mprintf(" with status=%Q", zStatusFilter) |
| | @@ -2601,11 +2559,11 @@ |
| 2601 | 2559 | } |
| 2602 | 2560 | @ '>↓ Older...</a></td></tr> |
| 2603 | 2561 | fossil_free(zAge); |
| 2604 | 2562 | break; |
| 2605 | 2563 | } |
| 2606 | | - @ <tr%s(bPinned ? " class='pinned'" : "") |
| 2564 | + @ <tr \ |
| 2607 | 2565 | if( bHasStatus ){ |
| 2608 | 2566 | @ data-status="%h(zStatus)"\ |
| 2609 | 2567 | } |
| 2610 | 2568 | @ ><td>%h(zAge) ago</td> |
| 2611 | 2569 | @ <td class='subject'>%z(href("%R/forumpost/%S",zUuid))%h(zTitle)</a>\ |
| 2612 | 2570 | |