Merge pull request #625 from mikecasas/feature-email
Send notification based on a future datetime
This commit is contained in:
commit
65df0549fd
@ -65,7 +65,8 @@
|
||||
notification.ParentId = null;
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
notification = await NotificationService.AddNotificationAsync(notification);
|
||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
|
@ -191,7 +191,8 @@
|
||||
notification.ParentId = notificationid;
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
notification = await NotificationService.AddNotificationAsync(notification);
|
||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
|
@ -148,7 +148,7 @@ namespace Oqtane.Controllers
|
||||
notification.SiteId = user.SiteId;
|
||||
notification.FromUserId = null;
|
||||
notification.ToUserId = newUser.UserId;
|
||||
notification.ToEmail = "";
|
||||
notification.ToEmail = newUser.Email;
|
||||
notification.Subject = "User Account Verification";
|
||||
string token = await _identityUserManager.GenerateEmailConfirmationTokenAsync(identityuser);
|
||||
string url = HttpContext.Request.Scheme + "://" + _tenants.GetAlias().Name + "/login?name=" + user.Username + "&token=" + WebUtility.UrlEncode(token);
|
||||
@ -157,6 +157,7 @@ namespace Oqtane.Controllers
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
_notifications.AddNotification(notification);
|
||||
}
|
||||
|
||||
@ -385,6 +386,7 @@ namespace Oqtane.Controllers
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
_notifications.AddNotification(notification);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Security, "Password Reset Notification Sent For {Username}", user.Username);
|
||||
}
|
||||
|
@ -22,10 +22,14 @@
|
||||
<Content Remove="wwwroot\Modules\Templates\**" />
|
||||
<EmbeddedResource Remove="wwwroot\Modules\Templates\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Scripts\Tenant.01.00.01.01.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Scripts\Master.00.00.00.00.sql" />
|
||||
<EmbeddedResource Include="Scripts\Master.00.09.00.00.sql" />
|
||||
<EmbeddedResource Include="Scripts\Master.01.00.01.00.sql" />
|
||||
<EmbeddedResource Include="Scripts\Tenant.01.00.01.01.sql" />
|
||||
<EmbeddedResource Include="Scripts\Tenant.00.00.00.00.sql" />
|
||||
<EmbeddedResource Include="Scripts\Tenant.00.09.00.00.sql" />
|
||||
<EmbeddedResource Include="Scripts\Tenant.00.09.01.00.sql" />
|
||||
|
@ -21,6 +21,7 @@ namespace Oqtane.Repository
|
||||
return _db.Notification
|
||||
.Where(item => item.SiteId == siteId)
|
||||
.Where(item => item.IsDelivered == false)
|
||||
.Where(item => item.SendOn < System.DateTime.UtcNow)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
12
Oqtane.Server/Scripts/Tenant.01.00.01.01.sql
Normal file
12
Oqtane.Server/Scripts/Tenant.01.00.01.01.sql
Normal file
@ -0,0 +1,12 @@
|
||||
/*
|
||||
|
||||
Version 1.0.1 Notification migration script
|
||||
|
||||
*/
|
||||
|
||||
ALTER TABLE [dbo].[Notification] ADD
|
||||
[SendOn] [datetime] NULL
|
||||
GO
|
||||
|
||||
UPDATE [dbo].[Notification] SET SendOn = CreatedOn WHERE SendOn IS NULL
|
||||
GO
|
@ -22,6 +22,7 @@ namespace Oqtane.Models
|
||||
public string DeletedBy { get; set; }
|
||||
public DateTime? DeletedOn { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime? SendOn { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user