web, core, desktop: share a note with a group, and Settings → Groups

The Share dialog lists people and groups in one picker and shows a group share
as its name and member count. Settings gains a Groups section for the admin:
create, rename, delete, and add or remove people.

The core client reads the directory's groups and group shares (ShareTarget:
a member or a group); the desktop command takes user_id or group_id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 18:25:16 -04:00
co-authored by Claude Opus 5.5
parent 5f3cfe8bb7
commit 442cca4398
9 changed files with 413 additions and 57 deletions
+11 -4
View File
@@ -8,7 +8,7 @@ use tauri::{AppHandle, State};
use inkwell_core::local::Db;
use inkwell_core::sync::client::{self, Identity, ProbeResult};
use inkwell_core::sync::client::{Member, NoteShare};
use inkwell_core::sync::client::{Directory, NoteShare, ShareTarget};
use inkwell_core::sync::compat::Compatibility;
use inkwell_core::sync::engine;
use inkwell_core::sync::push;
@@ -193,7 +193,7 @@ pub fn sync_has_pending(db: State<'_, Db>) -> Result<bool, String> {
// `sharing::NEEDS_SERVER`, which the dialog shows as it is.
#[tauri::command]
pub async fn shares_directory(db: State<'_, Db>) -> Result<Vec<Member>, String> {
pub async fn shares_directory(db: State<'_, Db>) -> Result<Directory, String> {
sharing::directory(&db).await
}
@@ -202,14 +202,21 @@ pub async fn shares_list(note_id: String, db: State<'_, Db>) -> Result<Vec<NoteS
sharing::list(&db, &note_id).await
}
/// Share with a person (`user_id`) or a group (`group_id`, #5177): exactly one.
#[tauri::command]
pub async fn shares_share(
note_id: String,
user_id: String,
user_id: Option<String>,
group_id: Option<String>,
permission: String,
db: State<'_, Db>,
) -> Result<Vec<NoteShare>, String> {
sharing::share(&db, &note_id, &user_id, &permission).await
let target = match (user_id, group_id) {
(Some(id), None) => ShareTarget::Member(id),
(None, Some(id)) => ShareTarget::Group(id),
_ => return Err("Choose someone or a group to share with.".to_string()),
};
sharing::share(&db, &note_id, &target, &permission).await
}
#[tauri::command]