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.

wyoung 2018-08-16 07:06 trunk
Commit 779eaaae81eeebd53fac71280f85c623900ed8299315664b1ab70df1f4aed80a
1 file changed +8 -1
+8 -1
--- src/forum.c
+++ src/forum.c
@@ -944,11 +944,12 @@
944944
" sum(fprev IS NULL) AS c," /* 2 */
945945
" (SELECT substr(uuid,1,10) FROM blob WHERE rid=froot)," /* 3 */
946946
" (SELECT substr(comment,instr(comment,':')+2)" /* 4 */
947947
" FROM event WHERE objid=(SELECT fpid FROM forumpost AS y"
948948
" WHERE y.froot=x.froot"
949
- " ORDER BY fmtime DESC LIMIT 1))"
949
+ " ORDER BY fmtime DESC LIMIT 1)),"
950
+ " fpid" /* 5 */
950951
" FROM forumpost AS x"
951952
" GROUP BY froot ORDER BY 1 LIMIT %d OFFSET %d;",
952953
iLimit+1, iOfst
953954
);
954955
while( db_step(&q)==SQLITE_ROW ){
@@ -955,10 +956,16 @@
955956
char *zAge = human_readable_age(db_column_double(&q,0));
956957
char *zDuration = 0;
957958
int nMsg = db_column_int(&q, 2);
958959
const char *zUuid = db_column_text(&q, 3);
959960
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;
960967
if( iCnt==0 ){
961968
if( iOfst>0 ){
962969
@ <h1>Threads at least %s(zAge) old</h1>
963970
}else{
964971
@ <h1>Most recent threads</h1>
965972
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button