usememos / memos

An open-source, lightweight note-taking solution. The pain-less way to create your meaningful notes. Your Notes, Your Way.
https://usememos.com
MIT License
34.06k stars 2.47k forks source link

Collaborative Memos #3782

Closed Iziram closed 1 month ago

Iziram commented 3 months ago

Describe the solution you'd like

A lot of people are comming to Memos from Google Keep. Memos can be a great alternative but lacks in term of collaborative feature. As of now, there is no way to make to people edit the same memos. ( Even Admins can't modify other memos)

I hope that together we can discuss what is the best way to add collaborative editing to Memos.

Type of feature

User Experience (UX)

Additional context

Current code

In the current code, the ability to edit is defined by :

Which makes the creator the only one capable of editing the memo.

Ways of adding collaborative features

Workspace Editing

As i previously mention in a PR ( #3673), one of the easiest way is to let everyone in the same workspace edit all "workspace memos". Such a "feature" as i implemented will not resolve the "admin" problem on public and private memos. But is easy to add and don't touch the database models.

Collaborators Field

An other way would be to add a "Collaborator" field to each memos. Then a UserA could add UserBto the memo. UserB would have almost the same permissions as UserA. Editing the content of the memos but not the visibility nor add collaborators.

This is a quite robust way of dealing with collaborative work but changes to the database will be needed.

CollaboratorsPermissions

This part is a upgrade for the Collaborators Field feature. What we could do is add a permission system. (Read/Write/Admin)

It would work like that :

Instead of using a field in the memo (which could eventually become too large) we could use an other table in the database. :

memoId userId permission
integer integer integer

Permission is a number representing the permission :

Using 0 for READ let us use the "permission" number as a "allow edit" bool value

(the following code is not a implementation, just a example)

const allowEditing = Collaborators(memo).getPermission(userId); // => 0/1/2 or undefined
// 0 and undefined act as Falsy values
if (allowEditing) {
  // here we are sur to edit because 1 and 2 are "true" values
}else{
  // Here we know for a fact that we won't be able to edit.
}

Obviously, the server host (and users set as Admins) will have the ADMIN permission on each memos.

UI

In terms of UI, this will add :

Iziram commented 3 months ago

Issues related : #3754 #3708

Iziram commented 3 months ago

I started to work on it.

Here is the repo : iziram/memos#collaborators

Worked on a bit of UI :

https://github.com/user-attachments/assets/8e2afeb5-171d-4d0a-9bee-889a9ee18a7a

wjbeckett commented 3 months ago

super excited for this! As a fellow "moving away from Keep", this will solve most of the gaps I have with my wife and I sharing to-do lists and notes, etc.

KUKARAF commented 2 months ago

super excited for this! As a fellow "moving away from Keep", this will solve most of the gaps I have with my wife and I sharing to-do lists and notes, etc.

I can only second that

johnnyjoygh commented 2 months ago

As of now, there is no way to make to people edit the same memos. ( Even Admins can't modify other memos)

For a good start, I first implemented for admin users to modify other memos. https://github.com/usememos/memos/commit/7a9f61967da808a27f07b5492d6f94b290a4b7b9