Fossil

Check-in [779eaaae]
Login

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

Overview
Comment: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.)

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | hide-post-if-needmod
Files: files | file ages | folders
SHA3-256:779eaaae81eeebd53fac71280f85c623900ed8299315664b1ab70df1f4aed80a
User & Date: wyoung 2018-08-16 07:06:25
Original Comment: 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.
Context
2018-08-16
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
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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%%">