FIX: Change bookmarks-with-reminders URL back to bookmarks for user activity (#9566)

* Bookmarks with reminders is a core feature now, no need to have a separate URL
* Keep around the old /u/:username/activity/bookmarks-with-reminders route for backwards compat in Ember but just redirect to user activity bookmarks.
This commit is contained in:
Martin Brennan 2020-04-29 10:53:37 +10:00 committed by GitHub
parent 17ca47af1a
commit 6cf31f16f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 32 additions and 42 deletions

View File

@ -18,10 +18,7 @@ export default DiscourseRoute.extend(OpenComposer, {
// and being based on a different model. better to just redirect
const url = transition.intent.url;
if (url === "/bookmarks") {
this.transitionTo(
"userActivity.bookmarksWithReminders",
this.currentUser
);
this.transitionTo("userActivity.bookmarks", this.currentUser);
}
if (

View File

@ -1,29 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
noContentHelpKey: "user_activity.no_bookmarks",
queryParams: {
acting_username: { refreshModel: true }
},
model() {
return this.modelFor("user").get("bookmarks");
},
renderTemplate() {
this.render("user_bookmarks");
},
setupController(controller, model) {
controller.set("model", model);
controller.loadItems();
},
actions: {
didTransition() {
this.controllerFor("user-activity")._showFooter();
return true;
}
redirect() {
this.transitionTo("userActivity.bookmarks");
}
});

View File

@ -1,13 +1,28 @@
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
import UserAction from "discourse/models/user-action";
import DiscourseRoute from "discourse/routes/discourse";
export default UserActivityStreamRoute.extend({
userActionType: UserAction.TYPES["bookmarks"],
export default DiscourseRoute.extend({
noContentHelpKey: "user_activity.no_bookmarks",
queryParams: {
acting_username: { refreshModel: true }
},
model() {
return this.modelFor("user").get("bookmarks");
},
renderTemplate() {
this.render("user_bookmarks");
},
setupController(controller, model) {
controller.set("model", model);
controller.loadItems();
},
actions: {
didTransition() {
this.controllerFor("application").set("showFooter", true);
this.controllerFor("user-activity")._showFooter();
return true;
}
}

View File

@ -19,7 +19,7 @@
</li>
{{#if user.showBookmarks}}
<li>
{{#link-to 'userActivity.bookmarksWithReminders'}}{{i18n 'user_action_groups.3'}}{{/link-to}}
{{#link-to "userActivity.bookmarks"}}{{i18n "user_action_groups.3"}}{{/link-to}}
</li>
{{/if}}
{{plugin-outlet

View File

@ -27,7 +27,7 @@
</li>
{{#if model.bookmark_count}}
<li class="linked-stat">
{{#link-to "userActivity.bookmarksWithReminders"}}
{{#link-to "userActivity.bookmarks"}}
{{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}
{{/link-to}}
</li>

View File

@ -16,7 +16,7 @@ createWidgetFrom(QuickAccessPanel, "quick-access-bookmarks", {
},
showAllHref() {
return `${this.attrs.path}/activity/bookmarks-with-reminders`;
return `${this.attrs.path}/activity/bookmarks`;
},
emptyStatePlaceholderItem() {

View File

@ -62,7 +62,7 @@ createWidget("user-menu-links", {
label: "user.bookmarks",
className: "user-bookmarks-link",
icon: "bookmark",
href: `${this.attrs.path}/activity/bookmarks-with-reminders`
href: `${this.attrs.path}/activity/bookmarks`
};
},

View File

@ -238,7 +238,7 @@ module DiscourseNarrativeBot
return unless @post.user_id == self.discobot_user.id
profile_page_url = url_helpers(:user_url, username: @user.username)
bookmark_url = "#{profile_page_url}/activity/bookmarks-with-reminders"
bookmark_url = "#{profile_page_url}/activity/bookmarks"
raw = <<~RAW
#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(bookmark_url: bookmark_url))}

View File

@ -256,7 +256,7 @@ describe DiscourseNarrativeBot::NewUserNarrative do
profile_page_url = "#{Discourse.base_url}/u/#{user.username}"
expected_raw = <<~RAW
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.reply', bookmark_url: "#{profile_page_url}/activity/bookmarks-with-reminders", base_uri: '')}
#{I18n.t('discourse_narrative_bot.new_user_narrative.bookmark.reply', bookmark_url: "#{profile_page_url}/activity/bookmarks", base_uri: '')}
#{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions', base_uri: '')}
RAW

View File

@ -15,13 +15,13 @@ acceptance("User's bookmarks", {
});
test("listing user bookmarks", async assert => {
await visit("/u/eviltrout/activity/bookmarks-with-reminders");
await visit("/u/eviltrout/activity/bookmarks");
assert.ok(find(".bookmark-list-item").length);
});
test("removing a bookmark", async assert => {
await visit("/u/eviltrout/activity/bookmarks-with-reminders");
await visit("/u/eviltrout/activity/bookmarks");
const dropdown = selectKit(".bookmark-actions-dropdown");
await dropdown.expand();
@ -44,7 +44,7 @@ test("listing users bookmarks - no bookmarks", async assert => {
}
]);
await visit("/u/eviltrout/activity/bookmarks-with-reminders");
await visit("/u/eviltrout/activity/bookmarks");
assert.equal(find(".alert.alert-info").text(), "no bookmarks");
});