MOBILE-3070 forum: Fix finding discussion by Id.
parent
12ec938594
commit
135e2cd5e3
|
@ -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<any> {
|
||||
|
|
|
@ -280,7 +280,8 @@ export class AddonModForumHelperProvider {
|
|||
const findDiscussion = (page: number): Promise<any> => {
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue