diff --git a/src/addon/mod/forum/providers/forum.ts b/src/addon/mod/forum/providers/forum.ts index 450593d75..2b354bfb8 100644 --- a/src/addon/mod/forum/providers/forum.ts +++ b/src/addon/mod/forum/providers/forum.ts @@ -599,7 +599,8 @@ export class AddonModForumProvider { * @param forceCache True to always get the value from cache. false otherwise. * @param siteId Site ID. If not defined, current site. * @return Promise resolved with an object with: - * - discussions: List of discussions. + * - discussions: List of discussions. Note that for every discussion in the list discussion.id is the main post ID but + * discussion ID is discussion.discussion. * - canLoadMore: True if there may be more discussions to load. */ getDiscussions(forumId: number, sortOrder?: number, page: number = 0, forceCache?: boolean, siteId?: string): Promise { diff --git a/src/addon/mod/forum/providers/helper.ts b/src/addon/mod/forum/providers/helper.ts index 001337358..99ca1b487 100644 --- a/src/addon/mod/forum/providers/helper.ts +++ b/src/addon/mod/forum/providers/helper.ts @@ -280,7 +280,8 @@ export class AddonModForumHelperProvider { const findDiscussion = (page: number): Promise => { return this.forumProvider.getDiscussions(forumId, undefined, page, false, siteId).then((response) => { if (response.discussions && response.discussions.length > 0) { - const discussion = response.discussions.find((discussion) => discussion.id == discussionId); + // Note that discussion.id is the main post ID but discussion ID is discussion.discussion. + const discussion = response.discussions.find((discussion) => discussion.discussion == discussionId); if (discussion) { return discussion; }