Fossil

Changes On Branch hide-post-if-needmod
Login

Changes On Branch hide-post-if-needmod

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

Changes In Branch hide-post-if-needmod Excluding Merge-Ins

This is equivalent to a diff from 8f47c3f6 to 779eaaae

2018-08-16
07:21
Improved locality of a variable. No functional change. ... (check-in: 09103fd2 user: wyoung tags: trunk)
07:06
Posts are now hidden on the /forum page if they're marked as private (i.e. needing moderator attention) and they were posted by another user, except when the user is a moderator.

(Closed because a different method was implemented on trunk.) ... (Closed-Leaf check-in: 779eaaae user: wyoung tags: hide-post-if-needmod)

06:36
Replaced a declare-and-init line pair with a single define-with-value line. No functional change. ... (check-in: 8f47c3f6 user: wyoung tags: trunk)
02:03
Fix the hextoblob() function so that does not report out-of-memory if the size of the input string is zero bytes. This fixes the instances of "out-of-memory" reports when accessing the /alerts page without an argument. ... (check-in: 5519c6b8 user: drh tags: trunk)

Changes to src/forum.c.

942
943
944
945
946
947
948
949

950
951
952
953
954
955
956
957
958
959






960
961
962
963
964
965
966
      "  julianday('now') - max(fmtime) AS a,"                       /* 0 */
      "  max(fmtime) - min(fmtime) AS b,"                            /* 1 */
      "  sum(fprev IS NULL) AS c,"                                   /* 2 */
      "  (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot),"      /* 3 */
      "  (SELECT substr(comment,instr(comment,':')+2)"               /* 4 */
      "     FROM event WHERE objid=(SELECT fpid FROM forumpost AS y"
      "                              WHERE y.froot=x.froot"
      "                              ORDER BY fmtime DESC LIMIT 1))"

      " FROM forumpost AS x"
      " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;",
      iLimit+1, iOfst
    );
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = human_readable_age(db_column_double(&q,0));
      char *zDuration = 0;
      int nMsg = db_column_int(&q, 2);
      const char *zUuid = db_column_text(&q, 3);
      const char *zTitle = db_column_text(&q, 4);






      if( iCnt==0 ){
        if( iOfst>0 ){
          @ <h1>Threads at least %s(zAge) old</h1>
        }else{
          @ <h1>Most recent threads</h1>
        }
        @ <div class='fileage'><table width="100%%">







|
>










>
>
>
>
>
>







942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
      "  julianday('now') - max(fmtime) AS a,"                       /* 0 */
      "  max(fmtime) - min(fmtime) AS b,"                            /* 1 */
      "  sum(fprev IS NULL) AS c,"                                   /* 2 */
      "  (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot),"      /* 3 */
      "  (SELECT substr(comment,instr(comment,':')+2)"               /* 4 */
      "     FROM event WHERE objid=(SELECT fpid FROM forumpost AS y"
      "                              WHERE y.froot=x.froot"
      "                              ORDER BY fmtime DESC LIMIT 1)),"
      "  fpid"                                                       /* 5 */
      " FROM forumpost AS x"
      " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;",
      iLimit+1, iOfst
    );
    while( db_step(&q)==SQLITE_ROW ){
      char *zAge = human_readable_age(db_column_double(&q,0));
      char *zDuration = 0;
      int nMsg = db_column_int(&q, 2);
      const char *zUuid = db_column_text(&q, 3);
      const char *zTitle = db_column_text(&q, 4);
      int fpid = db_column_int(&q, 5);
      int needMod = content_is_private(fpid);
      Manifest *pPost = manifest_get(fpid, CFTYPE_FORUM, 0);
      int sameUser = login_is_individual() && pPost
                     && fossil_strcmp(pPost->zUser, g.zLogin)==0;
      if( needMod && !g.perm.ModForum && !sameUser ) continue;
      if( iCnt==0 ){
        if( iOfst>0 ){
          @ <h1>Threads at least %s(zAge) old</h1>
        }else{
          @ <h1>Most recent threads</h1>
        }
        @ <div class='fileage'><table width="100%%">