Fossil SCM

Only show the "Moderation Requests" submenu button if there exist one or more posts in need of moderation.

drh 2018-07-31 17:13 forum-v2
Commit 397c32b6bbf461f893bf25512355a1f13f87ecb7a5c9a58bbbef425ee703893a
2 files changed +1 -1 +9
+1 -1
--- src/forum.c
+++ src/forum.c
@@ -913,11 +913,11 @@
913913
}
914914
style_header("Forum");
915915
if( g.perm.WrForum ){
916916
style_submenu_element("New Message","%R/forumnew");
917917
}
918
- if( g.perm.ModForum ){
918
+ if( g.perm.ModForum && moderation_needed() ){
919919
style_submenu_element("Moderation Requests", "%R/modreq");
920920
}
921921
if( search_screen(SRCH_FORUM, 0) ){
922922
style_submenu_element("Recent Threads","%R/forum");
923923
style_footer();
924924
--- src/forum.c
+++ src/forum.c
@@ -913,11 +913,11 @@
913 }
914 style_header("Forum");
915 if( g.perm.WrForum ){
916 style_submenu_element("New Message","%R/forumnew");
917 }
918 if( g.perm.ModForum ){
919 style_submenu_element("Moderation Requests", "%R/modreq");
920 }
921 if( search_screen(SRCH_FORUM, 0) ){
922 style_submenu_element("Recent Threads","%R/forum");
923 style_footer();
924
--- src/forum.c
+++ src/forum.c
@@ -913,11 +913,11 @@
913 }
914 style_header("Forum");
915 if( g.perm.WrForum ){
916 style_submenu_element("New Message","%R/forumnew");
917 }
918 if( g.perm.ModForum && moderation_needed() ){
919 style_submenu_element("Moderation Requests", "%R/modreq");
920 }
921 if( search_screen(SRCH_FORUM, 0) ){
922 style_submenu_element("Recent Threads","%R/forum");
923 style_footer();
924
--- src/moderate.c
+++ src/moderate.c
@@ -70,10 +70,19 @@
7070
@ <span class="modpending">(Awaiting Moderator Approval)</span>
7171
}
7272
return pending;
7373
}
7474
75
+
76
+/*
77
+** Return TRUE if there any pending moderation requests.
78
+*/
79
+int moderation_needed(void){
80
+ if( !moderation_table_exists() ) return 0;
81
+ return db_exists("SELECT 1 FROM modreq");
82
+}
83
+
7584
/*
7685
** Check to see if the object identified by RID is used for anything.
7786
*/
7887
static int object_used(int rid){
7988
static const char *const aTabField[] = {
8089
--- src/moderate.c
+++ src/moderate.c
@@ -70,10 +70,19 @@
70 @ <span class="modpending">(Awaiting Moderator Approval)</span>
71 }
72 return pending;
73 }
74
 
 
 
 
 
 
 
 
 
75 /*
76 ** Check to see if the object identified by RID is used for anything.
77 */
78 static int object_used(int rid){
79 static const char *const aTabField[] = {
80
--- src/moderate.c
+++ src/moderate.c
@@ -70,10 +70,19 @@
70 @ <span class="modpending">(Awaiting Moderator Approval)</span>
71 }
72 return pending;
73 }
74
75
76 /*
77 ** Return TRUE if there any pending moderation requests.
78 */
79 int moderation_needed(void){
80 if( !moderation_table_exists() ) return 0;
81 return db_exists("SELECT 1 FROM modreq");
82 }
83
84 /*
85 ** Check to see if the object identified by RID is used for anything.
86 */
87 static int object_used(int rid){
88 static const char *const aTabField[] = {
89

Keyboard Shortcuts

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