Fossil SCM

Try to make moderation a little easier, as recent experience suggests that will be a big deal with the forum.

drh 2018-07-31 17:05 forum-v2
Commit a9e5a1eefd71c5b7f48474197f59573675768ceb5fe29fa5f7f763d96f7b7082
+3 -8
--- src/attach.c
+++ src/attach.c
@@ -106,15 +106,13 @@
106106
}else{
107107
zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
108108
}
109109
@ <li><p>
110110
@ Attachment %z(href("%R/ainfo/%!S",zUuid))%S(zUuid)</a>
111
- if( moderation_pending(attachid) ){
112
- @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
113
- }
111
+ moderation_pending_www(attachid);
114112
@ <br /><a href="%R/attachview?%s(zUrlTail)">%h(zFilename)</a>
115
- @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
113
+ @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br>
116114
if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
117115
if( zComment && zComment[0] ){
118116
@ %!W(zComment)<br />
119117
}
120118
if( zPage==0 && zTkt==0 && zTechNote==0 ){
@@ -564,14 +562,11 @@
564562
@ <tr><th>Artifact&nbsp;ID:</th>
565563
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
566564
if( g.perm.Setup ){
567565
@ (%d(rid))
568566
}
569
- modPending = moderation_pending(rid);
570
- if( modPending ){
571
- @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
572
- }
567
+ modPending = moderation_pending_www(rid);
573568
if( zTktUuid ){
574569
@ <tr><th>Ticket:</th>
575570
@ <td>%z(href("%R/tktview/%s",zTktUuid))%s(zTktUuid)</a></td></tr>
576571
}
577572
if( zTNUuid ){
578573
--- src/attach.c
+++ src/attach.c
@@ -106,15 +106,13 @@
106 }else{
107 zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
108 }
109 @ <li><p>
110 @ Attachment %z(href("%R/ainfo/%!S",zUuid))%S(zUuid)</a>
111 if( moderation_pending(attachid) ){
112 @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
113 }
114 @ <br /><a href="%R/attachview?%s(zUrlTail)">%h(zFilename)</a>
115 @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br />
116 if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
117 if( zComment && zComment[0] ){
118 @ %!W(zComment)<br />
119 }
120 if( zPage==0 && zTkt==0 && zTechNote==0 ){
@@ -564,14 +562,11 @@
564 @ <tr><th>Artifact&nbsp;ID:</th>
565 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
566 if( g.perm.Setup ){
567 @ (%d(rid))
568 }
569 modPending = moderation_pending(rid);
570 if( modPending ){
571 @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
572 }
573 if( zTktUuid ){
574 @ <tr><th>Ticket:</th>
575 @ <td>%z(href("%R/tktview/%s",zTktUuid))%s(zTktUuid)</a></td></tr>
576 }
577 if( zTNUuid ){
578
--- src/attach.c
+++ src/attach.c
@@ -106,15 +106,13 @@
106 }else{
107 zUrlTail = mprintf("page=%t&file=%t", zTarget, zFilename);
108 }
109 @ <li><p>
110 @ Attachment %z(href("%R/ainfo/%!S",zUuid))%S(zUuid)</a>
111 moderation_pending_www(attachid);
 
 
112 @ <br /><a href="%R/attachview?%s(zUrlTail)">%h(zFilename)</a>
113 @ [<a href="%R/attachdownload/%t(zFilename)?%s(zUrlTail)">download</a>]<br>
114 if( zComment ) while( fossil_isspace(zComment[0]) ) zComment++;
115 if( zComment && zComment[0] ){
116 @ %!W(zComment)<br />
117 }
118 if( zPage==0 && zTkt==0 && zTechNote==0 ){
@@ -564,14 +562,11 @@
562 @ <tr><th>Artifact&nbsp;ID:</th>
563 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
564 if( g.perm.Setup ){
565 @ (%d(rid))
566 }
567 modPending = moderation_pending_www(rid);
 
 
 
568 if( zTktUuid ){
569 @ <tr><th>Ticket:</th>
570 @ <td>%z(href("%R/tktview/%s",zTktUuid))%s(zTktUuid)</a></td></tr>
571 }
572 if( zTNUuid ){
573
--- src/forum.c
+++ src/forum.c
@@ -913,10 +913,13 @@
913913
}
914914
style_header("Forum");
915915
if( g.perm.WrForum ){
916916
style_submenu_element("New Message","%R/forumnew");
917917
}
918
+ if( g.perm.ModForum ){
919
+ style_submenu_element("Moderation Requests", "%R/modreq");
920
+ }
918921
if( search_screen(SRCH_FORUM, 0) ){
919922
style_submenu_element("Recent Threads","%R/forum");
920923
style_footer();
921924
return;
922925
}
923926
--- src/forum.c
+++ src/forum.c
@@ -913,10 +913,13 @@
913 }
914 style_header("Forum");
915 if( g.perm.WrForum ){
916 style_submenu_element("New Message","%R/forumnew");
917 }
 
 
 
918 if( search_screen(SRCH_FORUM, 0) ){
919 style_submenu_element("Recent Threads","%R/forum");
920 style_footer();
921 return;
922 }
923
--- src/forum.c
+++ src/forum.c
@@ -913,10 +913,13 @@
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 return;
925 }
926
+2 -8
--- src/info.c
+++ src/info.c
@@ -935,14 +935,11 @@
935935
@ <tr><th>Artifact&nbsp;ID:</th>
936936
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
937937
if( g.perm.Setup ){
938938
@ (%d(rid))
939939
}
940
- modPending = moderation_pending(rid);
941
- if( modPending ){
942
- @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
943
- }
940
+ modPending = moderation_pending_www(rid);
944941
@ </td></tr>
945942
@ <tr><th>Page&nbsp;Name:</th><td>%h(pWiki->zWikiTitle)</td></tr>
946943
@ <tr><th>Date:</th><td>
947944
hyperlink_to_date(zDate, "</td></tr>");
948945
@ <tr><th>Original&nbsp;User:</th><td>
@@ -2237,14 +2234,11 @@
22372234
@ <tr><th>Artifact&nbsp;ID:</th>
22382235
@ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
22392236
if( g.perm.Setup ){
22402237
@ (%d(rid))
22412238
}
2242
- modPending = moderation_pending(rid);
2243
- if( modPending ){
2244
- @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
2245
- }
2239
+ modPending = moderation_pending_www(rid);
22462240
@ <tr><th>Ticket:</th>
22472241
@ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
22482242
if( zTktTitle ){
22492243
@<br />%h(zTktTitle)
22502244
}
22512245
--- src/info.c
+++ src/info.c
@@ -935,14 +935,11 @@
935 @ <tr><th>Artifact&nbsp;ID:</th>
936 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
937 if( g.perm.Setup ){
938 @ (%d(rid))
939 }
940 modPending = moderation_pending(rid);
941 if( modPending ){
942 @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
943 }
944 @ </td></tr>
945 @ <tr><th>Page&nbsp;Name:</th><td>%h(pWiki->zWikiTitle)</td></tr>
946 @ <tr><th>Date:</th><td>
947 hyperlink_to_date(zDate, "</td></tr>");
948 @ <tr><th>Original&nbsp;User:</th><td>
@@ -2237,14 +2234,11 @@
2237 @ <tr><th>Artifact&nbsp;ID:</th>
2238 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
2239 if( g.perm.Setup ){
2240 @ (%d(rid))
2241 }
2242 modPending = moderation_pending(rid);
2243 if( modPending ){
2244 @ <span class="modpending">*** Awaiting Moderator Approval ***</span>
2245 }
2246 @ <tr><th>Ticket:</th>
2247 @ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
2248 if( zTktTitle ){
2249 @<br />%h(zTktTitle)
2250 }
2251
--- src/info.c
+++ src/info.c
@@ -935,14 +935,11 @@
935 @ <tr><th>Artifact&nbsp;ID:</th>
936 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
937 if( g.perm.Setup ){
938 @ (%d(rid))
939 }
940 modPending = moderation_pending_www(rid);
 
 
 
941 @ </td></tr>
942 @ <tr><th>Page&nbsp;Name:</th><td>%h(pWiki->zWikiTitle)</td></tr>
943 @ <tr><th>Date:</th><td>
944 hyperlink_to_date(zDate, "</td></tr>");
945 @ <tr><th>Original&nbsp;User:</th><td>
@@ -2237,14 +2234,11 @@
2234 @ <tr><th>Artifact&nbsp;ID:</th>
2235 @ <td>%z(href("%R/artifact/%!S",zUuid))%s(zUuid)</a>
2236 if( g.perm.Setup ){
2237 @ (%d(rid))
2238 }
2239 modPending = moderation_pending_www(rid);
 
 
 
2240 @ <tr><th>Ticket:</th>
2241 @ <td>%z(href("%R/tktview/%s",zTktName))%s(zTktName)</a>
2242 if( zTktTitle ){
2243 @<br />%h(zTktTitle)
2244 }
2245
+17 -2
--- src/moderate.c
+++ src/moderate.c
@@ -54,10 +54,25 @@
5454
db_bind_int(&q, ":objid", rid);
5555
rc = db_step(&q)==SQLITE_ROW;
5656
db_reset(&q);
5757
return rc;
5858
}
59
+
60
+/*
61
+** If the rid object is being held for moderation, write out
62
+** an "awaiting moderation" message and return true.
63
+**
64
+** If the object is not being held for moderation, simply return
65
+** false without generating any output.
66
+*/
67
+int moderation_pending_www(int rid){
68
+ int pending = moderation_pending(rid);
69
+ if( pending ){
70
+ @ <span class="modpending">(Awaiting Moderator Approval)</span>
71
+ }
72
+ return pending;
73
+}
5974
6075
/*
6176
** Check to see if the object identified by RID is used for anything.
6277
*/
6378
static int object_used(int rid){
@@ -147,12 +162,12 @@
147162
void modreq_page(void){
148163
Blob sql;
149164
Stmt q;
150165
151166
login_check_credentials();
152
- if( !g.perm.ModWiki && !g.perm.ModTkt ){
153
- login_needed(g.anon.ModWiki && g.anon.ModTkt);
167
+ if( !g.perm.ModWiki && !g.perm.ModTkt && !g.perm.ModForum ){
168
+ login_needed(g.anon.ModWiki && g.anon.ModTkt && g.anon.ModForum);
154169
return;
155170
}
156171
style_header("Pending Moderation Requests");
157172
@ <h2>All Pending Moderation Requests</h2>
158173
if( moderation_table_exists() ){
159174
--- src/moderate.c
+++ src/moderate.c
@@ -54,10 +54,25 @@
54 db_bind_int(&q, ":objid", rid);
55 rc = db_step(&q)==SQLITE_ROW;
56 db_reset(&q);
57 return rc;
58 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
60 /*
61 ** Check to see if the object identified by RID is used for anything.
62 */
63 static int object_used(int rid){
@@ -147,12 +162,12 @@
147 void modreq_page(void){
148 Blob sql;
149 Stmt q;
150
151 login_check_credentials();
152 if( !g.perm.ModWiki && !g.perm.ModTkt ){
153 login_needed(g.anon.ModWiki && g.anon.ModTkt);
154 return;
155 }
156 style_header("Pending Moderation Requests");
157 @ <h2>All Pending Moderation Requests</h2>
158 if( moderation_table_exists() ){
159
--- src/moderate.c
+++ src/moderate.c
@@ -54,10 +54,25 @@
54 db_bind_int(&q, ":objid", rid);
55 rc = db_step(&q)==SQLITE_ROW;
56 db_reset(&q);
57 return rc;
58 }
59
60 /*
61 ** If the rid object is being held for moderation, write out
62 ** an "awaiting moderation" message and return true.
63 **
64 ** If the object is not being held for moderation, simply return
65 ** false without generating any output.
66 */
67 int moderation_pending_www(int rid){
68 int pending = moderation_pending(rid);
69 if( pending ){
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){
@@ -147,12 +162,12 @@
162 void modreq_page(void){
163 Blob sql;
164 Stmt q;
165
166 login_check_credentials();
167 if( !g.perm.ModWiki && !g.perm.ModTkt && !g.perm.ModForum ){
168 login_needed(g.anon.ModWiki && g.anon.ModTkt && g.anon.ModForum);
169 return;
170 }
171 style_header("Pending Moderation Requests");
172 @ <h2>All Pending Moderation Requests</h2>
173 if( moderation_table_exists() ){
174

Keyboard Shortcuts

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