Fossil SCM

Simplify the skip-pending-moderation check in attachment_list().

stephan 2026-05-24 09:04 UTC forum-attachments
Commit c72ac2aac740bde6f35a280b5a0e5fdb981af5b7cbca4b77443f46b6ea97f570
1 file changed +1 -6
+1 -6
--- src/attach.c
+++ src/attach.c
@@ -817,16 +817,11 @@
817817
const char *zTypeArg = 0; /* URL arg name for /attachdownload */
818818
const int aid = db_column_int(&q, 6);
819819
const int iAType = attachment_target_type(zTarget);
820820
if( (flags & ATTACHLIST_HIDE_UNAPPROVED)
821821
&& moderation_pending(aid)
822
- && !(g.perm.Admin
823
- || (g.perm.ModForum && CFTYPE_FORUM==iAType)
824
- || (g.perm.ModTkt && CFTYPE_TICKET==iAType)
825
- || (g.perm.ModWiki && CFTYPE_WIKI==iAType)
826
- || 0==fossil_strcmp(login_name(), zUser)
827
- ) ){
822
+ && !moderation_user_could(aid, 1, 0) ){
828823
continue;
829824
}
830825
if( cnt==0 ){
831826
@ <section class='attachlist'>
832827
if( flags & ATTACHLIST_HRULE_ABOVE ){
833828
--- src/attach.c
+++ src/attach.c
@@ -817,16 +817,11 @@
817 const char *zTypeArg = 0; /* URL arg name for /attachdownload */
818 const int aid = db_column_int(&q, 6);
819 const int iAType = attachment_target_type(zTarget);
820 if( (flags & ATTACHLIST_HIDE_UNAPPROVED)
821 && moderation_pending(aid)
822 && !(g.perm.Admin
823 || (g.perm.ModForum && CFTYPE_FORUM==iAType)
824 || (g.perm.ModTkt && CFTYPE_TICKET==iAType)
825 || (g.perm.ModWiki && CFTYPE_WIKI==iAType)
826 || 0==fossil_strcmp(login_name(), zUser)
827 ) ){
828 continue;
829 }
830 if( cnt==0 ){
831 @ <section class='attachlist'>
832 if( flags & ATTACHLIST_HRULE_ABOVE ){
833
--- src/attach.c
+++ src/attach.c
@@ -817,16 +817,11 @@
817 const char *zTypeArg = 0; /* URL arg name for /attachdownload */
818 const int aid = db_column_int(&q, 6);
819 const int iAType = attachment_target_type(zTarget);
820 if( (flags & ATTACHLIST_HIDE_UNAPPROVED)
821 && moderation_pending(aid)
822 && !moderation_user_could(aid, 1, 0) ){
 
 
 
 
 
823 continue;
824 }
825 if( cnt==0 ){
826 @ <section class='attachlist'>
827 if( flags & ATTACHLIST_HRULE_ABOVE ){
828

Keyboard Shortcuts

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