Browse Source

Small fixes.

pull/342/head
Sebastian 8 years ago
parent
commit
4dedfec849
  1. 14
      extensions/Squidex.Extensions/Actions/Email/EmailAction.cs
  2. 17
      extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs
  3. 1
      src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs
  4. 16
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html
  5. 3
      src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts
  6. 2
      src/Squidex/app/features/rules/pages/rules/rule-element.component.html
  7. 1
      tests/Squidex.Tests/Pipeline/ETagFilterTests.cs

14
extensions/Squidex.Extensions/Actions/Email/EmailAction.cs

@ -15,28 +15,28 @@ namespace Squidex.Extensions.Actions.Email
IconImage = "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M28 5h-24c-2.209 0-4 1.792-4 4v13c0 2.209 1.791 4 4 4h24c2.209 0 4-1.791 4-4v-13c0-2.208-1.791-4-4-4zM2 10.25l6.999 5.25-6.999 5.25v-10.5zM30 22c0 1.104-0.898 2-2 2h-24c-1.103 0-2-0.896-2-2l7.832-5.875 4.368 3.277c0.533 0.398 1.166 0.6 1.8 0.6 0.633 0 1.266-0.201 1.799-0.6l4.369-3.277 7.832 5.875zM30 20.75l-7-5.25 7-5.25v10.5zM17.199 18.602c-0.349 0.262-0.763 0.4-1.199 0.4s-0.851-0.139-1.2-0.4l-12.8-9.602c0-1.103 0.897-2 2-2h24c1.102 0 2 0.897 2 2l-12.801 9.602z'/></svg>",
IconColor = "#333300",
Display = "Send an email",
Description = "Send an email",
Description = "Send an email with a custom SMTP server.",
ReadMore = "https://en.wikipedia.org/wiki/Email")]
public class EmailAction : RuleAction
public sealed class EmailAction : RuleAction
{
[Required]
[Display(Name = "ServerHost", Description = "The Name or IP address of the host used for SMTP transactions.")]
[Display(Name = "ServerHost", Description = "The IP address or host to the SMTP server.")]
public string ServerHost { get; set; }
[Required]
[Display(Name = "ServerPort", Description = "The port to be used on host.")]
[Display(Name = "ServerPort", Description = "The port to the SMTP server.")]
public int ServerPort { get; set; }
[Required]
[Display(Name = "ServerUseSsl", Description = "Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.")]
[Display(Name = "ServerUseSsl", Description = "Specify whether the SMPT client uses Secure Sockets Layer (SSL) to encrypt the connection.")]
public bool ServerUseSsl { get; set; }
[Required]
[Display(Name = "ServerUsername", Description = "The username used to authenticate the sender.")]
[Display(Name = "ServerUsername", Description = "The username for the SMTP server.")]
public string ServerUsername { get; set; }
[Required]
[Display(Name = "ServerPassword", Description = "The password used to authenticate the sender.")]
[Display(Name = "ServerPassword", Description = "The password for the SMTP server.")]
public string ServerPassword { get; set; }
[Required]

17
extensions/Squidex.Extensions/Actions/Email/EmailActionHandler.cs

@ -6,22 +6,16 @@
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Options;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.HandleRules.EnrichedEvents;
using Squidex.Infrastructure;
namespace Squidex.Extensions.Actions.Email
{
public sealed class EmailActionHandler : RuleActionHandler<EmailAction, EmailJob>
{
private const string Description = "Send an Email";
public EmailActionHandler(RuleEventFormatter formatter)
: base(formatter)
{
@ -42,7 +36,9 @@ namespace Squidex.Extensions.Actions.Email
MessageBody = Format(action.MessageBody, @event)
};
return (Description, ruleJob);
var description = $"Send an email to {action.MessageTo}";
return (description, ruleJob);
}
protected override async Task<(string Dump, Exception Exception)> ExecuteJobAsync(EmailJob job)
@ -56,6 +52,7 @@ namespace Squidex.Extensions.Actions.Email
{
message.Subject = job.MessageSubject;
message.Body = job.MessageBody;
await client.SendMailAsync(message);
}
}
@ -64,12 +61,12 @@ namespace Squidex.Extensions.Actions.Email
}
}
public class EmailJob
public sealed class EmailJob
{
public string ServerHost { get; set; }
public int ServerPort { get; set; }
public string ServerHost { get; set; }
public string ServerUsername { get; set; }
public string ServerPassword { get; set; }

1
src/Squidex.Domain.Apps.Entities/Schemas/Guards/GuardSchema.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

16
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.html

@ -8,7 +8,7 @@
<input type="text" class="form-control" id="serverHost" formControlName="serverHost" />
<small class="form-text text-muted">
The Name or IP address of the host used for SMTP transactions.
The IP address or host to the SMTP server.
</small>
</div>
</div>
@ -19,10 +19,10 @@
<div class="col-9">
<sqx-control-errors for="serverPort" [submitted]="actionFormSubmitted"></sqx-control-errors>
<input type="text" class="form-control" id="serverPort" formControlName="serverPort" />
<input type="number" class="form-control" id="serverPort" formControlName="serverPort" />
<small class="form-text text-muted">
The port to be used on host.
The port to the SMTP server.
</small>
</div>
</div>
@ -36,7 +36,7 @@
</label>
</div>
<small class="form-text text-muted">
Specify whether the smtp client uses Secure Sockets Layer (SSL) to encrypt the connection.
Specify whether the SMTP client uses Secure Sockets Layer (SSL) to encrypt the connection.
</small>
</div>
</div>
@ -50,7 +50,7 @@
<input type="text" class="form-control" id="serverUsername" formControlName="serverUsername" />
<small class="form-text text-muted">
The username used to authenticate the sender. Read the <a routerLink="help">help</a> section for information about advanced formatting.
The username for the SMTP server.
</small>
</div>
</div>
@ -64,7 +64,7 @@
<input type="password" class="form-control" id="serverPassword" formControlName="serverPassword" />
<small class="form-text text-muted">
The password used to authenticate the sender.
The password for the SMTP server.
</small>
</div>
</div>
@ -78,7 +78,7 @@
<input type="text" class="form-control" id="messageFrom" formControlName="messageFrom" />
<small class="form-text text-muted">
The email sending address. Read the <a routerLink="help">help</a> section for information about advanced formatting.
The email sending address. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>
@ -92,7 +92,7 @@
<input type="text" class="form-control" id="messageTo" formControlName="messageTo" />
<small class="form-text text-muted">
The email message will be sent to. Read the <a routerLink="help">help</a> section for information about advanced formatting.
The email message will be sent to. Read the <a routerLink="help">help</a> section for information about advanced formatting.
</small>
</div>
</div>

3
src/Squidex/app/features/rules/pages/rules/actions/email-action.component.ts

@ -31,8 +31,7 @@ export class EmailActionComponent implements OnInit {
this.actionForm.setControl('serverPort',
new FormControl(this.action.serverPort || 465, [
Validators.required,
Validators.pattern(/\d{2,6}/)
Validators.required
]));
this.actionForm.setControl('serverUseSsl',

2
src/Squidex/app/features/rules/pages/rules/rule-element.component.html

@ -25,7 +25,7 @@
</div>
<div class="large-link" *ngIf="element.readMore">
<a [href]="element.readMore" target="_blank" rel="noopener">Read More</a>
<a [href]="element.readMore" (click)="$event.stopPropagation()" target="_blank" rel="noopener">Read More</a>
</div>
</div>
</div>

1
tests/Squidex.Tests/Pipeline/ETagFilterTests.cs

@ -7,7 +7,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using FakeItEasy;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Abstractions;

Loading…
Cancel
Save