Skip to content

Commit c8cea18

Browse files
committed
PR feedback updates
1 parent 50c4891 commit c8cea18

File tree

3 files changed

+12
-28
lines changed

3 files changed

+12
-28
lines changed

src/Umbraco.Cms.Integrations.Automation.Zapier/Controllers/PollingController.cs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@ public PollingController(IContentService contentService, IUserValidationService
4444
_userValidationService = userValidationService;
4545
}
4646

47-
public List<Dictionary<string, string>> GetPublishedContent()
47+
public List<Dictionary<string, string>> GetContent()
4848
{
49-
var publishedContent = new List<Dictionary<string, string>>();
50-
5149
string username = string.Empty;
5250
string password = string.Empty;
5351

@@ -72,32 +70,18 @@ public List<Dictionary<string, string>> GetPublishedContent()
7270
var isAuthorized = _userValidationService.Validate(username, password, Options.UserGroup).GetAwaiter().GetResult();
7371
if (!isAuthorized) return null;
7472

75-
var rootNodes = _contentService.GetRootContent().Where(p => p.Published)
76-
.OrderByDescending(p => p.PublishDate);
73+
var root = _contentService.GetRootContent().Where(p => p.Published)
74+
.OrderByDescending(p => p.PublishDate).FirstOrDefault();
7775

78-
foreach (var publishedContentRoot in rootNodes)
76+
return new List<Dictionary<string, string>>
7977
{
80-
publishedContent.Add(new Dictionary<string, string>
81-
{
82-
{ Constants.Content.Id, publishedContentRoot.Id.ToString() },
83-
{ Constants.Content.Name, publishedContentRoot.Name },
84-
{ Constants.Content.PublishDate, publishedContentRoot.PublishDate.Value.ToString() }
85-
});
86-
87-
var ancestors = _contentService.GetAncestors(publishedContentRoot);
88-
foreach (var ancestor in ancestors)
78+
new Dictionary<string, string>
8979
{
90-
publishedContent.Add(new Dictionary<string, string>
91-
{
92-
{ Constants.Content.Id, ancestor.Id.ToString() },
93-
{ Constants.Content.Name, ancestor.Name },
94-
{ Constants.Content.PublishDate, ancestor.PublishDate.Value.ToString() }
95-
});
96-
80+
{Constants.Content.Id, root?.Id.ToString()},
81+
{Constants.Content.Name, root?.Name},
82+
{Constants.Content.PublishDate, root?.PublishDate.ToString()}
9783
}
98-
}
99-
100-
return publishedContent;
84+
};
10185
}
10286

10387
}

src/Umbraco.Cms.Integrations.Automation.Zapier/Controllers/SubscriptionController.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ public bool UpdatePreferences([FromBody] SubscriptionDto dto)
7373

7474
var result = _zapConfigService.UpdatePreferences(dto.HookUrl, dto.Enable);
7575

76-
if (!string.IsNullOrEmpty(result)) return false;
77-
78-
return true;
76+
return string.IsNullOrEmpty(result);
7977
}
8078
}
8179
}

src/Umbraco.Cms.Integrations.Automation.Zapier/Migrations/ZapContentConfigTable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ public class ZapContentConfig
6363
public int Id { get; set; }
6464

6565
[Column("ContentTypeName")]
66+
[Index(IndexTypes.NonClustered, Name = "IX_ZapContentConfig_ContentTypeName")]
6667
public string ContentTypeName { get; set; }
6768

6869
[Column("WebHookUrl")]
70+
[Index(IndexTypes.NonClustered, Name = "IX_ZapContentConfig_WebHookUrl")]
6971
public string WebHookUrl { get; set; }
7072

7173
[Column("IsEnabled")]

0 commit comments

Comments
 (0)