Fossil SCM
Fix: users can now cancel their own pending-moderation attachments.
Commit
2005cc0a9f7970b6bcc6c4d19b626717c46a7262292a69df90acff9211d182fe
Parent
5e2c49b4a7d4355…
1 file changed
+7
-5
+7
-5
| --- src/attach.c | ||
| +++ src/attach.c | ||
| @@ -574,11 +574,11 @@ | ||
| 574 | 574 | rid = name_to_rid_www("name"); |
| 575 | 575 | if( rid==0 ){ fossil_redirect_home(); } |
| 576 | 576 | zUuid = rid_to_uuid(rid); |
| 577 | 577 | pAttach = manifest_get(rid, CFTYPE_ATTACHMENT, 0); |
| 578 | 578 | if( pAttach==0 ) fossil_redirect_home(); |
| 579 | - bUserIsOwner = fossil_strcmp(pAttach->zUser, login_name()); | |
| 579 | + bUserIsOwner = 0==fossil_strcmp(pAttach->zUser, login_name()); | |
| 580 | 580 | zTarget = pAttach->zAttachTarget; |
| 581 | 581 | zSrc = pAttach->zAttachSrc; |
| 582 | 582 | ridSrc = db_int(0,"SELECT rid FROM blob WHERE uuid='%q'", zSrc); |
| 583 | 583 | zName = pAttach->zAttachName; |
| 584 | 584 | zDesc = pAttach->zComment; |
| @@ -665,11 +665,11 @@ | ||
| 665 | 665 | (zTktUuid && g.perm.ModTkt) || |
| 666 | 666 | (zWikiName && g.perm.ModWiki); |
| 667 | 667 | zModAction = P("modaction"); |
| 668 | 668 | if( zModAction!=0 ){ |
| 669 | 669 | if( strcmp(zModAction,"delete")==0 ){ |
| 670 | - if( isModerator ){ | |
| 670 | + if( isModerator || bUserIsOwner ){ | |
| 671 | 671 | moderation_disapprove(rid); |
| 672 | 672 | } |
| 673 | 673 | if( zForumPost ){ |
| 674 | 674 | cgi_redirectf("%R/forumpost/%!S", zForumPost); |
| 675 | 675 | }else if( zTktUuid ){ |
| @@ -728,18 +728,20 @@ | ||
| 728 | 728 | @ <tr><th>MIME-Type:</th><td>%h(zMime)</td></tr> |
| 729 | 729 | } |
| 730 | 730 | @ <tr><th valign="top">Description:</th><td valign="top">%h(zDesc)</td></tr> |
| 731 | 731 | @ </table> |
| 732 | 732 | |
| 733 | - if( isModerator && modPending ){ | |
| 733 | + if( modPending && (isModerator || bUserIsOwner) ){ | |
| 734 | 734 | @ <div class="section">Moderation</div> |
| 735 | 735 | @ <blockquote> |
| 736 | 736 | form_begin(0, "%R/ainfo/%s", zUuid); |
| 737 | 737 | @ <label><input type="radio" name="modaction" value="delete"> |
| 738 | 738 | @ 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 | + } | |
| 741 | 743 | @ <input type="submit" value="Submit"> |
| 742 | 744 | @ </form> |
| 743 | 745 | @ </blockquote> |
| 744 | 746 | } |
| 745 | 747 | |
| 746 | 748 |
| --- 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 |