some cleanup for invitation changes

This commit is contained in:
dandds 2018-10-31 09:21:29 -04:00
parent faa98fcb17
commit 3a5d8036a1
3 changed files with 3 additions and 12 deletions

View File

@ -32,12 +32,3 @@ class WorkspacesQuery(Query):
@classmethod
def create_workspace_role(cls, user, role, workspace, **kwargs):
return WorkspaceRole(user=user, role=role, workspace=workspace, **kwargs)
@classmethod
def get_role_for_workspace_and_user(cls, workspace, user):
return (
db.session.query(WorkspaceRole)
.filter(WorkspaceRole.user == user)
.filter(WorkspaceRole.workspace == workspace)
.one()
)

View File

@ -41,8 +41,8 @@ class Invitation(Base, TimestampsMixin, AuditableMixin):
token = Column(String(), index=True, default=lambda: secrets.token_urlsafe())
def __repr__(self):
return "<Invitation(user='{}', workspace='{}', id='{}')>".format(
self.user.id, self.workspace.id, self.id
return "<Invitation(user='{}', workspace_role='{}', id='{}')>".format(
self.user_id, self.workspace_role_id, self.id
)
@property

View File

@ -44,7 +44,7 @@ def make_error_pages(app):
@app.errorhandler(InvitationError)
# pylint: disable=unused-variable
def expired_invitation(e):
def invalid_invitation(e):
log_error(e)
return (
render_template(