Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-73692

Add support for missing timestamps to rss block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.0.7, 4.1.2
    • 3.9.12, 3.9.14, 3.10.9, 3.11.5, 3.11.6, 3.11.7, 3.11.11, 4.0, 4.0.1, 4.0.5, 4.0.6, 4.1
    • Blocks, RSS
    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-73692-401-Add-support-for-missing-timestamps-to-rss-block
    • MDL-73692-master-Add-support-for-missing-timestamps-to-rss-block
    • Easy
    • Hide

      Empty date test:

      1. Provide an rss feed which does NOT have a "timestamp" field, e.g. http://www.nerdragecomic.com/feed.xml.
      2. Go to Site Administration / Plugins / Manage Blocks and click on the eye symbol to activate "Remote RSS feeds".
      3. Click on the "Settings" link for "Remote RSS feeds" and then click on the "Add/edit feeds" link. Click on the button "Add a new feed". Enter in the URl field "http://www.nerdragecomic.com/feed.xml" (or any other rss feed with no timestamp) and choose a custom title, e.g. "Test feed". Click on the button "Add a new feed" to save this.
      4. Go to your Dashboard and activate Edit mode. Click to "Add a block" and choose "Remote RSS feeds". Back on your dashboard click on the cog wheel in the new block "Remote RSS feeds" and select "Configure Remote news feed block". Set "Display each link's description?" to "Yes". Choose the "Test feed" in the field "Choose the feeds which you would like to make available in this block" and click on "Save changes".
      5. Confirm the rss feed does NOT show the unix startdate 1970-01-01 but an empty string.

      Test with date:

      1. Provide an rss feed which DOES have a "timestamp" field, e.g. https://stackoverflow.com/feeds/question/501643
      2. Go to Site Administration / Plugins / Manage Blocks and click on the eye symbol to activate "Remote RSS feeds".
      3. Click on the "Settings" link for "Remote RSS feeds" and then click on the "Add/edit feeds" link. Click on the button "Add a new feed". Enter in the URl field "https://stackoverflow.com/feeds/question/501643" (or any other rss feed with a timestamp) and choose a custom title, e.g. "Test feed". Click on the button "Add a new feed" to save this.
      4. Go to your Dashboard and activate Edit mode. Click to "Add a block" and choose "Remote RSS feeds". Back on your dashboard click on the cog wheel in the new block "Remote RSS feeds" and select "Configure Remote news feed block". Set "Display each link's description?" to "Yes". Choose the "Test feed" in the field "Choose the feeds which you would like to make available in this block" and click on "Save changes".
      5. Confirm the rss feed DOES show the date in a human readable format.
      Show
      Empty date test: Provide an rss feed which does NOT have a "timestamp" field, e.g. http://www.nerdragecomic.com/feed.xml . Go to Site Administration / Plugins / Manage Blocks and click on the eye symbol to activate "Remote RSS feeds". Click on the "Settings" link for "Remote RSS feeds" and then click on the "Add/edit feeds" link. Click on the button "Add a new feed". Enter in the URl field " http://www.nerdragecomic.com/feed.xml " (or any other rss feed with no timestamp) and choose a custom title, e.g. "Test feed". Click on the button "Add a new feed" to save this. Go to your Dashboard and activate Edit mode. Click to "Add a block" and choose "Remote RSS feeds". Back on your dashboard click on the cog wheel in the new block "Remote RSS feeds" and select "Configure Remote news feed block". Set "Display each link's description?" to "Yes". Choose the "Test feed" in the field "Choose the feeds which you would like to make available in this block" and click on "Save changes". Confirm the rss feed does NOT show the unix startdate 1970-01-01 but an empty string. Test with date: Provide an rss feed which DOES have a "timestamp" field, e.g. https://stackoverflow.com/feeds/question/501643 Go to Site Administration / Plugins / Manage Blocks and click on the eye symbol to activate "Remote RSS feeds". Click on the "Settings" link for "Remote RSS feeds" and then click on the "Add/edit feeds" link. Click on the button "Add a new feed". Enter in the URl field " https://stackoverflow.com/feeds/question/501643 " (or any other rss feed with a timestamp) and choose a custom title, e.g. "Test feed". Click on the button "Add a new feed" to save this. Go to your Dashboard and activate Edit mode. Click to "Add a block" and choose "Remote RSS feeds". Back on your dashboard click on the cog wheel in the new block "Remote RSS feeds" and select "Configure Remote news feed block". Set "Display each link's description?" to "Yes". Choose the "Test feed" in the field "Choose the feeds which you would like to make available in this block" and click on "Save changes". Confirm the rss feed DOES show the date in a human readable format.

      When you add an rss resource to your rss block which does not pass a timestamp, the rss feed shows the unix startdate 1970-01-01.

      This is confusing and unattractive. I would expect to see no date at all (or a hint, that there is no date submitted).

       

      I think this can be easily fixed by adding one line to blocks/rss_client/classes/output/renderer.php:

      public function format_published_date($timestamp) {
         if (empty($timestamp)) {
                  return '';
              } else {
                  return strftime(get_string('strftimerecentfull', 'langconfig'), $timestamp);
              }
      }

       

       

        1. 400.png
          400.png
          305 kB
        2. 401.png
          401.png
          342 kB
        3. master.png
          master.png
          225 kB

            melanie.treitinger@ruhr-uni-bochum.de Melanie Treitinger
            melanie.treitinger@ruhr-uni-bochum.de Melanie Treitinger
            Amaia Anabitarte Amaia Anabitarte
            Paul Holden Paul Holden
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 13 minutes
                2h 13m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.