Skip to content

Commit

Permalink
📝 ✨ Invite any role, not just users (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy authored Nov 25, 2019
2 parents a75f787 + dc3dd8b commit 6fb76cb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Changes
-------
Unreleased
==========
2019-11-25: v0.6.5
^^^^^^^^^^^^^^^^^^
* :pencil: Allow invitations for roles other than "user"

2019-11-21: v0.6.4
^^^^^^^^^^^^^^^^^^
* :sparkles: Informant-subject relationships
Expand Down
2 changes: 1 addition & 1 deletion girderformindlogger/api/v1/applet.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def invite(self, applet, role="user", idCode=None, profile=None):
invitation = Invitation().createInvitation(
applet=applet,
coordinator=user,
role="user",
role=role,
profile=profile,
idCode=idCode
)
Expand Down
13 changes: 8 additions & 5 deletions girderformindlogger/models/invitation.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def createInvitation(
'appletId': applet['_id'],
'created': now,
'updated': now,
'role': role,
'size': 0,
'invitedBy': Profile().coordinatorProfile(
applet['_id'],
Expand Down Expand Up @@ -242,6 +243,7 @@ def htmlInvitation(
except:
skin = {}
instanceName = skin.get("name", "MindLogger")
role = invitation.get("role", "user")
try:
coordinator = Profile().coordinatorProfile(
applet['_id'],
Expand Down Expand Up @@ -273,8 +275,7 @@ def htmlInvitation(
Applet().listUsers(applet, 'reviewer', force=True)
)
body = """
{greeting}ou have been invited {byCoordinator}to <b>{appletName}</b> on
{instanceName}.
{greeting}ou have been invited {byCoordinator}to be {role} of <b>{appletName}</b>{instanceName}.
<br/>
{description}
{reviewers}
Expand Down Expand Up @@ -304,7 +305,9 @@ def htmlInvitation(
greeting="Welcome {}; y".format(
displayProfile['displayName']
) if 'displayName' in displayProfile else "Welcome! Y",
instanceName=instanceName,
instanceName=" on {}".format(
instanceName
) if instanceName is not None and len(instanceName) else "",
managers="<h3>Users who can change this applet's settings, "
" including who can access your data: </h3>{}"
"".format(
Expand All @@ -314,9 +317,9 @@ def htmlInvitation(
"applet: </h3>{}"
"".format(
reviewers if len(reviewers) else "<ul><li>None</li></ul>"
)
),
role="an editor" if role=="editor" else "a {}".format(role)
).strip()
print(body)
return(body if not fullDoc else """
<!DOCTYPE html>
<html>
Expand Down

0 comments on commit 6fb76cb

Please sign in to comment.