Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not email option #4277

Merged
merged 12 commits into from
May 20, 2024
Prev Previous commit
Next Next commit
Add APIs to change do not email
aapeliv committed May 19, 2024
commit 1efa122700fb68ef8689d57e02ab653b7c1496f8
11 changes: 11 additions & 0 deletions app/backend/src/couchers/servicers/account.py
Original file line number Diff line number Diff line change
@@ -471,6 +471,17 @@ def DeleteAccount(self, request, context):

return empty_pb2.Empty()

def GetDoNotEmail(self, request, context):
with session_scope() as session:
user = session.execute(select(User).where(User.id == context.user_id)).scalar_one()
return account_pb2.DoNotEmailRes(do_not_email=user.do_not_email)

def SetDoNotEmail(self, request, context):
with session_scope() as session:
user = session.execute(select(User).where(User.id == context.user_id)).scalar_one()
user.do_not_email = request.do_not_email
return account_pb2.DoNotEmailRes(do_not_email=user.do_not_email)


class Iris(iris_pb2_grpc.IrisServicer):
def Webhook(self, request, context):
16 changes: 16 additions & 0 deletions app/proto/account.proto
Original file line number Diff line number Diff line change
@@ -65,6 +65,14 @@ service Account {
rpc DeleteAccount(DeleteAccountReq) returns (google.protobuf.Empty) {
// Sends email with confirmation link containing token to delete account
}

rpc GetDoNotEmail(google.protobuf.Empty) returns (DoNotEmailRes) {
// Gets the do not email flag
}

rpc SetDoNotEmail(SetDoNotEmailReq) returns (DoNotEmailRes) {
// Sets the do not email flag
}
}

message GetAccountInfoRes {
@@ -160,3 +168,11 @@ message DeleteAccountReq {
bool confirm = 1;
string reason = 2;
}

message SetDoNotEmailReq {
bool do_not_email = 1;
}

message DoNotEmailRes {
bool do_not_email = 1;
}