memos icon indicating copy to clipboard operation
memos copied to clipboard

Collaborative Memos

Open Iziram opened this issue 1 year ago • 3 comments

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 :

  • const readonly = memo.creator !== user?.name;
  • const allowEdit = !props.readonly && memo && currentUser?.name === memo.creator;

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 UserB to 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 :

  • READ : Can see the memos (even if its visibility is Private) and can comment.
  • WRITE : READ + can edit the content of the memo (e.g: check boxes, add task to list)
  • ADMIN : WRITE + can change the visibility, add collaborators, delete the memos... (anything that the creator can do)

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 :

  • READ : 0
  • WRITE : 1
  • ADMIN : 2

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 :

  • a "collaborator" button that opens a small modal. With the list of collaborators and each permission (with selectors to change their permissions)
  • a button to hide collaborative memos from the Home/Explore page. (optionnal)

Iziram avatar Aug 03 '24 09:08 Iziram

Issues related : #3754 #3708

Iziram avatar Aug 04 '24 16:08 Iziram

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

Iziram avatar Aug 04 '24 19:08 Iziram

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.

wjbeckett avatar Aug 12 '24 01:08 wjbeckett

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

KUKARAF avatar Sep 01 '24 18:09 KUKARAF

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

johnnyjoygh avatar Sep 02 '24 13:09 johnnyjoygh