Skip to content

Commit

Permalink
Open notification preferences if specified in route query
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Apr 11, 2024
1 parent 3a4f337 commit b72abfa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion client/src/components/Notifications/NotificationsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ library.add(faCog, faHourglassHalf, faRetweet);
const notificationsStore = useNotificationsStore();
const { notifications, loadingNotifications } = storeToRefs(notificationsStore);
interface Props {
shouldOpenPreferences?: boolean;
}
const props = withDefaults(defineProps<Props>(), {
shouldOpenPreferences: false,
});
const showUnread = ref(false);
const showShared = ref(false);
const preferencesOpen = ref(false);
const preferencesOpen = ref(props.shouldOpenPreferences);
const selectedNotificationIds = ref<string[]>([]);
const haveSelected = computed(() => selectedNotificationIds.value.length > 0);
Expand Down
3 changes: 3 additions & 0 deletions client/src/entry/analysis/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ export function getRouter(Galaxy) {
path: "user/notifications",
component: NotificationsList,
redirect: redirectIf(!Galaxy.config.enable_notification_system, "/") || redirectAnon(),
props: (route) => ({
shouldOpenPreferences: Boolean(route.query.preferences),
}),
},
{
path: "user/notifications/preferences",
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/managers/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,9 @@ def build_context(self, template_format: TemplateFormats) -> NotificationContext
urlparse(self.notification.galaxy_url).hostname if self.notification.galaxy_url else self.config.server_name
)
notification_settings_url = (
f"{self.notification.galaxy_url}/user/notifications" if self.notification.galaxy_url else None
f"{self.notification.galaxy_url}/user/notifications?preferences=true"
if self.notification.galaxy_url
else None
)
contact_email = self.config.error_email_to or None
return NotificationContext(
Expand Down

0 comments on commit b72abfa

Please sign in to comment.