From cd473d69f2e1e7b5afbbfd3cd157eba9f5000546 Mon Sep 17 00:00:00 2001 From: "Amy J. Ko" Date: Mon, 12 Aug 2024 07:50:30 +1000 Subject: [PATCH 1/2] Fixed comments. --- src/routes/project/[projectid]/+page.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/project/[projectid]/+page.svelte b/src/routes/project/[projectid]/+page.svelte index 7e48ed4ba..2348ab103 100644 --- a/src/routes/project/[projectid]/+page.svelte +++ b/src/routes/project/[projectid]/+page.svelte @@ -50,11 +50,12 @@ // See if the project is editable, and if so, get it's store, so we can track it's changes. const projectStore = Projects.getStore(projectID); if (projectStore) { + // Mark the project editable, since there's a store for it. editable = true; + // If there's a different store, stop listening to the current store and listen to the new one. if (store !== projectStore) { // Unsubscribe from the previous store if (unsub) unsub(); - // Mark the project editable. // Remember the new store store = projectStore; // Update the project we're showing whenever it changes. @@ -62,7 +63,7 @@ project = proj; overwritten = Projects.getHistory( - proj.getID() + proj.getID(), )?.wasOverwritten() ?? false; }); } From 3b4b5151086a20fa5458eaec49fc615fe9481eb2 Mon Sep 17 00:00:00 2001 From: "Amy J. Ko" Date: Mon, 12 Aug 2024 08:04:00 +1000 Subject: [PATCH 2/2] Ensure owned projects are marked as owned when loaded directly from Firestore. --- CHANGELOG.md | 6 ++++++ src/db/ProjectsDatabase.ts | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f51001d98..57014a870 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ We'll note all notable changes in this file, including bug fixes, enhancements, and all closed issues. Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http://semver.org/) format. +## 0.10.10 2024-08-12 + +### Fixed + +- [#550](https://github.com/wordplaydev/wordplay/issues/550) Ensure owned projects are marked as owned when loaded directly from Firestore. + ## 0.10.9 2024-08-10 ### Added diff --git a/src/db/ProjectsDatabase.ts b/src/db/ProjectsDatabase.ts index 75d9b7ed7..80442960f 100644 --- a/src/db/ProjectsDatabase.ts +++ b/src/db/ProjectsDatabase.ts @@ -182,7 +182,7 @@ export default class ProjectsDatabase { this.projectsQueryUnsubscribe = undefined; } - // If there's no more user, stop le, do nothing. + // If there's no more user, do nothing. if (user === null) return; // Set up the realtime projects query for the user, tracking any projects from the cloud, @@ -430,11 +430,13 @@ export default class ProjectsDatabase { doc(firestore, ProjectsCollection, id), ); if (projectDoc.exists()) { + const user = this.database.getUser(); + const project = await this.parseProject(projectDoc.data()); if (project !== undefined) this.track( project, - false, + user !== null && project.getOwner() === user.uid, PersistenceType.Online, false, );