Skip to content

Internal Communication View block cannot page past the second item (Take/Skip reversed) #7014

Description

@azturner

Description

Submitted on behalf of Christ's Church of the Valley (CCV)

The Internal Communication View block (RockWeb/Blocks/Utility/InternalCommunicationView.ascx.cs) can never navigate past the two most recent content channel items, regardless of how many approved items the channel contains.

The cause is the order of Take() and Skip() when the items are queried in ShowView():

var contentChannelItems = contentChannelItemsQry.OrderByDescending( i => i.StartDateTime )
    .Take( 2 )
    .Skip( _currentPage )
    .ToList();

Because Take(2) runs first, the query is always limited to the two newest items before the page offset is applied. On page 1 the result is a single item, so showPrev = (contentChannelItems.Count > 1) becomes false and the Previous button is hidden — every item older than the second-newest is unreachable. Page 2 would return zero rows.

Swapping the two calls fixes paging:

var contentChannelItems = contentChannelItemsQry.OrderByDescending( i => i.StartDateTime )
    .Skip( _currentPage )
    .Take( 2 )
    .ToList();

This returns the current item plus one older item, so showPrev correctly reflects whether anything older exists.

Actual Behavior

The block shows the newest item with a Previous chevron. Clicking Previous once shows the second-newest item, and the Previous chevron disappears even though older approved items exist in the channel. Items three and beyond can never be displayed.

Expected Behavior

Clicking Previous should continue paging back through all approved, active items in the channel, one at a time, with the Previous chevron disappearing only on the oldest item.

Steps to Reproduce

  1. Log in to the demo site as admin and note the Internal Communication View block on the internal homepage (the news panel with previous/next chevrons, wired to the "Internal Communication" content channel).
  2. Ensure the channel has at least 3 items with Status = Approved and staggered past Start Dates (e.g., today, yesterday, two days ago) — add items via CMS Configuration > Content Channels > Internal Communication if needed.
  3. Return to the homepage. The newest item is shown with a Previous chevron.
  4. Click Previous once. The second item is shown and the Previous chevron disappears; the third and older items cannot be reached.

Note: the block's cache only applies to page 0, so caching does not mask the behavior.

Issue Confirmation

  • Perform a search on the Github Issues to see if your bug is already reported.
  • Reproduced the problem on a fresh install or on the demo site.

Rock Version

19.4

Client Culture Setting

en-US

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in v19.5Status: ConfirmedIt's clear what the subject of the issue is about, and what the resolution should be.Topic: CMSRelated to data and components primarily for the external website.Topic: CommunicationsRelated to Rock Communications: Email, SMS, MMS, Push Notifications, etc.Type: BugConfirmed bugs or reports that are very likely to be bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions