Repository: DDMAL/CantusDB

Issue:
should editors get automatic proofreader access to their own sources?
It seems weird to me that on sources you (an editor) create, you can always access the Volpiano editor (assuming the source is non-empty!) but you have to be added as an editor to access the proofreading form. 
<img width="969" alt="image" src="https://user-images.githubusercontent.com/67451875/209043248-1a0a8e13-0196-498d-a835-081fddc3ee13.png">
<img width="666" alt="image" src="https://user-images.githubusercontent.com/67451875/209043188-94b4b649-c1e7-41cc-9692-fd2a6947c28c.png">

If there were something preventing you from proofreading your own source as an intentional part of the workflow, this might be sort of useful (?) but as it is it just adds an extra step to get permissions you should in theory already have. 

New source created doesn't show up in home page
I just created a new source from my account. It doesn't show up immediately on the home page in the My Sources sidebar (even after refreshing the page and re-logging in). It does however appear in the database as well as in the my-sources page.


Discussion:
> If there were something preventing you from proofreading your own source as an intentional part of the workflow, this might be sort of useful (?) ...

Hm... Without having thought about it too much, I would think that this is the behavior we want. My impression was that the proofreading step should be completed by a different person, to ensure the person who made the initial transcription for any chant didn't overlook something, is not making any systematic errors, etc.

On OldCantus, are proofreader permissions automatically granted for sources the user creates?
I think so--in fact I remember there being a mysterious source that got proofread without apparently getting assigned a proofreader.   You're right that it may not in fact be desirable (especially now that "proofreader" is merged into "editor") but it IS what the spreadsheet of permissions indicates. I'll ask about it. 
Ah! I hadn't seen that Debra made a copy of the first sheet in the spreadsheet and made some modifications. Yes, since that's what the spreadsheet indicates, we should make sure that the creators of sources can proofread those sources.

I left a comment in the spreadsheet with a couple of possible implementations (I think the best approach would be to automatically assign the creator of a source to the proofreader group for that source, rather than having an extra rule to grant the same permissions as being in the proofreader group if the user created the source) - we'll see what Debra has to say.
guessing this is related to #644. For me the sidebar has the same six sources no matter how many new ones I've created.

Resolving patch:
diff --git a/django/cantusdb_project/main_app/views/source.py b/django/cantusdb_project/main_app/views/source.py
--- a/django/cantusdb_project/main_app/views/source.py
+++ b/django/cantusdb_project/main_app/views/source.py
@@ -199,6 +199,7 @@ def form_valid(self, form):
 
         # assign this source to the "current_editors"
         current_editors = source.current_editors.all()
+        self.request.user.sources_user_can_edit.add(source)
 
         for editor in current_editors:
             editor.sources_user_can_edit.add(source)


Test patch: