Merge pull request #1950 from albertgasset/MOBILE-3018

MOBILE-3018 forum: Fix error after creating discussion
main
Juan Leyva 2019-05-27 16:54:18 +02:00 committed by GitHub
commit a6f7feed92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);
}