MOBILE-3018 forum: Fix error after creating discussion

main
Albert Gasset 2019-05-27 11:24:32 +02:00
parent a512d65e8f
commit f24ab4e4b1
1 changed files with 4 additions and 2 deletions

View File

@ -475,9 +475,11 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
// If it's a new discussion in tablet mode, try to open it.
if (isNewDiscussion && this.splitviewCtrl.isOn()) {
if (data.discussionId) {
if (data.discussionIds) {
// Discussion sent to server, search it in the list of discussions.
const discussion = this.discussions.find((disc) => { return disc.discussion == data.discussionId; });
const discussion = this.discussions.find((disc) => {
return data.discussionIds.indexOf(disc.discussion) >= 0;
});
if (discussion) {
this.openDiscussion(discussion);
}