Fossil SCM
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.
Commit
779eaaae81eeebd53fac71280f85c623900ed8299315664b1ab70df1f4aed80a
Parent
8f47c3f653d87d5…
1 file changed
+8
-1
+8
-1
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -944,11 +944,12 @@ | ||
| 944 | 944 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 945 | 945 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| 946 | 946 | " (SELECT substr(comment,instr(comment,':')+2)" /* 4 */ |
| 947 | 947 | " FROM event WHERE objid=(SELECT fpid FROM forumpost AS y" |
| 948 | 948 | " WHERE y.froot=x.froot" |
| 949 | - " ORDER BY fmtime DESC LIMIT 1))" | |
| 949 | + " ORDER BY fmtime DESC LIMIT 1))," | |
| 950 | + " fpid" /* 5 */ | |
| 950 | 951 | " FROM forumpost AS x" |
| 951 | 952 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 952 | 953 | iLimit+1, iOfst |
| 953 | 954 | ); |
| 954 | 955 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -955,10 +956,16 @@ | ||
| 955 | 956 | char *zAge = human_readable_age(db_column_double(&q,0)); |
| 956 | 957 | char *zDuration = 0; |
| 957 | 958 | int nMsg = db_column_int(&q, 2); |
| 958 | 959 | const char *zUuid = db_column_text(&q, 3); |
| 959 | 960 | const char *zTitle = db_column_text(&q, 4); |
| 961 | + int fpid = db_column_int(&q, 5); | |
| 962 | + int needMod = content_is_private(fpid); | |
| 963 | + Manifest *pPost = manifest_get(fpid, CFTYPE_FORUM, 0); | |
| 964 | + int sameUser = login_is_individual() && pPost | |
| 965 | + && fossil_strcmp(pPost->zUser, g.zLogin)==0; | |
| 966 | + if( needMod && !g.perm.ModForum && !sameUser ) continue; | |
| 960 | 967 | if( iCnt==0 ){ |
| 961 | 968 | if( iOfst>0 ){ |
| 962 | 969 | @ <h1>Threads at least %s(zAge) old</h1> |
| 963 | 970 | }else{ |
| 964 | 971 | @ <h1>Most recent threads</h1> |
| 965 | 972 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -944,11 +944,12 @@ | |
| 944 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 945 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| 946 | " (SELECT substr(comment,instr(comment,':')+2)" /* 4 */ |
| 947 | " FROM event WHERE objid=(SELECT fpid FROM forumpost AS y" |
| 948 | " WHERE y.froot=x.froot" |
| 949 | " ORDER BY fmtime DESC LIMIT 1))" |
| 950 | " FROM forumpost AS x" |
| 951 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 952 | iLimit+1, iOfst |
| 953 | ); |
| 954 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -955,10 +956,16 @@ | |
| 955 | char *zAge = human_readable_age(db_column_double(&q,0)); |
| 956 | char *zDuration = 0; |
| 957 | int nMsg = db_column_int(&q, 2); |
| 958 | const char *zUuid = db_column_text(&q, 3); |
| 959 | const char *zTitle = db_column_text(&q, 4); |
| 960 | if( iCnt==0 ){ |
| 961 | if( iOfst>0 ){ |
| 962 | @ <h1>Threads at least %s(zAge) old</h1> |
| 963 | }else{ |
| 964 | @ <h1>Most recent threads</h1> |
| 965 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -944,11 +944,12 @@ | |
| 944 | " sum(fprev IS NULL) AS c," /* 2 */ |
| 945 | " (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */ |
| 946 | " (SELECT substr(comment,instr(comment,':')+2)" /* 4 */ |
| 947 | " FROM event WHERE objid=(SELECT fpid FROM forumpost AS y" |
| 948 | " WHERE y.froot=x.froot" |
| 949 | " ORDER BY fmtime DESC LIMIT 1))," |
| 950 | " fpid" /* 5 */ |
| 951 | " FROM forumpost AS x" |
| 952 | " GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;", |
| 953 | iLimit+1, iOfst |
| 954 | ); |
| 955 | while( db_step(&q)==SQLITE_ROW ){ |
| @@ -955,10 +956,16 @@ | |
| 956 | char *zAge = human_readable_age(db_column_double(&q,0)); |
| 957 | char *zDuration = 0; |
| 958 | int nMsg = db_column_int(&q, 2); |
| 959 | const char *zUuid = db_column_text(&q, 3); |
| 960 | const char *zTitle = db_column_text(&q, 4); |
| 961 | int fpid = db_column_int(&q, 5); |
| 962 | int needMod = content_is_private(fpid); |
| 963 | Manifest *pPost = manifest_get(fpid, CFTYPE_FORUM, 0); |
| 964 | int sameUser = login_is_individual() && pPost |
| 965 | && fossil_strcmp(pPost->zUser, g.zLogin)==0; |
| 966 | if( needMod && !g.perm.ModForum && !sameUser ) continue; |
| 967 | if( iCnt==0 ){ |
| 968 | if( iOfst>0 ){ |
| 969 | @ <h1>Threads at least %s(zAge) old</h1> |
| 970 | }else{ |
| 971 | @ <h1>Most recent threads</h1> |
| 972 |