diff --git a/src/addons/mod/forum/components/components.module.ts b/src/addons/mod/forum/components/components.module.ts
index 55da612ac..d57add762 100644
--- a/src/addons/mod/forum/components/components.module.ts
+++ b/src/addons/mod/forum/components/components.module.ts
@@ -21,7 +21,6 @@ import { CoreTagComponentsModule } from '@features/tag/components/components.mod
import { CoreRatingComponentsModule } from '@features/rating/components/components.module';
import { AddonModForumDiscussionOptionsMenuComponent } from './discussion-options-menu/discussion-options-menu';
-import { AddonModForumEditPostComponent } from './edit-post/edit-post';
import { AddonModForumIndexComponent } from './index/index';
import { AddonModForumPostComponent } from './post/post';
import { AddonModForumPostOptionsMenuComponent } from './post-options-menu/post-options-menu';
@@ -30,7 +29,6 @@ import { AddonModForumSortOrderSelectorComponent } from './sort-order-selector/s
@NgModule({
declarations: [
AddonModForumDiscussionOptionsMenuComponent,
- AddonModForumEditPostComponent,
AddonModForumIndexComponent,
AddonModForumPostComponent,
AddonModForumPostOptionsMenuComponent,
diff --git a/src/addons/mod/forum/components/edit-post/edit-post.html b/src/addons/mod/forum/components/edit-post/edit-post.html
deleted file mode 100644
index 19f1c65ba..000000000
--- a/src/addons/mod/forum/components/edit-post/edit-post.html
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
{{ 'addon.mod_forum.yourreply' | translate }}
-
-
-
-
-
-
-
-
-
-
diff --git a/src/addons/mod/forum/components/edit-post/edit-post.ts b/src/addons/mod/forum/components/edit-post/edit-post.ts
deleted file mode 100644
index e3a81636c..000000000
--- a/src/addons/mod/forum/components/edit-post/edit-post.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-// (C) Copyright 2015 Moodle Pty Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import { Component, ViewChild, ElementRef, Input, OnInit } from '@angular/core';
-import { FormControl } from '@angular/forms';
-import { CoreFileUploader } from '@features/fileuploader/services/fileuploader';
-import { CoreSites } from '@services/sites';
-import { CoreDomUtils } from '@services/utils/dom';
-import { ModalController, Translate } from '@singletons';
-import { AddonModForumData, AddonModForumPost, AddonModForumReply } from '@addons/mod/forum/services/forum';
-import { AddonModForumHelper } from '@addons/mod/forum/services/forum-helper';
-import { CoreForms } from '@singletons/form';
-import { CoreFileEntry } from '@services/file-helper';
-
-/**
- * Page that displays a form to edit discussion post.
- */
-@Component({
- selector: 'addon-mod-forum-edit-post',
- templateUrl: 'edit-post.html',
-})
-export class AddonModForumEditPostComponent implements OnInit {
-
- @ViewChild('editFormEl') formElement!: ElementRef;
-
- @Input() component!: string; // Component this post belong to.
- @Input() componentId!: number; // Component ID.
- @Input() forum!: AddonModForumData; // The forum the post belongs to. Required for attachments and offline posts.
- @Input() post!: AddonModForumPost;
-
- messageControl = new FormControl();
- advanced = false; // Display all form fields.
- replyData!: AddonModForumReply;
- originalData!: Omit; // Object with the original post data. Usually shared between posts.
-
- protected forceLeave = false; // To allow leaving the page without checking for changes.
-
- ngOnInit(): void {
- // @todo Override android back button to show confirmation before dismiss.
-
- this.replyData = {
- id: this.post.id,
- subject: this.post.subject,
- message: this.post.message,
- files: this.post.attachments || [],
- };
-
- // Delete the local files from the tmp folder if any.
- CoreFileUploader.clearTmpFiles(this.replyData.files as CoreFileEntry[]);
-
- // Update rich text editor.
- this.messageControl.setValue(this.replyData.message);
-
- // Update original data.
- this.originalData = {
- subject: this.replyData.subject,
- message: this.replyData.message,
- files: this.replyData.files.slice(),
- };
-
- // Show advanced fields if any of them has not the default value.
- this.advanced = this.replyData.files.length > 0;
- }
-
- /**
- * Message changed.
- *
- * @param text The new text.
- */
- onMessageChange(text: string): void {
- this.replyData.message = text;
- }
-
- /**
- * Close modal.
- *
- * @param data Data to return to the page.
- */
- async closeModal(data?: AddonModForumReply): Promise {
- const confirmDismiss = await this.confirmDismiss();
-
- if (!confirmDismiss) {
- return;
- }
-
- if (data) {
- CoreForms.triggerFormSubmittedEvent(this.formElement, false, CoreSites.getCurrentSiteId());
- } else {
- CoreForms.triggerFormCancelledEvent(this.formElement, CoreSites.getCurrentSiteId());
- }
-
- ModalController.dismiss(data);
- }
-
- /**
- * Reply to this post.
- *
- * @param e Click event.
- */
- reply(e: Event): void {
- e.preventDefault();
- e.stopPropagation();
-
- // Close the modal, sending the input data.
- this.forceLeave = true;
- this.closeModal(this.replyData);
- }
-
- /**
- * Show or hide advanced form fields.
- */
- toggleAdvanced(): void {
- this.advanced = !this.advanced;
- }
-
- /**
- * Check if we can leave the page or not.
- *
- * @return Resolved if we can leave it, rejected if not.
- */
- private async confirmDismiss(): Promise {
- if (this.forceLeave || !AddonModForumHelper.hasPostDataChanged(this.replyData, this.originalData)) {
- return true;
- }
-
- try {
- // Show confirmation if some data has been modified.
- await CoreDomUtils.showConfirm(Translate.instant('core.confirmcanceledit'));
-
- // Delete the local files from the tmp folder.
- CoreFileUploader.clearTmpFiles(this.replyData.files as CoreFileEntry[]);
-
- return true;
- } catch (error) {
- return false;
- }
- }
-
-}
diff --git a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts
index cf2d1acc8..8c7a51b87 100644
--- a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts
+++ b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts
@@ -122,11 +122,7 @@ export class AddonModForumPostOptionsMenuComponent implements OnInit, OnDestroy
* Edit a post.
*/
editPost(): void {
- if (!this.offlinePost) {
- PopoverController.dismiss({ action: 'edit' });
- } else {
- PopoverController.dismiss({ action: 'editoffline' });
- }
+ PopoverController.dismiss({ action: 'edit' });
}
}
diff --git a/src/addons/mod/forum/components/post/post.html b/src/addons/mod/forum/components/post/post.html
index 89dbb0ed0..4dcded210 100644
--- a/src/addons/mod/forum/components/post/post.html
+++ b/src/addons/mod/forum/components/post/post.html
@@ -1,111 +1,115 @@