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 // and being based on a different model. better to just redirect
const url = transition.intent.url; const url = transition.intent.url;
if (url === "/bookmarks") { if (url === "/bookmarks") {
this.transitionTo( this.transitionTo("userActivity.bookmarks", this.currentUser);
"userActivity.bookmarksWithReminders",
this.currentUser
);
} }
if ( if (

View File

@ -1,29 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse"; import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
noContentHelpKey: "user_activity.no_bookmarks", redirect() {
this.transitionTo("userActivity.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;
}
} }
}); });

View File

@ -1,13 +1,28 @@
import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; import DiscourseRoute from "discourse/routes/discourse";
import UserAction from "discourse/models/user-action";
export default UserActivityStreamRoute.extend({ export default DiscourseRoute.extend({
userActionType: UserAction.TYPES["bookmarks"],
noContentHelpKey: "user_activity.no_bookmarks", 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: { actions: {
didTransition() { didTransition() {
this.controllerFor("application").set("showFooter", true); this.controllerFor("user-activity")._showFooter();
return true; return true;
} }
} }

View File

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

View File

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

View File

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

View File

@ -62,7 +62,7 @@ createWidget("user-menu-links", {
label: "user.bookmarks", label: "user.bookmarks",
className: "user-bookmarks-link", className: "user-bookmarks-link",
icon: "bookmark", 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 return unless @post.user_id == self.discobot_user.id
profile_page_url = url_helpers(:user_url, username: @user.username) 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 raw = <<~RAW
#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(bookmark_url: bookmark_url))} #{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}" profile_page_url = "#{Discourse.base_url}/u/#{user.username}"
expected_raw = <<~RAW 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: '')} #{I18n.t('discourse_narrative_bot.new_user_narrative.onebox.instructions', base_uri: '')}
RAW RAW

View File

@ -15,13 +15,13 @@ acceptance("User's bookmarks", {
}); });
test("listing user bookmarks", async assert => { 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); assert.ok(find(".bookmark-list-item").length);
}); });
test("removing a bookmark", async assert => { 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"); const dropdown = selectKit(".bookmark-actions-dropdown");
await dropdown.expand(); 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"); assert.equal(find(".alert.alert-info").text(), "no bookmarks");
}); });