Fossil

Check-in [a9e5a1ee]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Try to make moderation a little easier, as recent experience suggests that will be a big deal with the forum.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | forum-v2
Files: files | file ages | folders
SHA3-256: a9e5a1eefd71c5b7f48474197f59573675768ceb5fe29fa5f7f763d96f7b7082
User & Date: drh 2018-07-31 17:05:56
Context
2018-07-31
17:13
Only show the "Moderation Requests" submenu button if there exist one or more posts in need of moderation. check-in: 397c32b6 user: drh tags: forum-v2
17:05
Try to make moderation a little easier, as recent experience suggests that will be a big deal with the forum. check-in: a9e5a1ee user: drh tags: forum-v2
15:49
Fix the redirect that occurs after a forum post is rejected by the moderator. check-in: 6a667edb user: drh tags: forum-v2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/attach.c.

   104    104       }else if( type==2 ){
   105    105         zUrlTail = mprintf("technote=%s&file=%t", zTarget, zFilename);
   106    106       }else{
   107    107         zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
   108    108       }
   109    109       @ <li><p>
   110    110       @ Attachment %z(href("%R/ainfo/%!S",zUuid))%S(zUuid)</a>
   111         -    if( moderation_pending(attachid) ){
   112         -      @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
   113         -    }
          111  +    moderation_pending_www(attachid);
   114    112       @ <br /><a href="%R/attachview?%s(zUrlTail)">%h(zFilename)</a>
   115         -    @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
          113  +    @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br>
   116    114       if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
   117    115       if( zComment && zComment[0] ){
   118    116         @ %!W(zComment)<br />
   119    117       }
   120    118       if( zPage==0 && zTkt==0 && zTechNote==0 ){
   121    119         if( zSrc==0 || zSrc[0]==0 ){
   122    120           zSrc = "Deleted from";
................................................................................
   562    560     @ <div class="section">Overview</div>
   563    561     @ <p><table class="label-value">
   564    562     @ <tr><th>Artifact&nbsp;ID:</th>
   565    563     @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
   566    564     if( g.perm.Setup ){
   567    565       @ (%d(rid))
   568    566     }
   569         -  modPending = moderation_pending(rid);
   570         -  if( modPending ){
   571         -    @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
   572         -  }
          567  +  modPending = moderation_pending_www(rid);
   573    568     if( zTktUuid ){
   574    569       @ <tr><th>Ticket:</th>
   575    570       @ <td>%z(href("%R/tktview/%s",zTktUuid))%s(zTktUuid)</a></td></tr>
   576    571     }
   577    572     if( zTNUuid ){
   578    573       @ <tr><th>Tech Note:</th>
   579    574       @ <td>%z(href("%R/technote/%s",zTNUuid))%s(zTNUuid)</a></td></tr>

Changes to src/forum.c.

   911    911       login_needed(g.anon.RdForum);
   912    912       return;
   913    913     }
   914    914     style_header("Forum");
   915    915     if( g.perm.WrForum ){
   916    916       style_submenu_element("New Message","%R/forumnew");
   917    917     }
          918  +  if( g.perm.ModForum ){
          919  +    style_submenu_element("Moderation Requests", "%R/modreq");
          920  +  }
   918    921     if( search_screen(SRCH_FORUM, 0) ){
   919    922       style_submenu_element("Recent Threads","%R/forum");
   920    923       style_footer();
   921    924       return;
   922    925     }
   923    926     iLimit = 50;
   924    927     iOfst = 0;

Changes to src/info.c.

   933    933     @ <div class="section">Overview</div>
   934    934     @ <p><table class="label-value">
   935    935     @ <tr><th>Artifact&nbsp;ID:</th>
   936    936     @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
   937    937     if( g.perm.Setup ){
   938    938       @ (%d(rid))
   939    939     }
   940         -  modPending = moderation_pending(rid);
   941         -  if( modPending ){
   942         -    @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
   943         -  }
          940  +  modPending = moderation_pending_www(rid);
   944    941     @ </td></tr>
   945    942     @ <tr><th>Page&nbsp;Name:</th><td>%h(pWiki->zWikiTitle)</td></tr>
   946    943     @ <tr><th>Date:</th><td>
   947    944     hyperlink_to_date(zDate, "</td></tr>");
   948    945     @ <tr><th>Original&nbsp;User:</th><td>
   949    946     hyperlink_to_user(pWiki->zUser, zDate, "</td></tr>");
   950    947     if( pWiki->zMimetype ){
................................................................................
  2235   2232     @ <div class="section">Overview</div>
  2236   2233     @ <p><table class="label-value">
  2237   2234     @ <tr><th>Artifact&nbsp;ID:</th>
  2238   2235     @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
  2239   2236     if( g.perm.Setup ){
  2240   2237       @ (%d(rid))
  2241   2238     }
  2242         -  modPending = moderation_pending(rid);
  2243         -  if( modPending ){
  2244         -    @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
  2245         -  }
         2239  +  modPending = moderation_pending_www(rid);
  2246   2240     @ <tr><th>Ticket:</th>
  2247   2241     @ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
  2248   2242     if( zTktTitle ){
  2249   2243           @<br />%h(zTktTitle)
  2250   2244     }
  2251   2245     @</td></tr>
  2252   2246     @ <tr><th>User&nbsp;&amp;&nbsp;Date:</th><td>

Changes to src/moderate.c.

    52     52     if( rid==0 || !moderation_table_exists() ) return 0;
    53     53     db_static_prepare(&q, "SELECT 1 FROM modreq WHERE objid=:objid");
    54     54     db_bind_int(&q, ":objid", rid);
    55     55     rc = db_step(&q)==SQLITE_ROW;
    56     56     db_reset(&q);
    57     57     return rc;
    58     58   }
           59  +
           60  +/*
           61  +** If the rid object is being held for moderation, write out
           62  +** an "awaiting moderation" message and return true.
           63  +**
           64  +** If the object is not being held for moderation, simply return
           65  +** false without generating any output.
           66  +*/
           67  +int moderation_pending_www(int rid){
           68  +  int pending = moderation_pending(rid);
           69  +  if( pending ){
           70  +    @ <span class="modpending">(Awaiting Moderator Approval)</span>
           71  +  }
           72  +  return pending;
           73  +}
    59     74   
    60     75   /*
    61     76   ** Check to see if the object identified by RID is used for anything.
    62     77   */
    63     78   static int object_used(int rid){
    64     79     static const char *const aTabField[] = {
    65     80        "modreq",     "attachRid",
................................................................................
   145    160   ** Show all pending moderation request
   146    161   */
   147    162   void modreq_page(void){
   148    163     Blob sql;
   149    164     Stmt q;
   150    165   
   151    166     login_check_credentials();
   152         -  if( !g.perm.ModWiki && !g.perm.ModTkt ){
   153         -    login_needed(g.anon.ModWiki && g.anon.ModTkt);
          167  +  if( !g.perm.ModWiki && !g.perm.ModTkt && !g.perm.ModForum ){
          168  +    login_needed(g.anon.ModWiki && g.anon.ModTkt && g.anon.ModForum);
   154    169       return;
   155    170     }
   156    171     style_header("Pending Moderation Requests");
   157    172     @ <h2>All Pending Moderation Requests</h2>
   158    173     if( moderation_table_exists() ){
   159    174       blob_init(&sql, timeline_query_for_www(), -1);
   160    175       blob_append_sql(&sql,