Fossil SCM

Fix: users can now cancel their own pending-moderation attachments.

stephan 2026-05-24 09:54 UTC forum-attachments
Commit 2005cc0a9f7970b6bcc6c4d19b626717c46a7262292a69df90acff9211d182fe
1 file changed +7 -5
+7 -5
--- src/attach.c
+++ src/attach.c
@@ -574,11 +574,11 @@
574574
rid = name_to_rid_www("name");
575575
if( rid==0 ){ fossil_redirect_home(); }
576576
zUuid = rid_to_uuid(rid);
577577
pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0);
578578
if( pAttach==0 ) fossil_redirect_home();
579
- bUserIsOwner = fossil_strcmp(pAttach->zUser, login_name());
579
+ bUserIsOwner = 0==fossil_strcmp(pAttach->zUser, login_name());
580580
zTarget = pAttach->zAttachTarget;
581581
zSrc = pAttach->zAttachSrc;
582582
ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%q'", zSrc);
583583
zName = pAttach->zAttachName;
584584
zDesc = pAttach->zComment;
@@ -665,11 +665,11 @@
665665
(zTktUuid && g.perm.ModTkt) ||
666666
(zWikiName && g.perm.ModWiki);
667667
zModAction = P("modaction");
668668
if( zModAction!=0 ){
669669
if( strcmp(zModAction,"delete")==0 ){
670
- if( isModerator ){
670
+ if( isModerator || bUserIsOwner ){
671671
moderation_disapprove(rid);
672672
}
673673
if( zForumPost ){
674674
cgi_redirectf("%R/forumpost/%!S", zForumPost);
675675
}else if( zTktUuid ){
@@ -728,18 +728,20 @@
728728
@ <tr><th>MIME-Type:</th><td>%h(zMime)</td></tr>
729729
}
730730
@ <tr><th valign="top">Description:</th><td valign="top">%h(zDesc)</td></tr>
731731
@ </table>
732732
733
- if( isModerator && modPending ){
733
+ if( modPending && (isModerator || bUserIsOwner) ){
734734
@ <div class="section">Moderation</div>
735735
@ <blockquote>
736736
form_begin(0, "%R/ainfo/%s", zUuid);
737737
@ <label><input type="radio" name="modaction" value="delete">
738738
@ Delete this change</label><br>
739
- @ <label><input type="radio" name="modaction" value="approve">
740
- @ Approve this change</label><br>
739
+ if( isModerator ){
740
+ @ <label><input type="radio" name="modaction" value="approve">
741
+ @ Approve this change</label><br>
742
+ }
741743
@ <input type="submit" value="Submit">
742744
@ </form>
743745
@ </blockquote>
744746
}
745747
746748
--- src/attach.c
+++ src/attach.c
@@ -574,11 +574,11 @@
574 rid = name_to_rid_www("name");
575 if( rid==0 ){ fossil_redirect_home(); }
576 zUuid = rid_to_uuid(rid);
577 pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0);
578 if( pAttach==0 ) fossil_redirect_home();
579 bUserIsOwner = fossil_strcmp(pAttach->zUser, login_name());
580 zTarget = pAttach->zAttachTarget;
581 zSrc = pAttach->zAttachSrc;
582 ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%q'", zSrc);
583 zName = pAttach->zAttachName;
584 zDesc = pAttach->zComment;
@@ -665,11 +665,11 @@
665 (zTktUuid && g.perm.ModTkt) ||
666 (zWikiName && g.perm.ModWiki);
667 zModAction = P("modaction");
668 if( zModAction!=0 ){
669 if( strcmp(zModAction,"delete")==0 ){
670 if( isModerator ){
671 moderation_disapprove(rid);
672 }
673 if( zForumPost ){
674 cgi_redirectf("%R/forumpost/%!S", zForumPost);
675 }else if( zTktUuid ){
@@ -728,18 +728,20 @@
728 @ <tr><th>MIME-Type:</th><td>%h(zMime)</td></tr>
729 }
730 @ <tr><th valign="top">Description:</th><td valign="top">%h(zDesc)</td></tr>
731 @ </table>
732
733 if( isModerator && modPending ){
734 @ <div class="section">Moderation</div>
735 @ <blockquote>
736 form_begin(0, "%R/ainfo/%s", zUuid);
737 @ <label><input type="radio" name="modaction" value="delete">
738 @ Delete this change</label><br>
739 @ <label><input type="radio" name="modaction" value="approve">
740 @ Approve this change</label><br>
 
 
741 @ <input type="submit" value="Submit">
742 @ </form>
743 @ </blockquote>
744 }
745
746
--- src/attach.c
+++ src/attach.c
@@ -574,11 +574,11 @@
574 rid = name_to_rid_www("name");
575 if( rid==0 ){ fossil_redirect_home(); }
576 zUuid = rid_to_uuid(rid);
577 pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0);
578 if( pAttach==0 ) fossil_redirect_home();
579 bUserIsOwner = 0==fossil_strcmp(pAttach->zUser, login_name());
580 zTarget = pAttach->zAttachTarget;
581 zSrc = pAttach->zAttachSrc;
582 ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%q'", zSrc);
583 zName = pAttach->zAttachName;
584 zDesc = pAttach->zComment;
@@ -665,11 +665,11 @@
665 (zTktUuid && g.perm.ModTkt) ||
666 (zWikiName && g.perm.ModWiki);
667 zModAction = P("modaction");
668 if( zModAction!=0 ){
669 if( strcmp(zModAction,"delete")==0 ){
670 if( isModerator || bUserIsOwner ){
671 moderation_disapprove(rid);
672 }
673 if( zForumPost ){
674 cgi_redirectf("%R/forumpost/%!S", zForumPost);
675 }else if( zTktUuid ){
@@ -728,18 +728,20 @@
728 @ <tr><th>MIME-Type:</th><td>%h(zMime)</td></tr>
729 }
730 @ <tr><th valign="top">Description:</th><td valign="top">%h(zDesc)</td></tr>
731 @ </table>
732
733 if( modPending && (isModerator || bUserIsOwner) ){
734 @ <div class="section">Moderation</div>
735 @ <blockquote>
736 form_begin(0, "%R/ainfo/%s", zUuid);
737 @ <label><input type="radio" name="modaction" value="delete">
738 @ Delete this change</label><br>
739 if( isModerator ){
740 @ <label><input type="radio" name="modaction" value="approve">
741 @ Approve this change</label><br>
742 }
743 @ <input type="submit" value="Submit">
744 @ </form>
745 @ </blockquote>
746 }
747
748

Keyboard Shortcuts

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