Making WordPress.org

Opened 22 months ago

Last modified 18 months ago

#5846 new defect (bug)

WPTV: Subtitle attachment info stays even after subtitle file is removed

Reported by: nao's profile Nao Owned by:
Milestone: Priority: normal
Component: WordPress.tv Keywords:
Cc:

Description (last modified by Nao)

When an approved subtitle file is deleted, it remains as approved subtitles. Because of this, a new file for the same language can't be uploaded.

Steps to reproduce:

  1. Upload a subtitle file
  2. Approve that subtitles
  3. Delete the subtitle file (WITHOUT unchecking ”approved”)
  4. The video still displays the subtitle language on the frontend sidebar, but if you click the language link you get an error: LOCALE is not a supported language (e.g. see the English (Canada) link, attached to this video)
  5. Also, from the backend of the video's attachment information, the subtitle seems not selected. In the example case above, the English (Canada) subtitle attachment ID value is 0 (admin link).

Expected behavior:
When an approved subtitle file is deleted, WPTV should consider that the video no longer has subtitles for the language.

Change History (4)

#1 @Nao
22 months ago

  • Description modified (diff)

This ticket was mentioned in Slack in #meta by nao. View the logs.


22 months ago

#3 @dd32
22 months ago

Just noting that I've cleaned some up manually:

https://wordpress.tv/2021/06/03/shusei-toda-block-editor-02-text-blocks/

wp> $subtitles = get_post_meta( 108717, '_videopress_subtitles', true );
=> array(3) {
  ["ja"]=>
  array(2) {
    ["language"]=>
    string(2) "ja"
    ["subtitles_post_id"]=>
    int(108792)
  }
  ["en"]=>
  array(2) {
    ["language"]=>
    string(2) "en"
    ["subtitles_post_id"]=>
    int(109539)
  }
  ["en-ca"]=>
  array(2) {
    ["language"]=>
    string(5) "en-ca"
    ["subtitles_post_id"]=>
    int(109540)
  }
}
wp> unset( $subtitles['en-ca'] );
wp> update_post_meta( 108717, '_videopress_subtitles', $subtitles );
=> bool(true)

https://wordpress.tv/2021/02/06/muhammad-muhsin-introduction-to-wordpress/

wp> $subtitles = get_post_meta( 107951, '_videopress_subtitles', true );
=> array(1) {
  ["en"]=>
  array(2) {
    ["language"]=>
    string(2) "en"
    ["subtitles_post_id"]=>
    int(107954)
  }
}
wp> unset( $subtitles['en'] );
wp> update_post_meta( 107951, '_videopress_subtitles', $subtitles );
=> bool(true)

#4 @tellyworth
18 months ago

Is there an easy technical fix that would clear the postmeta automatically when the file is deleted or missing?

Note: See TracTickets for help on using tickets.