-
Notifications
You must be signed in to change notification settings - Fork 1
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
Update/mail #390
Update/mail #390
Conversation
|
||
if (request.CanView) | ||
{ | ||
var p = "view"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
p for permission LMAO!
We are in hurry so yeh...
As long as it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really good.
But hey! It's working so i'm letting it be! We're out of time!
public bool SendShareEntryHtmlMail(bool isDirectory, string name, string sharerName, string operation, string ownerName, | ||
string email, string path) | ||
{ | ||
var data = new HtmlMailData() | ||
{ | ||
From = new From() | ||
{ | ||
Email = _mailSettings.SenderEmail, | ||
Name = _mailSettings.SenderName, | ||
}, | ||
To = new To[] | ||
{ | ||
new (){ Email = email }, | ||
}, | ||
TemplateUuid = _mailSettings.TemplateUuids.ShareEntry, | ||
TemplateVariables = new ShareEntryTemplateVariables() | ||
{ | ||
EntryName = name, | ||
Operation = operation, | ||
EntryType = isDirectory ? "Folder" : "File", | ||
OwnerName = ownerName, | ||
SharerName = sharerName, | ||
Path = path | ||
}, | ||
}; | ||
|
||
var json = JsonSerializer.Serialize(data, new JsonSerializerOptions(JsonSerializerDefaults.Web)); | ||
|
||
var client = new RestClient(_mailSettings.ClientUrl); | ||
var request = new RestRequest | ||
{ | ||
Method = Method.Post | ||
}; | ||
|
||
request.AddHeader("Authorization", $"{JwtBearerDefaults.AuthenticationScheme} {_mailSettings.Token}"); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", json, ParameterType.RequestBody); | ||
var response = client.Execute(request); | ||
return response.IsSuccessStatusCode; | ||
} | ||
|
||
public bool SendCreateRequestHtmlMail(string userName, string requestType, string operation, string documentName, | ||
string reason, Guid documentId, string email) | ||
{ | ||
var data = new HtmlMailData() | ||
{ | ||
From = new From() | ||
{ | ||
Email = _mailSettings.SenderEmail, | ||
Name = _mailSettings.SenderName, | ||
}, | ||
To = new To[] | ||
{ | ||
new (){ Email = email }, | ||
}, | ||
TemplateUuid = _mailSettings.TemplateUuids.Request, | ||
TemplateVariables = new CreateRequestTemplateVariables() | ||
{ | ||
Operation = operation, | ||
Reason = reason, | ||
DocumentName = documentName, | ||
UserName = userName, | ||
Id = documentId.ToString(), | ||
RequestType = requestType, | ||
Path = !requestType.Equals("borrow request") ? "import/manage" : "requests" | ||
}, | ||
}; | ||
|
||
var json = JsonSerializer.Serialize(data, new JsonSerializerOptions(JsonSerializerDefaults.Web)); | ||
|
||
var client = new RestClient(_mailSettings.ClientUrl); | ||
var request = new RestRequest | ||
{ | ||
Method = Method.Post | ||
}; | ||
|
||
request.AddHeader("Authorization", $"{JwtBearerDefaults.AuthenticationScheme} {_mailSettings.Token}"); | ||
request.AddHeader("Content-Type", "application/json"); | ||
request.AddParameter("application/json", json, ParameterType.RequestBody); | ||
var response = client.Execute(request); | ||
return response.IsSuccessStatusCode; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They smell! And I don't give a shit anymore! As long as it works!
No description provided.