FIX: Bookmarking group reports (#291)

Since https://github.com/discourse/discourse/commit/67a8080e338aa62afbd02efc98178b4a67751775
in core, the functionality to bookmark a report from the group
Reports tab has been broken. This commit fixes the issue and adds
system spec coverage to prevent regression.
This commit is contained in:
Martin Brennan
2024-05-22 09:18:09 +10:00
committed by GitHub
parent 901caf4a63
commit 87d7958db8
2 changed files with 65 additions and 4 deletions
@@ -5,7 +5,7 @@ import { inject as service } from "@ember/service";
import BookmarkModal from "discourse/components/modal/bookmark";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { BookmarkFormData } from "discourse/lib/bookmark";
import { BookmarkFormData } from "discourse/lib/bookmark-form-data";
import {
NO_REMINDER_ICON,
WITH_REMINDER_ICON,
@@ -91,12 +91,15 @@ export default class GroupReportsShowController extends Controller {
return this.modal.show(BookmarkModal, {
model: {
bookmark: new BookmarkFormData(modalBookmark),
afterSave: (savedData) => {
const bookmark = this.store.createRecord("bookmark", savedData);
afterSave: (bookmarkFormData) => {
const bookmark = this.store.createRecord(
"bookmark",
bookmarkFormData.saveData
);
this.queryGroupBookmark = bookmark;
this.appEvents.trigger(
"bookmarks:changed",
savedData,
bookmarkFormData.saveData,
bookmark.attachedTo()
);
},