This commit is contained in:
Markos Gogoulos 2025-10-21 10:27:21 +03:00
parent 7acf748c24
commit f65338562e
3 changed files with 31 additions and 25 deletions

View File

@ -629,10 +629,12 @@ def view_media(request):
if request.user.is_authenticated: if request.user.is_authenticated:
if request.user.has_contributor_access_to_media(media) or is_mediacms_editor(request.user): if request.user.has_contributor_access_to_media(media) or is_mediacms_editor(request.user):
context["CAN_DELETE_MEDIA"] = True
context["CAN_EDIT_MEDIA"] = True context["CAN_EDIT_MEDIA"] = True
context["CAN_DELETE_COMMENTS"] = True context["CAN_DELETE_COMMENTS"] = True
if request.user == media.user or is_mediacms_editor(request.user):
context["CAN_DELETE_MEDIA"] = True
# in case media is video and is processing (eg the case a video was just uploaded) # in case media is video and is processing (eg the case a video was just uploaded)
# attempt to show it (rather than showing a blank video player) # attempt to show it (rather than showing a blank video player)
if media.media_type == 'video': if media.media_type == 'video':

View File

@ -217,33 +217,37 @@ export default function ViewerInfoContent(props) {
/> />
) : null} ) : null}
{userCan.editMedia || userCan.deleteMedia ? ( {userCan.editMedia ? (
<div className="media-author-actions"> <div className="media-author-actions">
{userCan.editMedia ? <EditMediaButton link={MediaPageStore.get('media-data').edit_url} /> : null} {userCan.editMedia ? <EditMediaButton link={MediaPageStore.get('media-data').edit_url} /> : null}
<PopupTrigger contentRef={popupContentRef}> {userCan.deleteMedia ? (
<button className="remove-media-icon" title={translateString('Delete media')}> <PopupTrigger contentRef={popupContentRef}>
<i className="material-icons">delete</i> <button className="remove-media-icon" title={translateString('Delete media')}>
</button> <i className="material-icons">delete</i>
</PopupTrigger> </button>
</PopupTrigger>
) : null}
<PopupContent contentRef={popupContentRef}> {userCan.deleteMedia ? (
<PopupMain> <PopupContent contentRef={popupContentRef}>
<div className="popup-message"> <PopupMain>
<span className="popup-message-title">Media removal</span> <div className="popup-message">
<span className="popup-message-main">You're willing to remove media permanently?</span> <span className="popup-message-title">Media removal</span>
</div> <span className="popup-message-main">You're willing to remove media permanently?</span>
<hr /> </div>
<span className="popup-message-bottom"> <hr />
<button className="button-link cancel-comment-removal" onClick={cancelMediaRemoval}> <span className="popup-message-bottom">
CANCEL <button className="button-link cancel-comment-removal" onClick={cancelMediaRemoval}>
</button> CANCEL
<button className="button-link proceed-comment-removal" onClick={proceedMediaRemoval}> </button>
PROCEED <button className="button-link proceed-comment-removal" onClick={proceedMediaRemoval}>
</button> PROCEED
</span> </button>
</PopupMain> </span>
</PopupContent> </PopupMain>
</PopupContent>
) : null}
</div> </div>
) : null} ) : null}
</div> </div>

File diff suppressed because one or more lines are too long