mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 06:58:31 +08:00
FEATURE: Redesigned bookmark modal and menu (#23071)
Adds the new quick menu for bookmarking. When you bookmark a post (chat message behaviour will come later) we show this new quick menu and bookmark the item straight away. You can then choose a reminder quick option, or choose Custom... to open the old modal. If you click on an existing bookmark, we show the same quick menu but with Edit and Delete options. A later PR will introduce a new bookmark modal, but for now we are using the old modal for Edit and Custom... options.
This commit is contained in:
@ -5,7 +5,7 @@ import { service } from "@ember/service";
|
||||
import BookmarkModal from "discourse/components/modal/bookmark";
|
||||
import FlagModal from "discourse/components/modal/flag";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { BookmarkFormData } from "discourse/lib/bookmark";
|
||||
import { BookmarkFormData } from "discourse/lib/bookmark-form-data";
|
||||
import { clipboardCopy } from "discourse/lib/utilities";
|
||||
import Bookmark from "discourse/models/bookmark";
|
||||
import getURL from "discourse-common/lib/get-url";
|
||||
@ -337,12 +337,12 @@ export default class ChatMessageInteractor {
|
||||
this.message.id
|
||||
)
|
||||
),
|
||||
afterSave: (savedData) => {
|
||||
const bookmark = Bookmark.create(savedData);
|
||||
afterSave: (bookmarkFormData) => {
|
||||
const bookmark = Bookmark.create(bookmarkFormData.saveData);
|
||||
this.message.bookmark = bookmark;
|
||||
this.appEvents.trigger(
|
||||
"bookmarks:changed",
|
||||
savedData,
|
||||
bookmarkFormData.saveData,
|
||||
bookmark.attachedTo()
|
||||
);
|
||||
},
|
||||
|
@ -6,6 +6,7 @@ describe "Local dates", type: :system do
|
||||
let(:year) { Time.zone.now.year + 1 }
|
||||
let(:month) { Time.zone.now.month }
|
||||
let(:bookmark_modal) { PageObjects::Modals::Bookmark.new }
|
||||
let(:bookmark_menu) { PageObjects::Components::BookmarkMenu.new }
|
||||
let(:composer) { PageObjects::Components::Composer.new }
|
||||
let(:insert_datetime_modal) { PageObjects::Modals::InsertDateTime.new }
|
||||
|
||||
@ -163,6 +164,7 @@ describe "Local dates", type: :system do
|
||||
topic_page.visit_topic(topic)
|
||||
topic_page.expand_post_actions(topic.first_post)
|
||||
topic_page.click_post_action_button(topic.first_post, :bookmark)
|
||||
bookmark_menu.click_menu_option("custom")
|
||||
bookmark_modal.select_preset_reminder(:post_local_date)
|
||||
expect(topic_page).to have_post_bookmarked(topic.first_post)
|
||||
bookmark = Bookmark.find_by(bookmarkable: topic.first_post, user: current_user)
|
||||
@ -177,6 +179,7 @@ describe "Local dates", type: :system do
|
||||
topic_page.visit_topic(topic)
|
||||
topic_page.expand_post_actions(topic.first_post)
|
||||
topic_page.click_post_action_button(topic.first_post, :bookmark)
|
||||
bookmark_menu.click_menu_option("custom")
|
||||
expect(bookmark_modal).to be_open
|
||||
expect(bookmark_modal).to have_no_preset(:post_local_date)
|
||||
end
|
||||
|
Reference in New Issue
Block a user