diff --git a/src/addon/calendar/pages/day/day.ts b/src/addon/calendar/pages/day/day.ts
index b48a7d84f..92abebece 100644
--- a/src/addon/calendar/pages/day/day.ts
+++ b/src/addon/calendar/pages/day/day.ts
@@ -114,7 +114,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
this.filter.courseId = navParams.get('courseId');
this.filter.categoryId = navParams.get('categoryId');
- this.filter.filtered = this.filter.courseId || AddonCalendarProvider.ALL_TYPES.some((name) => !this.filter[name]);
+ this.filter.filtered = !!this.filter.courseId || AddonCalendarProvider.ALL_TYPES.some((name) => !this.filter[name]);
this.year = navParams.get('year') || now.getFullYear();
this.month = navParams.get('month') || (now.getMonth() + 1);
diff --git a/src/addon/mod/forum/components/post-options-menu/addon-forum-post-options-menu.html b/src/addon/mod/forum/components/post-options-menu/addon-forum-post-options-menu.html
index 48d9a9d89..9b7e34dd6 100644
--- a/src/addon/mod/forum/components/post-options-menu/addon-forum-post-options-menu.html
+++ b/src/addon/mod/forum/components/post-options-menu/addon-forum-post-options-menu.html
@@ -11,7 +11,8 @@
{{ 'core.numwords' | translate: {'$a': wordCount} }}
-
- {{ 'core.nooptionavailable' | translate }}
-
+
+
+ {{ 'core.openinbrowser' | translate }}
+
diff --git a/src/addon/mod/forum/components/post-options-menu/post-options-menu.ts b/src/addon/mod/forum/components/post-options-menu/post-options-menu.ts
index 483c01b11..cd0fb7fdf 100644
--- a/src/addon/mod/forum/components/post-options-menu/post-options-menu.ts
+++ b/src/addon/mod/forum/components/post-options-menu/post-options-menu.ts
@@ -15,6 +15,8 @@
import { Component, OnInit } from '@angular/core';
import { NavParams, ViewController } from 'ionic-angular';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
+import { CoreSitesProvider } from '@providers/sites';
+import { CoreSite } from '@classes/site';
import { AddonModForumProvider } from '../../providers/forum';
/**
@@ -31,11 +33,13 @@ export class AddonForumPostOptionsMenuComponent implements OnInit {
canEdit = false;
canDelete = false;
loaded = false;
+ url: string;
constructor(navParams: NavParams,
protected viewCtrl: ViewController,
protected domUtils: CoreDomUtilsProvider,
- protected forumProvider: AddonModForumProvider) {
+ protected forumProvider: AddonModForumProvider,
+ protected sitesProvider: CoreSitesProvider) {
this.post = navParams.get('post');
this.forumId = navParams.get('forumId');
}
@@ -46,6 +50,9 @@ export class AddonForumPostOptionsMenuComponent implements OnInit {
ngOnInit(): void {
if (this.forumId) {
if (this.post.id) {
+ const site: CoreSite = this.sitesProvider.getCurrentSite();
+ this.url = site.createSiteUrl('/mod/forum/discuss.php', {d: this.post.discussion}, 'p' + this.post.id);
+
this.forumProvider.getDiscussionPost(this.forumId, this.post.discussion, this.post.id, true).then((post) => {
this.canDelete = post.capabilities.delete && this.forumProvider.isDeletePostAvailable();
this.canEdit = post.capabilities.edit && this.forumProvider.isUpdatePostAvailable();
diff --git a/src/addon/mod/forum/providers/forum.ts b/src/addon/mod/forum/providers/forum.ts
index cae8c5ac3..450593d75 100644
--- a/src/addon/mod/forum/providers/forum.ts
+++ b/src/addon/mod/forum/providers/forum.ts
@@ -417,9 +417,9 @@ export class AddonModForumProvider {
return site.read('mod_forum_get_discussion_post', params, preSets).then((response) => {
if (response.post) {
return response.post;
- } else {
- return Promise.reject(null);
}
+
+ return Promise.reject(null);
});
});
}
diff --git a/src/classes/site.ts b/src/classes/site.ts
index e1f0fb458..574f6be44 100644
--- a/src/classes/site.ts
+++ b/src/classes/site.ts
@@ -1309,6 +1309,18 @@ export class CoreSite {
return this.urlUtils.getDocsUrl(release, page);
}
+ /**
+ * Returns a url to link an specific page on the site.
+ *
+ * @param path Path of the url to go to.
+ * @param params Object with the params to add.
+ * @param anchor Anchor text if needed.
+ * @return URL with params.
+ */
+ createSiteUrl(path: string, params?: {[key: string]: any}, anchor?: string): string {
+ return this.urlUtils.addParamsToUrl(this.siteUrl + path, params, anchor);
+ }
+
/**
* Check if the local_mobile plugin is installed in the Moodle site.
*
diff --git a/src/providers/utils/url.ts b/src/providers/utils/url.ts
index 600f84d5e..39604bfd3 100644
--- a/src/providers/utils/url.ts
+++ b/src/providers/utils/url.ts
@@ -49,9 +49,10 @@ export class CoreUrlUtilsProvider {
*
* @param url URL to add the params to.
* @param params Object with the params to add.
+ * @param anchor Anchor text if needed.
* @return URL with params.
*/
- addParamsToUrl(url: string, params: {[key: string]: any}): string {
+ addParamsToUrl(url: string, params?: {[key: string]: any}, anchor?: string): string {
let separator = url.indexOf('?') != -1 ? '&' : '?';
for (const key in params) {
@@ -64,6 +65,10 @@ export class CoreUrlUtilsProvider {
}
}
+ if (anchor) {
+ url += '#' + anchor;
+ }
+
return url;
}