aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/DashboardView.tsx9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/views/DashboardView.tsx b/src/client/views/DashboardView.tsx
index 6415601f1..35aa67ac8 100644
--- a/src/client/views/DashboardView.tsx
+++ b/src/client/views/DashboardView.tsx
@@ -53,7 +53,14 @@ export class DashboardView extends React.Component {
clickDashboard = async (e: React.MouseEvent, dashboard: Doc) => {
if (e.detail === 2) {
Doc.AddDocToList(Doc.MySharedDocs, 'viewed', dashboard);
- Doc.ActiveDashboard = dashboard;
+ if (DocListCast(Doc.MySharedDocs.data).includes(dashboard)) {
+ // choose an appropriate alias or make one. --- choose the first alias that (1) user owns, (2) has no context field ... otherwise make a new alias
+ const bestAlias = DocListCast(dashboard.aliases).find(doc => doc.author === Doc.CurrentUserEmail);
+ const nextBestAlias = DocListCast(dashboard.aliases).find(doc => doc.author === Doc.CurrentUserEmail);
+ Doc.ActiveDashboard = bestAlias ?? nextBestAlias ?? Doc.MakeAlias(dashboard);
+ } else {
+ Doc.ActiveDashboard = dashboard;
+ }
Doc.ActivePage = 'dashboard';
}
};