SparkDevNetwork / Rock

An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
http://www.rockrms.com
580 stars 353 forks source link

The showwhen parameter default value not working correctly for the Scheduled Content shortcode #5843

Closed JRichmond27 closed 6 months ago

JRichmond27 commented 7 months ago

Description

The showwhen parameter of the Scheduled Content shortcode does not appear to be defaulting to the value of live like the documentation says. It behaves more like the default value is both.

Actual Behavior

When the showwhen parameter is omitted, the shortcode output always includes the content even when the specified schedule is not currently live.

Expected Behavior

According to the documentation, the showwhen parameter should default to live, which means that the content should not be shown when the specified schedule is not currently active.

Steps to Reproduce

  1. Find the ID of a schedule that is not currently live.
  2. Add an HTML block to a page (or go to the Lava tester if installed)
  3. Paste in the following Lava and change the scheduleID to the non-live schedule you found:
    {% assign scheduleID = 1 %}
    <div><b>showwhen = <em>Blank</em></b></div>
    {[ scheduledcontent scheduleid:'{{ scheduleID }}' ]}
    IsLive: {{ IsLive }}<br>
    OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
    NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
    Schedule: {{ Schedule }}
    {[ endscheduledcontent ]}
    <br><br>
    <div><b>showwhen = live</b></div>
    {[ scheduledcontent showwhen:'live' scheduleid:'{{ scheduleID }}' ]}
    IsLive: {{ IsLive }}<br>
    OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
    NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
    Schedule: {{ Schedule }}
    {[ endscheduledcontent ]}
    <br><br>
    <div><b>showwhen = notlive</b></div>
    {[ scheduledcontent showwhen:'notlive' scheduleid:'{{ scheduleID }}' ]}
    IsLive: {{ IsLive }}<br>
    OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
    NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
    Schedule: {{ Schedule }}
    {[ endscheduledcontent ]}
    <br><br>
    <div><b>showwhen = both</b></div>
    {[ scheduledcontent showwhen:'both' scheduleid:'{{ scheduleID }}' ]}
    IsLive: {{ IsLive }}<br>
    OccurrenceEndDateTime: {{ OccurrenceEndDateTime }}<br>
    NextOccurrenceDateTime: {{ NextOccurrenceDateTime }}<br>
    Schedule: {{ Schedule }}
    {[ endscheduledcontent ]}
  4. Run the Lava and notice that the content of the first scheduledcontent shortcode reference is being displayed even though it should be defaulting to only show the content when the schedule is live.

Issue Confirmation

Rock Version

16.2 & 16.3

Client Culture Setting

en-US