From 8aaaf4439abf7f5b57bc7a3fb4444118e8855d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 17 Jan 2019 10:12:28 +0100 Subject: [PATCH 01/76] Changed UI for resizable handler --- .../src/less/application/grid.less | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/application/grid.less b/src/Umbraco.Web.UI.Client/src/less/application/grid.less index a7b4bd0011..073d1b5721 100644 --- a/src/Umbraco.Web.UI.Client/src/less/application/grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/application/grid.less @@ -41,9 +41,9 @@ body { #mainwrapper { position: absolute; - top: 0; - left: 0; - right: 0; + top: 0; + left: 0; + right: 0; bottom: 0; margin: 0; } @@ -56,10 +56,10 @@ body.umb-drawer-is-visible #mainwrapper{ position: absolute; top: 0px; bottom: 0px; - right: 0px; + right: 0px; left: 0px; z-index: 10; - margin: 0 + margin: 0; } #umb-notifications-wrapper { @@ -151,17 +151,23 @@ body.umb-drawer-is-visible #mainwrapper{ } .ui-resizable-e { - cursor: e-resize; - width: 4px; + cursor: col-resize; + width: 10px; right: -5px; top: 0; bottom: 0; - background-color: @gray-10; - border: solid 1px @purple-l3; - border-top: none; - border-bottom: none; position:absolute; z-index:9999 !important; + + &:hover::after { + content: ''; + position: absolute; + background-color: @gray-8; + top: 0; + bottom: 0; + width: 1px; + right: 5px; + } } @media (min-width: 1101px) { From d6c2fec5d20d4e3f8c69cb1b90d18ca45b060526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 17 Jan 2019 10:16:04 +0100 Subject: [PATCH 02/76] Added UI hover for expansion panel --- .../src/less/components/html/umb-expansion-panel.less | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/components/html/umb-expansion-panel.less b/src/Umbraco.Web.UI.Client/src/less/components/html/umb-expansion-panel.less index 26347c8501..2d1cbd10ff 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/html/umb-expansion-panel.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/html/umb-expansion-panel.less @@ -13,6 +13,10 @@ cursor: pointer; justify-content: space-between; color: @black; + + &:hover .umb-expansion-panel__expand { + color: @gray-6; + } } .umb-expansion-panel__expand { @@ -22,4 +26,4 @@ .umb-expansion-panel__content { padding: 20px; border-top: 1px solid @gray-9; -} \ No newline at end of file +} From d8f0af1a94d14fc9b79882e11be4bddcf79b3fb1 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Tue, 22 Jan 2019 20:37:47 +0100 Subject: [PATCH 03/76] Fix plural localization --- src/Umbraco.Web.UI/umbraco/config/lang/da.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index b4ab08422e..3223478dd7 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -1458,9 +1458,9 @@ Mange hilsner fra Umbraco robotten Makroer Medietyper Medlemmer - Medlemsgruppe + Medlemsgrupper Roller - Medlemstype + Medlemstyper Dokumenttyper Relationstyper Pakker From 832ec68140026c8256af00ac5991a36356ba25aa Mon Sep 17 00:00:00 2001 From: Paul Seal Date: Mon, 21 Jan 2019 23:38:38 +0000 Subject: [PATCH 04/76] - tls check to check if the site is set up to use at least TLS 1.2 for outgoing connections. - added translations for all languages which have a healthcheck section in the language file. --- .../Umbraco/config/lang/zh_tw.xml | 5 +- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 3 ++ .../umbraco/config/lang/en_us.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/es.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/fr.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/nl.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/pl.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/ru.xml | 3 ++ src/Umbraco.Web.UI/umbraco/config/lang/zh.xml | 3 ++ .../HealthCheck/Checks/Security/TlsCheck.cs | 51 +++++++++++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 1 + 11 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml index 16387728b1..ba30581267 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml @@ -1331,6 +1331,9 @@ SMTP伺服器 %0% : %1% 無法連接。請確認在Web.config 檔案中 system.net/mailsettings 設定正確。 %0%。]]> %0%。]]> + + 您的網站設置為使用TLS 1.2或更高版本進行傳出連接。 + 來自您網站的傳出連接通過舊協議提供。您應該考慮將其更新為使用TLS 1.2或更高版本。 停止網址追蹤器 @@ -1350,4 +1353,4 @@ 轉址追蹤器已開啟。 啟動轉址追蹤器錯誤,更多資訊請參閱您的紀錄檔。 - \ No newline at end of file + diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 7d3bfa7c99..06a7fbb109 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -2206,6 +2206,9 @@ To manage your website, simply open the Umbraco back office and start adding con %0%.]]>

Results of the scheduled Umbraco Health Checks run on %0% at %1% are as follows:

%2%]]>
Umbraco Health Check Status: %0% + + Your website is set up to use TLS 1.2 or greater for outgoing connections. + Outgoing connections from your website are being served over an old protocol. You should consider updating it to use TLS 1.2 or higher. Disable URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 0a1756038f..766d2eec9e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -2199,6 +2199,9 @@ To manage your website, simply open the Umbraco back office and start adding con %0%.]]>

Results of the scheduled Umbraco Health Checks run on %0% at %1% are as follows:

%2%]]>
Umbraco Health Check Status: %0% + + Your website is set up to use TLS 1.2 or greater for outgoing connections. + Outgoing connections from your website are being served over an old protocol. You should consider updating it to use TLS 1.2 or higher. Disable URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml index ba0027aef0..607050c235 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml @@ -1856,6 +1856,9 @@ %0%.]]>

Los resultados de los Chequeos de Salud de Umbraco programados para ejecutarse el %0% a las %1% son:

%2%]]>
Status de los Chequeos de Salud de Umbraco: %0% + + Su sitio web está configurado para usar TLS 1.2 o superior para las conexiones salientes. + Las conexiones salientes de su sitio web están siendo servidas a través de un protocolo antiguo. Deberías considerar actualizarlo para usar TLS 1.2 o superior. Desactivar URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml index fd2b4c53a8..dab9f49120 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml @@ -2170,6 +2170,9 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à %0%.]]>

Les résultats de l'exécution du Umbraco Health Checks planifiée le %0% à %1% sont les suivants :

%2%]]>
Statut du Umbraco Health Check: %0% + + Votre site Web est configuré pour utiliser TLS version 1.2 ou supérieure pour les connexions sortantes. + Les connexions sortantes de votre site Web sont servies via un ancien protocole. Vous devriez envisager de le mettre à jour pour utiliser TLS 1.2 ou supérieur. Désactiver URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml index 26b057e49f..4680d0dfc5 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml @@ -1623,6 +1623,9 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de %0%.]]> %0%.]]> + + Uw website is ingesteld om TLS 1.2 of hoger te gebruiken voor uitgaande verbindingen. + Uitgaande verbindingen van uw website worden via een oud protocol bediend. U zou moeten overwegen om het bij te werken om TLS 1.2 of hoger te gebruiken. URL tracker uitzetten diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml index 9affa43727..bb36628757 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml @@ -1674,6 +1674,9 @@ Naciśnij przycisk instaluj, aby zainstalować bazę danych Umb %0%.]]> %0%.]]> + + Twoja strona internetowa jest skonfigurowana do używania protokołu TLS 1.2 lub nowszego dla połączeń wychodzących. + Połączenia wychodzące z Twojej witryny są obsługiwane przez stary protokół. Należy rozważyć zaktualizowanie go do korzystania z TLS w wersji 1.2 lub nowszej. Wyłącz śledzenie URL diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index fd33e647ad..37a4613d43 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -870,6 +870,9 @@ %0%.]]>

Зафиксированы следующие результаты автоматической проверки состояния Umbraco по расписанию, запущенной на %0% в %1%:

%2%]]>
Результат проверки состояния Umbraco: %0% + + Ваш веб-сайт настроен на использование TLS 1.2 или выше для исходящих соединений. + Исходящие соединения с вашего сайта обслуживаются по старому протоколу. Вы должны рассмотреть возможность его обновления для использования TLS 1.2 или выше. перейти к diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml index a918b78f95..471925ccd5 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml @@ -1598,6 +1598,9 @@ The SMTP server configured with host '%0%' and port '%1%' could not be reached. Please check to ensure the SMTP settings in the Web.config file system.net/mailsettings are correct. %0%.]]> %0%.]]> + + 您的网站设置为使用TLS 1.2或更高版本进行传出连接。 + 来自您网站的传出连接通过旧协议提供。您应该考虑将其更新为使用TLS 1.2或更高版本。 禁用 url 跟踪程序 diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs new file mode 100644 index 0000000000..8d41965395 --- /dev/null +++ b/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Net; +using Umbraco.Core.Services; + +namespace Umbraco.Web.HealthCheck.Checks.Security +{ + [HealthCheck("6D7D4E11-758E-4697-BA72-7E02A530CBD4", + "TLS Check", + Description = "Checks that your site is set up to use at least TLS 1.2 for outgoing connections.", + Group = "Security")] + public class TlsCheck : HealthCheck + { + private readonly ILocalizedTextService _textService; + + public TlsCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext) + { + _textService = healthCheckContext.ApplicationContext.Services.TextService; + } + + public override IEnumerable GetStatus() + { + return new[] { CheckTls() }; + } + + public override HealthCheckStatus ExecuteAction(HealthCheckAction action) + { + throw new InvalidOperationException("TlsCheck has no executable actions"); + } + + public HealthCheckStatus CheckTls() + { + bool success = (int)ServicePointManager.SecurityProtocol >= (int)SecurityProtocolType.Tls12; + + string message = success + ? _textService.Localize("healthcheck/tlsHealthCheckSuccess") + : _textService.Localize("healthcheck/tlsHealthCheckWarn"); + + var actions = new List(); + + return + new HealthCheckStatus(message) + { + ResultType = success + ? StatusResultType.Success + : StatusResultType.Warning, + Actions = actions + }; + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 1b668b06c8..a66e960e97 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -338,6 +338,7 @@ + From 9eb2b28232772532cc74686cd4d01efdf13905f6 Mon Sep 17 00:00:00 2001 From: Alkaersig Date: Thu, 17 Jan 2019 12:08:53 +0100 Subject: [PATCH 05/76] Added (Doctype) Name and Description to PublishedContentType --- .../Models/PublishedContent/PublishedContentType.cs | 10 ++++++++-- src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs | 4 ++-- src/Umbraco.Tests/LibraryTests.cs | 2 +- .../Membership/DynamicMemberContentTests.cs | 2 +- .../PublishedContent/DynamicDocumentTestsBase.cs | 4 ++-- .../PublishedContent/PublishedContentDataTableTests.cs | 4 ++-- .../PublishedContent/PublishedContentMoreTests.cs | 6 +++--- .../PublishedContent/PublishedContentTestBase.cs | 4 ++-- .../PublishedContent/PublishedContentTestElements.cs | 8 ++++---- .../PublishedContent/PublishedContentTests.cs | 2 +- src/Umbraco.Tests/TestHelpers/BaseWebTest.cs | 2 +- src/Umbraco.Tests/Views/site1/template2.cshtml | 4 ++++ 12 files changed, 31 insertions(+), 21 deletions(-) create mode 100644 src/Umbraco.Tests/Views/site1/template2.cshtml diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs index 63164cf271..4ca32bb718 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs @@ -25,6 +25,8 @@ namespace Umbraco.Core.Models.PublishedContent { Id = contentType.Id; Alias = contentType.Alias; + Name = contentType.Name; + Description = contentType.Description; _compositionAliases = new HashSet(contentType.CompositionAliases(), StringComparer.InvariantCultureIgnoreCase); _propertyTypes = contentType.CompositionPropertyTypes .Select(x => new PublishedPropertyType(this, x)) @@ -33,10 +35,12 @@ namespace Umbraco.Core.Models.PublishedContent } // internal so it can be used for unit tests - internal PublishedContentType(int id, string alias, IEnumerable compositionAliases, IEnumerable propertyTypes) + internal PublishedContentType(int id, string alias, string name, string description, IEnumerable compositionAliases, IEnumerable propertyTypes) { Id = id; Alias = alias; + Name = name; + Description = description; _compositionAliases = new HashSet(compositionAliases, StringComparer.InvariantCultureIgnoreCase); _propertyTypes = propertyTypes.ToArray(); foreach (var propertyType in _propertyTypes) @@ -46,7 +50,7 @@ namespace Umbraco.Core.Models.PublishedContent // create detached content type - ie does not match anything in the DB internal PublishedContentType(string alias, IEnumerable compositionAliases, IEnumerable propertyTypes) - : this(0, alias, compositionAliases, propertyTypes) + : this(0, alias, string.Empty, string.Empty, compositionAliases, propertyTypes) { } private void InitializeIndexes() @@ -63,6 +67,8 @@ namespace Umbraco.Core.Models.PublishedContent public int Id { get; private set; } public string Alias { get; private set; } + public string Name { get; private set; } + public string Description { get; private set; } public HashSet CompositionAliases { get { return _compositionAliases; } } #endregion diff --git a/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs b/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs index 5fe2efaa2c..6f64ef8b69 100644 --- a/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs +++ b/src/Umbraco.Tests/CodeFirst/StronglyTypedMapperTest.cs @@ -83,7 +83,7 @@ namespace Umbraco.Tests.CodeFirst new PublishedPropertyType("articleDate", 0, "?"), new PublishedPropertyType("pageTitle", 0, "?"), }; - var type = new AutoPublishedContentType(0, "anything", propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; Debug.Print("INIT STRONG {0}", PublishedContentType.Get(PublishedItemType.Content, "anything") @@ -148,4 +148,4 @@ namespace Umbraco.Tests.CodeFirst } #endregion } -} \ No newline at end of file +} diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 086395f456..42e218835c 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -43,7 +43,7 @@ namespace Umbraco.Tests // AutoPublishedContentType will auto-generate other properties new PublishedPropertyType("content", 0, "?"), }; - var type = new AutoPublishedContentType(0, "anything", propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; Debug.Print("INIT LIB {0}", PublishedContentType.Get(PublishedItemType.Content, "anything") diff --git a/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs b/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs index 4c1272550d..7bfe75f9aa 100644 --- a/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs +++ b/src/Umbraco.Tests/Membership/DynamicMemberContentTests.cs @@ -41,7 +41,7 @@ namespace Umbraco.Tests.Membership new PublishedPropertyType("bodyText", 0, "?"), new PublishedPropertyType("author", 0, "?") }; - var type = new AutoPublishedContentType(0, "anything", propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; } diff --git a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs index 07787d8e2c..fd736f0700 100644 --- a/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs +++ b/src/Umbraco.Tests/PublishedContent/DynamicDocumentTestsBase.cs @@ -50,7 +50,7 @@ namespace Umbraco.Tests.PublishedContent new PublishedPropertyType("creatorName", 0, "?"), new PublishedPropertyType("blah", 0, "?"), // ugly error when that one is missing... }; - var type = new AutoPublishedContentType(0, "anything", propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; } @@ -729,4 +729,4 @@ namespace Umbraco.Tests.PublishedContent return s.Contains(val.ToString()); } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs index 8efe6efd72..c57bacad29 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs @@ -24,7 +24,7 @@ namespace Umbraco.Tests.PublishedContent // need to specify a custom callback for unit tests // AutoPublishedContentTypes generates properties automatically - var type = new AutoPublishedContentType(0, "anything", new PublishedPropertyType[] {}); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", new PublishedPropertyType[] {}); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; // need to specify a different callback for testing @@ -251,4 +251,4 @@ namespace Umbraco.Tests.PublishedContent } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs index 1c83691d04..1f2f43de8b 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentMoreTests.cs @@ -234,9 +234,9 @@ namespace Umbraco.Tests.PublishedContent new PublishedPropertyType("prop1", 1, "?"), }; - var contentType1 = new PublishedContentType(1, "ContentType1", Enumerable.Empty(), props); - var contentType2 = new PublishedContentType(2, "ContentType2", Enumerable.Empty(), props); - var contentType2s = new PublishedContentType(3, "ContentType2Sub", Enumerable.Empty(), props); + var contentType1 = new PublishedContentType(1, "ContentType1", "ContentType1", "ContentType1", Enumerable.Empty(), props); + var contentType2 = new PublishedContentType(2, "ContentType2", "ContentType2", "ContentType2", Enumerable.Empty(), props); + var contentType2s = new PublishedContentType(3, "ContentType2Sub", "ContentType2Sub", "ContentType2Sub", Enumerable.Empty(), props); cache.Add(new SolidPublishedContent(contentType1) { diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs index 789d9f7218..c0fff5f8da 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs @@ -29,7 +29,7 @@ namespace Umbraco.Tests.PublishedContent // AutoPublishedContentType will auto-generate other properties new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEAlias), }; - var type = new AutoPublishedContentType(0, "anything", propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; var rCtx = GetRoutingContext("/test", 1234); @@ -65,4 +65,4 @@ namespace Umbraco.Tests.PublishedContent UmbracoContext.Current = null; } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs index 82115d670e..2ebc8c2e4b 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs @@ -354,12 +354,12 @@ namespace Umbraco.Tests.PublishedContent { private static readonly PublishedPropertyType Default = new PublishedPropertyType("*", 0, "?"); - public AutoPublishedContentType(int id, string alias, IEnumerable propertyTypes) - : base(id, alias, Enumerable.Empty(), propertyTypes) + public AutoPublishedContentType(int id, string alias, string name, string description, IEnumerable propertyTypes) + : base(id, alias, name, description, Enumerable.Empty(), propertyTypes) { } - public AutoPublishedContentType(int id, string alias, IEnumerable compositionAliases, IEnumerable propertyTypes) - : base(id, alias, compositionAliases, propertyTypes) + public AutoPublishedContentType(int id, string alias, string name, string description, IEnumerable compositionAliases, IEnumerable propertyTypes) + : base(id, alias, name, description, compositionAliases, propertyTypes) { } public override PublishedPropertyType GetPropertyType(string alias) diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index 5ec34ea781..4358f5de47 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -49,7 +49,7 @@ namespace Umbraco.Tests.PublishedContent new PublishedPropertyType("testRecursive", 0, "?"), }; var compositionAliases = new[] { "MyCompositionAlias" }; - var type = new AutoPublishedContentType(0, "anything", compositionAliases, propertyTypes); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", compositionAliases, propertyTypes); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; } diff --git a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs index dfc6317d32..c7fe2d0168 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs @@ -15,7 +15,7 @@ namespace Umbraco.Tests.TestHelpers // need to specify a custom callback for unit tests // AutoPublishedContentTypes generates properties automatically - var type = new AutoPublishedContentType(0, "anything", new PublishedPropertyType[] {}); + var type = new AutoPublishedContentType(0, "anything", "anything", "anything", new PublishedPropertyType[] {}); PublishedContentType.GetPublishedContentTypeCallback = (alias) => type; } diff --git a/src/Umbraco.Tests/Views/site1/template2.cshtml b/src/Umbraco.Tests/Views/site1/template2.cshtml new file mode 100644 index 0000000000..3e82f2f0d2 --- /dev/null +++ b/src/Umbraco.Tests/Views/site1/template2.cshtml @@ -0,0 +1,4 @@ +@inherits Umbraco.Web.Mvc.UmbracoTemplatePage +@{ + Layout = null; +} \ No newline at end of file From 7acafe67a48f8b30cbeb75a965be616a1e228adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Alk=C3=A6rsig?= Date: Thu, 17 Jan 2019 13:23:35 +0100 Subject: [PATCH 06/76] Delete template2.cshtml Auto-generated test file --- src/Umbraco.Tests/Views/site1/template2.cshtml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 src/Umbraco.Tests/Views/site1/template2.cshtml diff --git a/src/Umbraco.Tests/Views/site1/template2.cshtml b/src/Umbraco.Tests/Views/site1/template2.cshtml deleted file mode 100644 index 3e82f2f0d2..0000000000 --- a/src/Umbraco.Tests/Views/site1/template2.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@inherits Umbraco.Web.Mvc.UmbracoTemplatePage -@{ - Layout = null; -} \ No newline at end of file From ddace54f45515bfec5f20b631ab2414632da0775 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 07:51:43 +0100 Subject: [PATCH 07/76] Fixed wrong merge in Children() method --- src/Umbraco.Web/PublishedContentExtensions.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 530c9bd9b4..98a5a9a6f0 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -956,13 +956,6 @@ namespace Umbraco.Web { if (content == null) throw new ArgumentNullException(nameof(content)); // fixme/task wtf is this? - return content.Children.Where(x => - { - if (!x.ContentType.VariesByCulture()) return true; // invariant = always ok - return x.HasCulture(culture); - return false; - }); - return content.Children.WhereIsInvariantOrHasCulture(culture); } From dcb616157dbc7d4a11d17aaad176fbdc828553d6 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 07:52:24 +0100 Subject: [PATCH 08/76] Removed unused IPreValueConnector --- src/Umbraco.Core/Deploy/IPreValueConnector.cs | 32 ------------------- src/Umbraco.Core/Umbraco.Core.csproj | 1 - 2 files changed, 33 deletions(-) delete mode 100644 src/Umbraco.Core/Deploy/IPreValueConnector.cs diff --git a/src/Umbraco.Core/Deploy/IPreValueConnector.cs b/src/Umbraco.Core/Deploy/IPreValueConnector.cs deleted file mode 100644 index 2a8f4e622d..0000000000 --- a/src/Umbraco.Core/Deploy/IPreValueConnector.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections.Generic; - -namespace Umbraco.Core.Deploy -{ - /// - /// Defines methods that can convert a preValue to / from an environment-agnostic string. - /// - /// PreValues may contain values such as content identifiers, that would be local - /// to one environment, and need to be converted in order to be deployed. - public interface IPreValueConnector // fixme/task: rename to IDataTypeConfigurationConnector + kill all "preValues" name usage - { - /// - /// Gets the property editor aliases that the value converter supports by default. - /// - IEnumerable PropertyEditorAliases { get; } - - /// - /// Gets the environment-agnostic preValues corresponding to environment-specific preValues. - /// - /// The environment-specific preValues. - /// The dependencies. - /// - IDictionary ConvertToDeploy(IDictionary preValues, ICollection dependencies); - - /// - /// Gets the environment-specific preValues corresponding to environment-agnostic preValues. - /// - /// The environment-agnostic preValues. - /// - IDictionary ConvertToLocalEnvironment(IDictionary preValues); - } -} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 0ff88da2f3..e97fd0d8e0 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -564,7 +564,6 @@ - From e871392405acb1ca475819b22fa8a49bc3fa694d Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 07:54:45 +0100 Subject: [PATCH 09/76] Added IsPublished(culture) to IPublishedContent --- .../PublishedContent/IPublishedContent.cs | 8 ++++++-- .../PublishedContentWrapped.cs | 4 ++++ .../XmlPublishedContentInitBenchmarks.cs | 20 ++++++++++--------- .../Published/NestedContentTests.cs | 1 + .../PublishedContentDataTableTests.cs | 1 + .../SolidPublishedSnapshot.cs | 1 + .../TestHelpers/Stubs/TestPublishedContent.cs | 1 + .../Models/PublishedContentBase.cs | 2 ++ .../NuCache/PublishedContent.cs | 17 ++++++++++++++++ .../PublishedCache/PublishedMember.cs | 2 ++ .../DictionaryPublishedContent.cs | 2 ++ .../XmlPublishedCache/XmlPublishedContent.cs | 12 +++++++++-- src/Umbraco.Web/umbraco.presentation/page.cs | 5 +++++ 13 files changed, 63 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs index c5fa0330f2..e50fb2c396 100644 --- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs +++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs @@ -153,8 +153,12 @@ namespace Umbraco.Core.Models.PublishedContent /// bool IsDraft(string culture = null); - // fixme/task - consider having an IsPublished flag too - // so that when IsDraft is true, we can check whether there is a published version? + /// + /// Gets a value indicating whether the content is published. + /// + /// + bool IsPublished(string culture = null); + #endregion diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs index 36755c8944..42ff16bae5 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs @@ -111,6 +111,10 @@ namespace Umbraco.Core.Models.PublishedContent /// public virtual bool IsDraft(string culture = null) => _content.IsDraft(culture); + /// + public virtual bool IsPublished(string culture = null) => _content.IsPublished(culture); + + #endregion #region Tree diff --git a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs index 751767f8e7..860dc0ac4b 100644 --- a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs @@ -94,6 +94,7 @@ namespace Umbraco.Tests.Benchmarks Guid key, version; string name, urlName, writerName, creatorName, docTypeAlias, path; bool isDraft; + bool isPublished; DateTime createDate, updateDate; PublishedContentType publishedContentType; Dictionary properties; @@ -104,7 +105,7 @@ namespace Umbraco.Tests.Benchmarks OriginalInitializeNode(_xml10.DocumentElement, false, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out version, out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out version, out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, out properties); } @@ -114,7 +115,7 @@ namespace Umbraco.Tests.Benchmarks OriginalInitializeNode(_xml100.DocumentElement, false, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out version, out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out version, out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, out properties); } @@ -124,7 +125,7 @@ namespace Umbraco.Tests.Benchmarks OriginalInitializeNode(_xml1000.DocumentElement, false, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out version, out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out version, out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, out properties); } @@ -134,7 +135,7 @@ namespace Umbraco.Tests.Benchmarks OriginalInitializeNode(_xml10000.DocumentElement, false, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out version, out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out version, out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, out properties); } @@ -144,7 +145,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml10.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, out properties, GetPublishedContentType); } @@ -154,7 +155,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml100.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, out properties, GetPublishedContentType); } @@ -164,7 +165,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml1000.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, out properties, GetPublishedContentType); } @@ -174,7 +175,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml10000.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, out properties, GetPublishedContentType); } @@ -182,7 +183,7 @@ namespace Umbraco.Tests.Benchmarks internal static void OriginalInitializeNode(XmlNode xmlNode, bool legacy, bool isPreviewing, out int id, out Guid key, out int template, out int sortOrder, out string name, out string writerName, out string urlName, out string creatorName, out int creatorId, out int writerId, out string docTypeAlias, out int docTypeId, out string path, - out Guid version, out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft, + out Guid version, out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft, out bool isPublished, out PublishedContentType contentType, out Dictionary properties) { //initialize the out params with defaults: @@ -193,6 +194,7 @@ namespace Umbraco.Tests.Benchmarks name = writerName = urlName = creatorName = docTypeAlias = path = null; createDate = updateDate = default(DateTime); isDraft = false; + isPublished = true; contentType = null; properties = null; diff --git a/src/Umbraco.Tests/Published/NestedContentTests.cs b/src/Umbraco.Tests/Published/NestedContentTests.cs index b5d6182c28..91810d6de1 100644 --- a/src/Umbraco.Tests/Published/NestedContentTests.cs +++ b/src/Umbraco.Tests/Published/NestedContentTests.cs @@ -262,6 +262,7 @@ namespace Umbraco.Tests.Published // ReSharper disable UnassignedGetOnlyAutoProperty public override PublishedItemType ItemType { get; } public override bool IsDraft(string culture = null) => false; + public override bool IsPublished(string culture = null) => true; public override IPublishedContent Parent { get; } public override IEnumerable Children { get; } public override PublishedContentType ContentType { get; } diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs index 73f3cd1537..283ed1edd9 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentDataTableTests.cs @@ -217,6 +217,7 @@ namespace Umbraco.Tests.PublishedContent public Guid Version { get; set; } public int Level { get; set; } public bool IsDraft(string culture = null) => false; + public bool IsPublished(string culture = null) => true; public IEnumerable Properties { get; set; } diff --git a/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs b/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs index f7077ecb3a..a838e06a9a 100644 --- a/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs +++ b/src/Umbraco.Tests/PublishedContent/SolidPublishedSnapshot.cs @@ -192,6 +192,7 @@ namespace Umbraco.Tests.PublishedContent public PublishedItemType ItemType { get { return PublishedItemType.Content; } } public bool IsDraft(string culture = null) => false; + public bool IsPublished(string culture = null) => true; #endregion diff --git a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs index 58c8e37cbf..a9abe96232 100644 --- a/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs +++ b/src/Umbraco.Tests/TestHelpers/Stubs/TestPublishedContent.cs @@ -48,6 +48,7 @@ namespace Umbraco.Tests.TestHelpers.Stubs public string GetUrl(string culture = null) => throw new NotSupportedException(); public PublishedItemType ItemType => ContentType.ItemType; public bool IsDraft(string culture = null) => false; + public bool IsPublished(string culture = null) => true; public IPublishedContent Parent { get; set; } public IEnumerable Children { get; set; } diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs index c772f6ca85..12acb6b0c8 100644 --- a/src/Umbraco.Web/Models/PublishedContentBase.cs +++ b/src/Umbraco.Web/Models/PublishedContentBase.cs @@ -144,6 +144,8 @@ namespace Umbraco.Web.Models /// public abstract bool IsDraft(string culture = null); + public abstract bool IsPublished(string culture = null); + #endregion #region Tree diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index d1e1d63630..69c672ab98 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -293,6 +293,23 @@ namespace Umbraco.Web.PublishedCache.NuCache return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && cvar.IsDraft; } + public override bool IsPublished(string culture = null) + { + if (!ContentType.VariesByCulture()) + { + return _contentData.Published; + } + + // handle context culture + if (culture == null) + { + culture = VariationContextAccessor?.VariationContext?.Culture ?? ""; + } + + //If the current culture is not a draft, it must be the published version + return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && !cvar.IsDraft; + } + #endregion #region Tree diff --git a/src/Umbraco.Web/PublishedCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/PublishedMember.cs index ef95b2846c..cbe2250920 100644 --- a/src/Umbraco.Web/PublishedCache/PublishedMember.cs +++ b/src/Umbraco.Web/PublishedCache/PublishedMember.cs @@ -78,6 +78,8 @@ namespace Umbraco.Web.PublishedCache public override bool IsDraft(string culture = null) => false; + public override bool IsPublished(string culture = null) => true; + public override IPublishedContent Parent => null; public override IEnumerable Children => Enumerable.Empty(); diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs index 83bd84dab6..a395db1da5 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs @@ -179,6 +179,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache public override bool IsDraft(string culture = null) => false; + public override bool IsPublished(string culture = null) => true; + public override IEnumerable Properties => _properties; public override IEnumerable Children => _getChildren.Value; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index 2b3bc39452..c3cf22559d 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -63,6 +63,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private int _sortOrder; private int _level; private bool _isDraft; + private bool _isPublished; public override IEnumerable Children { @@ -228,6 +229,12 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache return _isDraft; // bah } + public override bool IsPublished(string culture = null) + { + EnsureNodeInitialized(); + return _isPublished; + } + public override IEnumerable Properties { get @@ -280,7 +287,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache InitializeNode(this, _xmlNode, _isPreviewing, out _id, out _key, out _template, out _sortOrder, out _name, out _writerName, out _urlName, out _creatorName, out _creatorId, out _writerId, out _docTypeAlias, out _docTypeId, out _path, - out _createDate, out _updateDate, out _level, out _isDraft, out _contentType, out _properties, + out _createDate, out _updateDate, out _level, out _isDraft, out _isPublished, out _contentType, out _properties, _contentTypeCache.Get); _nodeInitialized = true; @@ -290,7 +297,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache internal static void InitializeNode(XmlPublishedContent node, XmlNode xmlNode, bool isPreviewing, out int id, out Guid key, out int template, out int sortOrder, out string name, out string writerName, out string urlName, out string creatorName, out int creatorId, out int writerId, out string docTypeAlias, out int docTypeId, out string path, - out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft, + out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft,out bool isPublished, out PublishedContentType contentType, out Dictionary properties, Func getPublishedContentType) { @@ -302,6 +309,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache name = writerName = urlName = creatorName = docTypeAlias = path = null; createDate = updateDate = default(DateTime); isDraft = false; + isPublished = false; contentType = null; properties = null; diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index 7b591640b5..0c9b0c6ff3 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -469,6 +469,11 @@ namespace umbraco throw new NotImplementedException(); } + public bool IsPublished(string culture = null) + { + throw new NotImplementedException(); + } + public IPublishedContent Parent { get { return _parent; } From 6f25bc7c37b3e16344e1b4956f97b979dad6439a Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 08:17:39 +0100 Subject: [PATCH 10/76] Reintroduced a interface for deploy --- .../Deploy/IDataTypeConfigurationConnector.cs | 34 +++++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + 2 files changed, 35 insertions(+) create mode 100644 src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs new file mode 100644 index 0000000000..f2a08575b5 --- /dev/null +++ b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; + +namespace Umbraco.Core.Deploy +{ + /// + /// Defines methods that can convert a data type configurations to / from an environment-agnostic string. + /// + /// Configurations may contain values such as content identifiers, that would be local + /// to one environment, and need to be converted in order to be deployed. + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This is actual only used by Deploy, but we dont want third parties to have references on deploy, thats why this interface is part of core.")] + public interface IDataTypeConfigurationConnector + { + /// + /// Gets the property editor aliases that the value converter supports by default. + /// + IEnumerable PropertyEditorAliases { get; } + + /// + /// Gets the environment-agnostic data type configurations corresponding to environment-specific configurations. + /// + /// The environment-specific configuration. + /// The dependencies. + /// + IDictionary ConvertToDeploy(IDictionary configuration, ICollection dependencies); + + /// + /// Gets the environment-specific data type configurations corresponding to environment-agnostic configurations. + /// + /// The environment-agnostic configuration. + /// + IDictionary ConvertToLocalEnvironment(IDictionary configuration); + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index e97fd0d8e0..9a52cb8dc5 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -331,6 +331,7 @@ + From d2d852f0f3583f89336a3db4b53ad68d12303d45 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 10:39:51 +0100 Subject: [PATCH 11/76] Handled "Method with optional parameter is hidden by overload" issues --- src/Umbraco.Web/PublishedContentExtensions.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 530c9bd9b4..f1e9e66e70 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -799,7 +799,7 @@ namespace Umbraco.Web return content.DescendantsOrSelf(false, p => p.Level >= level, culture); } - public static IEnumerable Descendants(this IPublishedContent content, string contentTypeAlias, string culture = null) + public static IEnumerable Descendants(this IPublishedContent content, string contentTypeAlias, string culture) { return content.DescendantsOrSelf(false, p => p.ContentType.Alias == contentTypeAlias, culture); } @@ -826,7 +826,7 @@ namespace Umbraco.Web return content.DescendantsOrSelf(true, p => p.Level >= level, culture); } - public static IEnumerable DescendantsOrSelf(this IPublishedContent content, string contentTypeAlias, string culture = null) + public static IEnumerable DescendantsOrSelf(this IPublishedContent content, string contentTypeAlias, string culture) { return content.DescendantsOrSelf(true, p => p.ContentType.Alias == contentTypeAlias, culture); } @@ -853,7 +853,7 @@ namespace Umbraco.Web return content.EnumerateDescendants(false, culture).FirstOrDefault(x => x.Level == level); } - public static IPublishedContent Descendant(this IPublishedContent content, string contentTypeAlias, string culture = null) + public static IPublishedContent Descendant(this IPublishedContent content, string contentTypeAlias, string culture) { return content.EnumerateDescendants(false, culture).FirstOrDefault(x => x.ContentType.Alias == contentTypeAlias); } @@ -880,7 +880,7 @@ namespace Umbraco.Web return content.EnumerateDescendants(true, culture).FirstOrDefault(x => x.Level == level); } - public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string contentTypeAlias, string culture = null) + public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string contentTypeAlias, string culture) { return content.EnumerateDescendants(true, culture).FirstOrDefault(x => x.ContentType.Alias == contentTypeAlias); } @@ -1017,7 +1017,7 @@ namespace Umbraco.Web /// /// Gets the first child of the content, of a given content type. /// - public static IPublishedContent FirstChild(this IPublishedContent content, string alias, string culture = null) // fixme/task oops + public static IPublishedContent FirstChild(this IPublishedContent content, string alias, string culture) { return content.Children(culture,alias).FirstOrDefault(); } From ca76a5424a0c88c1ed997925e5d3105e772b5ecc Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 23 Jan 2019 12:34:41 +0100 Subject: [PATCH 12/76] Only allow local KeepAlive Pings requests --- .../Editors/KeepAliveController.cs | 7 ++----- .../Mvc/OnlyLocalRequestsAttribute.cs | 20 +++++++++++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 1 + 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 src/Umbraco.Web/Mvc/OnlyLocalRequestsAttribute.cs diff --git a/src/Umbraco.Web/Editors/KeepAliveController.cs b/src/Umbraco.Web/Editors/KeepAliveController.cs index fa33abea44..b15621ee23 100644 --- a/src/Umbraco.Web/Editors/KeepAliveController.cs +++ b/src/Umbraco.Web/Editors/KeepAliveController.cs @@ -1,16 +1,13 @@ using System.Runtime.Serialization; using System.Web.Http; +using Umbraco.Web.Mvc; using Umbraco.Web.WebApi; namespace Umbraco.Web.Editors { - // fixme/task - deal with this - // this is not authenticated, and therefore public, and therefore reveals we - // are running Umbraco - but, all requests should come from localhost really, - // so there should be a way to 404 when the request comes from the outside. - public class KeepAliveController : UmbracoApiController { + [OnlyLocalRequests] [HttpGet] public KeepAlivePingResult Ping() { diff --git a/src/Umbraco.Web/Mvc/OnlyLocalRequestsAttribute.cs b/src/Umbraco.Web/Mvc/OnlyLocalRequestsAttribute.cs new file mode 100644 index 0000000000..ed36e6e3df --- /dev/null +++ b/src/Umbraco.Web/Mvc/OnlyLocalRequestsAttribute.cs @@ -0,0 +1,20 @@ + +using System.Net; +using System.Net.Http; +using System.Web.Http; +using System.Web.Http.Controllers; +using System.Web.Http.Filters; + +namespace Umbraco.Web.Mvc +{ + public class OnlyLocalRequestsAttribute : ActionFilterAttribute + { + public override void OnActionExecuting(HttpActionContext actionContext) + { + if (!actionContext.Request.IsLocal()) + { + throw new HttpResponseException(HttpStatusCode.NotFound); + } + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 64a60d824a..7211ec8af9 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -172,6 +172,7 @@ + From 69a3c85bbc07ed4697dd484b37433b8fd6940822 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 23 Jan 2019 14:37:33 +0000 Subject: [PATCH 13/76] Refactor of dashboards * Remove dashboards from Configs().Dashboards * Remove dashboard.config XML file & associated code reading from XML * Load Dashboards from TypeLoader into a CollectionBuilder * Load merge/concat C# Dashboard Types with package.manifest * Add buildercolletion to an extension method on Composition --- src/Umbraco.Core/ConfigsExtensions.cs | 5 - .../Configuration/Dashboard/AccessElement.cs | 30 --- .../Configuration/Dashboard/AreaCollection.cs | 32 --- .../Configuration/Dashboard/AreaElement.cs | 12 -- .../Configuration/Dashboard/AreasElement.cs | 15 -- .../Dashboard/ControlCollection.cs | 37 ---- .../Configuration/Dashboard/ControlElement.cs | 44 ---- .../Dashboard/DashboardSection.cs | 24 --- .../Configuration/Dashboard/IAccess.cs | 9 - .../Configuration/Dashboard/IArea.cs | 7 - .../Dashboard/IDashboardControl.cs | 11 - .../Dashboard/IDashboardSection.cs | 9 - .../Configuration/Dashboard/IDashboardTab.cs | 13 -- .../Configuration/Dashboard/ISection.cs | 15 -- .../Dashboard/SectionCollection.cs | 37 ---- .../Configuration/Dashboard/SectionElement.cs | 50 ----- .../Configuration/Dashboard/TabCollection.cs | 37 ---- .../Configuration/Dashboard/TabElement.cs | 38 ---- .../Dashboard => Dashboards}/AccessRule.cs | 2 +- .../AccessRuleType.cs | 2 +- .../Dashboard => Dashboards}/IAccessRule.cs | 2 +- .../Dashboards/IDashboardSection.cs | 30 +++ .../Manifest/DashboardAccessRuleConverter.cs | 2 +- .../Manifest/ManifestDashboardDefinition.cs | 5 +- src/Umbraco.Core/Umbraco.Core.csproj | 24 +-- .../DashboardSettingsTests.cs | 189 +++++++++--------- .../Manifest/ManifestParserTests.cs | 2 +- src/Umbraco.Web.UI.Client/package-lock.json | 96 ++++----- .../src/views/common/dashboard.html | 13 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 + src/Umbraco.Web.UI/config/Dashboard.config | 1 + src/Umbraco.Web/CompositionExtensions.cs | 8 + .../Dashboards/ContentDashboard.cs | 38 ++++ .../Dashboards/DashboardCollection.cs | 13 ++ .../Dashboards/DashboardCollectionBuilder.cs | 24 +++ .../Dashboards/ExamineDashboard.cs | 29 +++ src/Umbraco.Web/Dashboards/FormsDashboard.cs | 27 +++ .../Dashboards/HealthCheckDashboard.cs | 29 +++ src/Umbraco.Web/Dashboards/MediaDashboard.cs | 27 +++ .../Dashboards/MembersDashboard.cs | 27 +++ .../Dashboards/ModelsBuilderDashboard.cs | 29 +++ .../Dashboards/PublishedStatusDashboard.cs | 29 +++ .../Dashboards/RedirectUrlDashboard.cs | 27 +++ .../Dashboards/SettingsDashboards.cs | 27 +++ .../Editors/DashboardController.cs | 16 +- src/Umbraco.Web/Editors/Dashboards.cs | 160 --------------- .../Editors/EditorModelEventManager.cs | 9 +- src/Umbraco.Web/Editors/SectionController.cs | 8 +- .../Models/ContentEditing/DashboardControl.cs | 19 -- src/Umbraco.Web/Runtime/WebRuntimeComposer.cs | 28 ++- .../DashboardService.cs} | 109 ++++++---- src/Umbraco.Web/Services/IDashboardService.cs | 27 +++ src/Umbraco.Web/Umbraco.Web.csproj | 17 +- 53 files changed, 678 insertions(+), 844 deletions(-) delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/AreaCollection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/AreaElement.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/IAccess.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/IArea.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/ISection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs delete mode 100644 src/Umbraco.Core/Configuration/Dashboard/TabElement.cs rename src/Umbraco.Core/{Configuration/Dashboard => Dashboards}/AccessRule.cs (85%) rename src/Umbraco.Core/{Configuration/Dashboard => Dashboards}/AccessRuleType.cs (93%) rename src/Umbraco.Core/{Configuration/Dashboard => Dashboards}/IAccessRule.cs (88%) create mode 100644 src/Umbraco.Core/Dashboards/IDashboardSection.cs create mode 100644 src/Umbraco.Web/Dashboards/ContentDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/DashboardCollection.cs create mode 100644 src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs create mode 100644 src/Umbraco.Web/Dashboards/ExamineDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/FormsDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/MediaDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/MembersDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs create mode 100644 src/Umbraco.Web/Dashboards/SettingsDashboards.cs delete mode 100644 src/Umbraco.Web/Editors/Dashboards.cs delete mode 100644 src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs rename src/Umbraco.Web/{Editors/DashboardSecurity.cs => Services/DashboardService.cs} (62%) create mode 100644 src/Umbraco.Web/Services/IDashboardService.cs diff --git a/src/Umbraco.Core/ConfigsExtensions.cs b/src/Umbraco.Core/ConfigsExtensions.cs index 0fcea5f430..6fdf7ea3b9 100644 --- a/src/Umbraco.Core/ConfigsExtensions.cs +++ b/src/Umbraco.Core/ConfigsExtensions.cs @@ -2,7 +2,6 @@ using Umbraco.Core.Cache; using Umbraco.Core.Composing; using Umbraco.Core.Configuration; -using Umbraco.Core.Configuration.Dashboard; using Umbraco.Core.Configuration.Grid; using Umbraco.Core.Configuration.HealthChecks; using Umbraco.Core.Configuration.UmbracoSettings; @@ -22,9 +21,6 @@ namespace Umbraco.Core public static IUmbracoSettingsSection Settings(this Configs configs) => configs.GetConfig(); - public static IDashboardSection Dashboards(this Configs configs) - => configs.GetConfig(); - public static IHealthChecks HealthChecks(this Configs configs) => configs.GetConfig(); @@ -40,7 +36,6 @@ namespace Umbraco.Core configs.Add(() => new GlobalSettings()); configs.Add("umbracoConfiguration/settings"); - configs.Add("umbracoConfiguration/dashBoard"); configs.Add("umbracoConfiguration/HealthChecks"); configs.Add(() => new CoreDebug()); diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs b/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs deleted file mode 100644 index 01538c8e0b..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Xml.Linq; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class AccessElement : RawXmlConfigurationElement, IAccess - { - public AccessElement() - { } - - public AccessElement(XElement rawXml) - : base(rawXml) - { } - - public IEnumerable Rules - { - get - { - var result = new List(); - if (RawXml == null) return result; - - result.AddRange(RawXml.Elements("deny").Select(x => new AccessRule {Type = AccessRuleType.Deny, Value = x.Value })); - result.AddRange(RawXml.Elements("grant").Select(x => new AccessRule { Type = AccessRuleType.Grant, Value = x.Value })); - result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessRule { Type = AccessRuleType.GrantBySection, Value = x.Value })); - return result; - } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/AreaCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/AreaCollection.cs deleted file mode 100644 index 31cc3eaec8..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/AreaCollection.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class AreaCollection : ConfigurationElementCollection, IEnumerable - { - protected override ConfigurationElement CreateNewElement() - { - return new AreaElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return ((AreaElement) element).Value; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (var i = 0; i < Count; i++) - { - yield return BaseGet(i) as IArea; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/AreaElement.cs b/src/Umbraco.Core/Configuration/Dashboard/AreaElement.cs deleted file mode 100644 index 20393f89d8..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/AreaElement.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class AreaElement : InnerTextConfigurationElement, IArea - { - string IArea.AreaName - { - get { return Value; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs b/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs deleted file mode 100644 index 92e51c9b73..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class AreasElement : ConfigurationElement - { - [ConfigurationCollection(typeof(SectionCollection), AddItemName = "area")] - [ConfigurationProperty("", IsDefaultCollection = true)] - public AreaCollection AreaCollection - { - get { return (AreaCollection)base[""]; } - set { base[""] = value; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs deleted file mode 100644 index b8aa40da7f..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class ControlCollection : ConfigurationElementCollection, IEnumerable - { - internal void Add(ControlElement c) - { - BaseAdd(c); - } - - protected override ConfigurationElement CreateNewElement() - { - return new ControlElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return ((ControlElement)element).ControlPath; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (var i = 0; i < Count; i++) - { - yield return BaseGet(i) as IDashboardControl; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs b/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs deleted file mode 100644 index 20dac7460e..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System.Configuration; -using System.Linq; -using System.Xml.Linq; - -namespace Umbraco.Core.Configuration.Dashboard -{ - - internal class ControlElement : RawXmlConfigurationElement, IDashboardControl - { - public string PanelCaption - { - get - { - var panelCaption = RawXml.Attribute("panelCaption"); - return panelCaption == null ? "" : panelCaption.Value; - } - } - - public AccessElement Access - { - get - { - var access = RawXml.Element("access"); - return access == null ? new AccessElement() : new AccessElement(access); - } - } - - public string ControlPath - { - get - { - //we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P ) - var txt = RawXml.Nodes().OfType().FirstOrDefault(); - if (txt == null) - { - throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path"); - } - return txt.Value.Trim(); - } - } - - IAccess IDashboardControl.AccessRights => Access; - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs b/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs deleted file mode 100644 index 12bf0522e0..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Text; -using System.Threading.Tasks; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class DashboardSection : ConfigurationSection, IDashboardSection - { - [ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")] - [ConfigurationProperty("", IsDefaultCollection = true)] - public SectionCollection SectionCollection - { - get { return (SectionCollection)base[""]; } - set { base[""] = value; } - } - - IEnumerable IDashboardSection.Sections - { - get { return SectionCollection; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs b/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs deleted file mode 100644 index 8ac1b18cca..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; - -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface IAccess - { - IEnumerable Rules { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IArea.cs b/src/Umbraco.Core/Configuration/Dashboard/IArea.cs deleted file mode 100644 index 25401db408..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/IArea.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface IArea - { - string AreaName { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs deleted file mode 100644 index cdf05af1ec..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface IDashboardControl - { - string PanelCaption { get; } - - string ControlPath { get; } - - IAccess AccessRights { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs deleted file mode 100644 index 32dfc6653d..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections.Generic; - -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface IDashboardSection - { - IEnumerable Sections { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs deleted file mode 100644 index 914b226265..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Collections.Generic; - -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface IDashboardTab - { - string Caption { get; } - - IEnumerable Controls { get; } - - IAccess AccessRights { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/ISection.cs b/src/Umbraco.Core/Configuration/Dashboard/ISection.cs deleted file mode 100644 index 1005c0750d..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/ISection.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Collections.Generic; - -namespace Umbraco.Core.Configuration.Dashboard -{ - public interface ISection - { - string Alias { get; } - - IEnumerable Areas { get; } - - IEnumerable Tabs { get; } - - IAccess AccessRights { get; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs deleted file mode 100644 index 5717bd28c3..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class SectionCollection : ConfigurationElementCollection, IEnumerable - { - internal void Add(SectionElement c) - { - BaseAdd(c); - } - - protected override ConfigurationElement CreateNewElement() - { - return new SectionElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return ((SectionElement)element).Alias; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (var i = 0; i < Count; i++) - { - yield return BaseGet(i) as ISection; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs b/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs deleted file mode 100644 index 09049c13db..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Collections.Generic; -using System.Configuration; -using System.Linq; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class SectionElement : ConfigurationElement, ISection - { - [ConfigurationProperty("alias", IsRequired = true)] - public string Alias - { - get { return (string) this["alias"]; } - } - - [ConfigurationProperty("areas", IsRequired = true)] - public AreasElement Areas - { - get { return (AreasElement)this["areas"]; } - } - - [ConfigurationProperty("access")] - public AccessElement Access - { - get { return (AccessElement)this["access"]; } - } - - [ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")] - [ConfigurationProperty("", IsDefaultCollection = true)] - public TabCollection TabCollection - { - get { return (TabCollection)base[""]; } - set { base[""] = value; } - } - - IEnumerable ISection.Tabs - { - get { return TabCollection; } - } - - IEnumerable ISection.Areas - { - get { return Areas.AreaCollection.Cast().Select(x => x.Value); } - } - - IAccess ISection.AccessRights - { - get { return Access; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs deleted file mode 100644 index 1b77ffd3fb..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class TabCollection : ConfigurationElementCollection, IEnumerable - { - internal void Add(TabElement c) - { - BaseAdd(c); - } - - protected override ConfigurationElement CreateNewElement() - { - return new TabElement(); - } - - protected override object GetElementKey(ConfigurationElement element) - { - return ((TabElement)element).Caption; - } - - IEnumerator IEnumerable.GetEnumerator() - { - for (var i = 0; i < Count; i++) - { - yield return BaseGet(i) as IDashboardTab; - } - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs b/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs deleted file mode 100644 index b92394596e..0000000000 --- a/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using System.Configuration; - -namespace Umbraco.Core.Configuration.Dashboard -{ - internal class TabElement : ConfigurationElement, IDashboardTab - { - [ConfigurationProperty("caption", IsRequired = true)] - public string Caption - { - get { return (string)this["caption"]; } - } - - [ConfigurationProperty("access")] - public AccessElement Access - { - get { return (AccessElement)this["access"]; } - } - - [ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")] - [ConfigurationProperty("", IsDefaultCollection = true)] - public ControlCollection ControlCollection - { - get { return (ControlCollection)base[""]; } - set { base[""] = value; } - } - - IEnumerable IDashboardTab.Controls - { - get { return ControlCollection; } - } - - IAccess IDashboardTab.AccessRights - { - get { return Access; } - } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessRule.cs b/src/Umbraco.Core/Dashboards/AccessRule.cs similarity index 85% rename from src/Umbraco.Core/Configuration/Dashboard/AccessRule.cs rename to src/Umbraco.Core/Dashboards/AccessRule.cs index fe6840ff64..70f9da8fa9 100644 --- a/src/Umbraco.Core/Configuration/Dashboard/AccessRule.cs +++ b/src/Umbraco.Core/Dashboards/AccessRule.cs @@ -1,4 +1,4 @@ -namespace Umbraco.Core.Configuration.Dashboard +namespace Umbraco.Core.Dashboards { /// /// Implements . diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessRuleType.cs b/src/Umbraco.Core/Dashboards/AccessRuleType.cs similarity index 93% rename from src/Umbraco.Core/Configuration/Dashboard/AccessRuleType.cs rename to src/Umbraco.Core/Dashboards/AccessRuleType.cs index cb9ce983fe..efed361f6c 100644 --- a/src/Umbraco.Core/Configuration/Dashboard/AccessRuleType.cs +++ b/src/Umbraco.Core/Dashboards/AccessRuleType.cs @@ -1,4 +1,4 @@ -namespace Umbraco.Core.Configuration.Dashboard +namespace Umbraco.Core.Dashboards { /// /// Defines dashboard access rules type. diff --git a/src/Umbraco.Core/Configuration/Dashboard/IAccessRule.cs b/src/Umbraco.Core/Dashboards/IAccessRule.cs similarity index 88% rename from src/Umbraco.Core/Configuration/Dashboard/IAccessRule.cs rename to src/Umbraco.Core/Dashboards/IAccessRule.cs index 8b51b1b73a..f44a846248 100644 --- a/src/Umbraco.Core/Configuration/Dashboard/IAccessRule.cs +++ b/src/Umbraco.Core/Dashboards/IAccessRule.cs @@ -1,4 +1,4 @@ -namespace Umbraco.Core.Configuration.Dashboard +namespace Umbraco.Core.Dashboards { /// /// Represents an access rule. diff --git a/src/Umbraco.Core/Dashboards/IDashboardSection.cs b/src/Umbraco.Core/Dashboards/IDashboardSection.cs new file mode 100644 index 0000000000..90d351bcd2 --- /dev/null +++ b/src/Umbraco.Core/Dashboards/IDashboardSection.cs @@ -0,0 +1,30 @@ +namespace Umbraco.Core.Dashboards +{ + public interface IDashboardSection + { + /// + /// Display name of the dashboard tab + /// + string Name { get; } + + /// + /// Alias to refer to this dashboard via code + /// + string Alias { get; } + + /// + /// A collection of sections/application aliases that this dashboard will appear on + /// + string[] Sections { get; } + + /// + /// The HTML view to load for the dashboard + /// + string View { get; } + + /// + /// Dashboards can be shown/hidden based on access rights + /// + IAccessRule[] AccessRules { get; } + } +} diff --git a/src/Umbraco.Core/Manifest/DashboardAccessRuleConverter.cs b/src/Umbraco.Core/Manifest/DashboardAccessRuleConverter.cs index c627728a32..67c5a5824e 100644 --- a/src/Umbraco.Core/Manifest/DashboardAccessRuleConverter.cs +++ b/src/Umbraco.Core/Manifest/DashboardAccessRuleConverter.cs @@ -1,7 +1,7 @@ using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Umbraco.Core.Configuration.Dashboard; +using Umbraco.Core.Dashboards; using Umbraco.Core.Serialization; namespace Umbraco.Core.Manifest diff --git a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs b/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs index 83f047b264..b2b3fd5dfb 100644 --- a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs +++ b/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs @@ -1,12 +1,12 @@ using System; using System.ComponentModel; using Newtonsoft.Json; -using Umbraco.Core.Configuration.Dashboard; +using Umbraco.Core.Dashboards; using Umbraco.Core.IO; namespace Umbraco.Core.Manifest { - public class ManifestDashboardDefinition + public class ManifestDashboardDefinition : IDashboardSection { private string _view; @@ -32,5 +32,6 @@ namespace Umbraco.Core.Manifest [JsonProperty("access")] public IAccessRule[] AccessRules { get; set; } = Array.Empty(); + } } diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 0ff88da2f3..993797392f 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -211,26 +211,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -331,6 +311,10 @@ + + + + diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs b/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs index 920de683b4..219e6092d2 100644 --- a/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs +++ b/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs @@ -1,123 +1,124 @@ -using System.Configuration; +using System; +using System.Configuration; using System.IO; using System.Linq; using NUnit.Framework; -using Umbraco.Core.Configuration.Dashboard; -using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Core.Dashboards; using Umbraco.Tests.TestHelpers; namespace Umbraco.Tests.Configurations.DashboardSettings { - [TestFixture] - public class DashboardSettingsTests - { - [SetUp] - public void Init() - { - var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/DashboardSettings/web.config")); + //[Obsolete("Dashboard tests not in config/XML", true)] + //[TestFixture] + //public class DashboardSettingsTests + //{ + // [SetUp] + // public void Init() + // { + // var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/DashboardSettings/web.config")); - var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; - var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); + // var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; + // var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); - SettingsSection = configuration.GetSection("umbracoConfiguration/dashBoard") as DashboardSection; + // SettingsSection = configuration.GetSection("umbracoConfiguration/dashBoard") as DashboardSection; - Assert.IsNotNull(SettingsSection); - } + // Assert.IsNotNull(SettingsSection); + // } - protected IDashboardSection SettingsSection { get; private set; } + // protected IDashboardSection SettingsSection { get; private set; } - [Test] - public void Test_Sections() - { - Assert.AreEqual(5, SettingsSection.Sections.Count()); + // [Test] + // public void Test_Sections() + // { + // Assert.AreEqual(5, SettingsSection.Sections.Count()); - Assert.AreEqual("StartupSettingsDashboardSection", SettingsSection.Sections.ElementAt(0).Alias); - Assert.AreEqual("StartupDeveloperDashboardSection", SettingsSection.Sections.ElementAt(1).Alias); - Assert.AreEqual("StartupMediaDashboardSection", SettingsSection.Sections.ElementAt(2).Alias); - Assert.AreEqual("StartupDashboardSection", SettingsSection.Sections.ElementAt(3).Alias); - Assert.AreEqual("StartupMemberDashboardSection", SettingsSection.Sections.ElementAt(4).Alias); - } + // Assert.AreEqual("StartupSettingsDashboardSection", SettingsSection.Sections.ElementAt(0).Alias); + // Assert.AreEqual("StartupDeveloperDashboardSection", SettingsSection.Sections.ElementAt(1).Alias); + // Assert.AreEqual("StartupMediaDashboardSection", SettingsSection.Sections.ElementAt(2).Alias); + // Assert.AreEqual("StartupDashboardSection", SettingsSection.Sections.ElementAt(3).Alias); + // Assert.AreEqual("StartupMemberDashboardSection", SettingsSection.Sections.ElementAt(4).Alias); + // } - [Test] - public void Test_Section_Area() - { - Assert.AreEqual("settings", SettingsSection.Sections.ElementAt(0).Areas.First()); - Assert.AreEqual("developer", SettingsSection.Sections.ElementAt(1).Areas.First()); - Assert.AreEqual("media", SettingsSection.Sections.ElementAt(2).Areas.First()); - Assert.AreEqual("content", SettingsSection.Sections.ElementAt(3).Areas.First()); - Assert.AreEqual("default", SettingsSection.Sections.ElementAt(4).Areas.First()); - Assert.AreEqual("member", SettingsSection.Sections.ElementAt(4).Areas.Last()); - } + // [Test] + // public void Test_Section_Area() + // { + // Assert.AreEqual("settings", SettingsSection.Sections.ElementAt(0).Areas.First()); + // Assert.AreEqual("developer", SettingsSection.Sections.ElementAt(1).Areas.First()); + // Assert.AreEqual("media", SettingsSection.Sections.ElementAt(2).Areas.First()); + // Assert.AreEqual("content", SettingsSection.Sections.ElementAt(3).Areas.First()); + // Assert.AreEqual("default", SettingsSection.Sections.ElementAt(4).Areas.First()); + // Assert.AreEqual("member", SettingsSection.Sections.ElementAt(4).Areas.Last()); + // } - [Test] - public void Test_Section_Access() - { + // [Test] + // public void Test_Section_Access() + // { - Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.Count()); + // Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.Count()); - Assert.AreEqual("translator", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Value); - Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Type); - Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Value); - Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Type); - Assert.AreEqual("world", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Value); - Assert.AreEqual(AccessRuleType.GrantBySection, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Type); - } + // Assert.AreEqual("translator", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Value); + // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Type); + // Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Value); + // Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Type); + // Assert.AreEqual("world", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Value); + // Assert.AreEqual(AccessRuleType.GrantBySection, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Type); + // } - [Test] - public void Test_Section_Tabs() - { - //Element 0 Alias "StartupSettingsDashboardSection" - Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.Count()); + // [Test] + // public void Test_Section_Tabs() + // { + // //Element 0 Alias "StartupSettingsDashboardSection" + // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.Count()); - //Element 1 Alias "StartupDeveloperDashboardSection" - Assert.AreEqual(1, SettingsSection.Sections.ElementAt(1).Tabs.Count()); + // //Element 1 Alias "StartupDeveloperDashboardSection" + // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(1).Tabs.Count()); - //Element 2 Alias "StartupMediaDashboardSection" - Assert.AreEqual(2, SettingsSection.Sections.ElementAt(2).Tabs.Count()); + // //Element 2 Alias "StartupMediaDashboardSection" + // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(2).Tabs.Count()); - //Element 3 Alias "StartupDashboardSection" - Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).Tabs.Count()); + // //Element 3 Alias "StartupDashboardSection" + // Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).Tabs.Count()); - //Element 4 Alias "StartupMemberDashboardSection" - Assert.AreEqual(1, SettingsSection.Sections.ElementAt(4).Tabs.Count()); + // //Element 4 Alias "StartupMemberDashboardSection" + // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(4).Tabs.Count()); - } + // } - [Test] - public void Test_Tab() - { - Assert.AreEqual("Get Started", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Caption); - Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.Count()); - } + // [Test] + // public void Test_Tab() + // { + // Assert.AreEqual("Get Started", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Caption); + // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.Count()); + // } - [Test] - public void Test_Tab_Access() - { - Assert.AreEqual(1, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.Count()); - Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); - Assert.AreEqual("admin", SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); - } + // [Test] + // public void Test_Tab_Access() + // { + // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.Count()); + // Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); + // Assert.AreEqual("admin", SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); + // } - [Test] - public void Test_Control() - { - Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).PanelCaption); - Assert.AreEqual("views/dashboard/settings/settingsdashboardintro.html", - SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).ControlPath); + // [Test] + // public void Test_Control() + // { + // Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).PanelCaption); + // Assert.AreEqual("views/dashboard/settings/settingsdashboardintro.html", + // SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).ControlPath); - Assert.AreEqual("", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).PanelCaption); - Assert.AreEqual("views/dashboard/settings/settingsdashboardvideos.html", - SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).ControlPath); - } + // Assert.AreEqual("", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).PanelCaption); + // Assert.AreEqual("views/dashboard/settings/settingsdashboardvideos.html", + // SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).ControlPath); + // } - [Test] - public void Test_Control_Access() - { - Assert.AreEqual(2, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.Count()); - Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); - Assert.AreEqual("editor", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); - Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Type); - Assert.AreEqual("writer", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Value); - } - } + // [Test] + // public void Test_Control_Access() + // { + // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.Count()); + // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); + // Assert.AreEqual("editor", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); + // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Type); + // Assert.AreEqual("writer", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Value); + // } + //} } diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index 4e791c0169..a12f90c4eb 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -7,12 +7,12 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Core.Cache; using Umbraco.Core.Composing; -using Umbraco.Core.Configuration.Dashboard; using Umbraco.Core.Logging; using Umbraco.Core.Manifest; using Umbraco.Core.PropertyEditors; using Umbraco.Core.PropertyEditors.Validators; using Umbraco.Core.Services; +using Umbraco.Core.Dashboards; namespace Umbraco.Tests.Manifest { diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index ed28a93caf..fe657ae470 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -937,7 +937,7 @@ }, "ansi-colors": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { @@ -955,7 +955,7 @@ }, "ansi-escapes": { "version": "3.1.0", - "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, @@ -1170,7 +1170,7 @@ "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha1-42jqFfibxwaff/uJrsOmx9SsItQ=", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "dev": true }, "array-sort": { @@ -1216,7 +1216,7 @@ "arraybuffer.slice": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", - "integrity": "sha1-O7xCdd1YTMGxCAm4nU6LY6aednU=", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", "dev": true }, "asap": { @@ -1269,7 +1269,7 @@ "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha1-ePrtjD0HSrgfIrTphdeehzj3IPg=", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "dev": true }, "asynckit": { @@ -2379,7 +2379,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2459,7 +2459,7 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, "continuable-cache": { @@ -2502,7 +2502,7 @@ "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha1-+XJgj/DOrWi4QaFqky0LGDeRgU4=", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "core-util-is": { @@ -3425,7 +3425,7 @@ "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha1-XNAfwQFiG0LEzX9dGmYkNxbT850=", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { "esutils": "^2.0.2" @@ -3953,7 +3953,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -3989,7 +3989,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -4153,7 +4153,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "optional": true } @@ -4248,7 +4248,7 @@ "eslint-scope": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha1-UL8wcekzi83EMzF5Sgy1M/ATYXI=", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -4258,13 +4258,13 @@ "eslint-utils": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", - "integrity": "sha1-moUbqJ7nxGA0b5fPiTnHKYgn5RI=", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", "dev": true }, "eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha1-PzGA+y4pEBdxastMnW1bXDSmqB0=", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", "dev": true }, "espree": { @@ -4287,7 +4287,7 @@ "esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha1-QGxRZYsfWZGl+bYrHcJbAOPlxwg=", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", "dev": true, "requires": { "estraverse": "^4.0.0" @@ -4296,7 +4296,7 @@ "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha1-AHo7n9vCs7uH5IeeoZyS/b05Qs8=", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { "estraverse": "^4.1.0" @@ -4356,7 +4356,7 @@ "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha1-CQtNbNvWRe0Qv3UNS1QHlC17oWM=", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", "dev": true }, "exec-buffer": { @@ -4571,7 +4571,7 @@ "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "integrity": "sha1-6x53OrsFbc2N8r/favWbizqTZWU=", "dev": true, "requires": { "is-number": "^2.1.0", @@ -5891,7 +5891,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -6461,7 +6461,7 @@ "gulp-eslint": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/gulp-eslint/-/gulp-eslint-5.0.0.tgz", - "integrity": "sha1-KiaECV93Syz3kxAmIHjFbMehK1I=", + "integrity": "sha512-9GUqCqh85C7rP9120cpxXuZz2ayq3BZc85pCTuPJS03VQYxne0aWPIXWx6LSvsGPa3uRqtSO537vaugOh+5cXg==", "dev": true, "requires": { "eslint": "^5.0.1", @@ -7415,7 +7415,7 @@ "has-binary2": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", - "integrity": "sha1-d3asYn8+p3JQz8My2rfd9eT10R0=", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", "dev": true, "requires": { "isarray": "2.0.1" @@ -7566,7 +7566,7 @@ "http-proxy": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha1-etOElGWPhGBeL220Q230EPTlvpo=", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", "dev": true, "requires": { "eventemitter3": "^3.0.0", @@ -7860,7 +7860,7 @@ "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { "is-relative": "^1.0.0", @@ -8155,7 +8155,7 @@ "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { "is-unc-path": "^1.0.0" @@ -8164,7 +8164,7 @@ "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha1-+xj4fOH+uSUWnJpAfBkxijIG7Yg=", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, "is-retry-allowed": { @@ -8212,7 +8212,7 @@ "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { "unc-path-regex": "^0.1.2" @@ -8369,7 +8369,7 @@ "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "json-stable-stringify-without-jsonify": { @@ -8496,7 +8496,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } } @@ -9146,7 +9146,7 @@ "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", - "integrity": "sha1-KbM/MSqo9UfEpeSQ9Wr87JkTOtY=", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { "kind-of": "^6.0.2" @@ -9327,7 +9327,7 @@ "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha1-ggyGo5M0ZA6ZUWkovQP8qIBX0CI=", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, "minimatch": { @@ -12855,7 +12855,7 @@ "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha1-KYuJ34uTsCIdv0Ia0rGx6iP8Z3c=", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, "posix-character-classes": { @@ -13345,7 +13345,7 @@ "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", - "integrity": "sha1-xF6cYYAL0IfviNfiVkI73Unl0HE=", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", "dev": true }, "qs": { @@ -13541,7 +13541,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -14039,7 +14039,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, "sax": { @@ -14226,7 +14226,7 @@ "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY=", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", "dev": true }, "shebang-command": { @@ -14516,7 +14516,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -14796,7 +14796,7 @@ "stream-consume": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", - "integrity": "sha1-0721mMK9CugrjKx6xQsRB6eZbEg=", + "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", "dev": true }, "stream-shift": { @@ -14808,7 +14808,7 @@ "streamroller": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz", - "integrity": "sha1-odG3z4PTmvsNYwSaWsv5NJO99ks=", + "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", "dev": true, "requires": { "date-format": "^1.2.0", @@ -14835,7 +14835,7 @@ "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha1-sRwn2IuP8fvgcGQ8+UsMea4bCq8=", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", @@ -14850,7 +14850,7 @@ "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { "safe-buffer": "~5.1.0" @@ -14867,7 +14867,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -15409,7 +15409,7 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { "os-tmpdir": "~1.0.2" @@ -15573,7 +15573,7 @@ "type-is": { "version": "1.6.16", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha1-+JzjQVQcZysl7nrjxz3uOyvlAZQ=", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "dev": true, "requires": { "media-typer": "0.3.0", @@ -15615,7 +15615,7 @@ "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha1-n+FTahCmZKZSZqHjzPhf02MCvJw=", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", "dev": true }, "unc-path-regex": { @@ -15777,13 +15777,13 @@ "upath": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha1-NSVll+RqWB20eT0M5H+prr/J+r0=", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha1-lMVA4f93KVbiKZUHwBCupsiDjrA=", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, "requires": { "punycode": "^2.1.0" @@ -16218,7 +16218,7 @@ "ws": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha1-8c+E/i1ekB686U767OeF8YeiKPI=", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "dev": true, "requires": { "async-limiter": "~1.0.0", diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dashboard.html b/src/Umbraco.Web.UI.Client/src/views/common/dashboard.html index 6453963670..c3b60e2f0a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dashboard.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dashboard.html @@ -17,16 +17,15 @@
- +
- +
-

{{property.caption}}

-
+
- +
- +
@@ -34,5 +33,5 @@ - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 0ff158dadb..c7b6540b3d 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -178,6 +178,7 @@ + @@ -205,6 +206,7 @@ + 404handlers.config diff --git a/src/Umbraco.Web.UI/config/Dashboard.config b/src/Umbraco.Web.UI/config/Dashboard.config index fec6ab34ae..94325913df 100644 --- a/src/Umbraco.Web.UI/config/Dashboard.config +++ b/src/Umbraco.Web.UI/config/Dashboard.config @@ -94,6 +94,7 @@ +
content diff --git a/src/Umbraco.Web/CompositionExtensions.cs b/src/Umbraco.Web/CompositionExtensions.cs index 246127b312..783c991ab4 100644 --- a/src/Umbraco.Web/CompositionExtensions.cs +++ b/src/Umbraco.Web/CompositionExtensions.cs @@ -10,6 +10,7 @@ using Umbraco.Web.Routing; using Umbraco.Web.ContentApps; using Umbraco.Web.Tour; using Umbraco.Web.Trees; +using Umbraco.Web.Dashboards; // the namespace here is intentional - although defined in Umbraco.Web assembly, // this class should be visible when using Umbraco.Core.Components, alongside @@ -92,6 +93,13 @@ namespace Umbraco.Core.Components public static BackOfficeSectionCollectionBuilder Sections(this Composition composition) => composition.WithCollectionBuilder(); + /// + /// Gets the backoffice dashboards collection builder. + /// + /// The composition. + public static DashboardCollectionBuilder Dashboards(this Composition composition) + => composition.WithCollectionBuilder(); + #endregion #region Uniques diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs new file mode 100644 index 0000000000..c184e593aa --- /dev/null +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(10)] + //[HideFromTypeFinder] + [DataContract] + public class ContentDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Get Started"; + + [DataMember(Name = "alias")] + public string Alias => "contentIntro"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "content" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/default/startupdashboardintro.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules + { + get + { + //TODO: WB Not convinced these rules work correctly?! + var rules = new List(); + rules.Add(new AccessRule { Type = AccessRuleType.Deny, Value = "translator" }); + rules.Add(new AccessRule { Type = AccessRuleType.Grant, Value = "admin" }); + return rules.ToArray(); + } + } + } +} diff --git a/src/Umbraco.Web/Dashboards/DashboardCollection.cs b/src/Umbraco.Web/Dashboards/DashboardCollection.cs new file mode 100644 index 0000000000..8d3bde622e --- /dev/null +++ b/src/Umbraco.Web/Dashboards/DashboardCollection.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + public class DashboardCollection : BuilderCollectionBase + { + public DashboardCollection(IEnumerable items) + : base(items) + { } + } +} diff --git a/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs new file mode 100644 index 0000000000..d4a89a61b2 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Linq; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; +using Umbraco.Core.Manifest; + +namespace Umbraco.Web.Dashboards +{ + public class DashboardCollectionBuilder : WeightedCollectionBuilderBase + { + protected override DashboardCollectionBuilder This => this; + + protected override IEnumerable CreateItems(IFactory factory) + { + // get the manifest parser just-in-time - injecting it in the ctor would mean that + // simply getting the builder in order to configure the collection, would require + // its dependencies too, and that can create cycles or other oddities + var manifestParser = factory.GetInstance(); + + //TODO WB: We will need to re-sort items from package manifest with the C# Types + return base.CreateItems(factory).Concat(manifestParser.Manifest.Dashboards); + } + } +} diff --git a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs new file mode 100644 index 0000000000..5f04a4b78d --- /dev/null +++ b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs @@ -0,0 +1,29 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(20)] + [DataContract] + public class ExamineDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Examine Management"; + + [DataMember(Name = "alias")] + public string Alias => "settingsExamine"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "settings" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/settings/examinemanagement.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } + + +} diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs new file mode 100644 index 0000000000..c9e8e06b7d --- /dev/null +++ b/src/Umbraco.Web/Dashboards/FormsDashboard.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(10)] + [DataContract] + public class FormsDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Install Umbraco Forms"; + + [DataMember(Name = "alias")] + public string Alias => "formsInstall"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "forms" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/forms/formsdashboardintro.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } +} diff --git a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs new file mode 100644 index 0000000000..808dc099e8 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs @@ -0,0 +1,29 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(50)] + [DataContract] + public class HealthCheckDashboard : IDashboardSection + { + [DataMember(Name="name")] + public string Name => "Health Check"; + + [DataMember(Name = "alias")] + public string Alias => "settingsHealthCheck"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "settings" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/settings/healthcheck.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } + + +} diff --git a/src/Umbraco.Web/Dashboards/MediaDashboard.cs b/src/Umbraco.Web/Dashboards/MediaDashboard.cs new file mode 100644 index 0000000000..c122ba1f7f --- /dev/null +++ b/src/Umbraco.Web/Dashboards/MediaDashboard.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(10)] + [DataContract] + public class MediaDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Content"; + + [DataMember(Name = "alias")] + public string Alias => "mediaFolderBrowser"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "media" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/media/mediafolderbrowser.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } +} diff --git a/src/Umbraco.Web/Dashboards/MembersDashboard.cs b/src/Umbraco.Web/Dashboards/MembersDashboard.cs new file mode 100644 index 0000000000..9da6f59108 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/MembersDashboard.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(10)] + [DataContract] + public class MembersDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Get Started"; + + [DataMember(Name = "alias")] + public string Alias => "memberIntro"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "member" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/members/membersdashboardvideos.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } +} diff --git a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs new file mode 100644 index 0000000000..f25a9f7ea0 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs @@ -0,0 +1,29 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(40)] + [DataContract] + public class ModelsBuilderDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Models Builder"; + + [DataMember(Name = "alias")] + public string Alias => "settingsModelsBuilder"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "settings" }; + + [DataMember(Name = "view")] + public string View => "/App_Plugins/ModelsBuilder/modelsbuilder.htm"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } + + +} diff --git a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs new file mode 100644 index 0000000000..d2fa5b217b --- /dev/null +++ b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs @@ -0,0 +1,29 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(30)] + [DataContract] + public class PublishedStatusDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Published Status"; + + [DataMember(Name = "alias")] + public string Alias => "settingsPublishedStatus"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "settings" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/settings/publishedstatus.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } + + +} diff --git a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs new file mode 100644 index 0000000000..731d259d39 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(20)] + [DataContract] + public class RedirectUrlDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Redirect URL Management"; + + [DataMember(Name = "alias")] + public string Alias => "contentRedirectManager"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "content" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/content/redirecturls.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } +} diff --git a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs new file mode 100644 index 0000000000..47c1723075 --- /dev/null +++ b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs @@ -0,0 +1,27 @@ +using System; +using System.Runtime.Serialization; +using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; + +namespace Umbraco.Web.Dashboards +{ + [Weight(10)] + [DataContract] + public class SettingsDashboard : IDashboardSection + { + [DataMember(Name = "name")] + public string Name => "Welcome"; + + [DataMember(Name = "alias")] + public string Alias => "settingsWelcome"; + + [IgnoreDataMember] + public string[] Sections => new string[] { "settings" }; + + [DataMember(Name = "view")] + public string View => "views/dashboard/settings/settingsdashboardintro.html"; + + [IgnoreDataMember] + public IAccessRule[] AccessRules => Array.Empty(); + } +} diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index c6e0049865..11d31a86b4 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -16,6 +16,8 @@ using Umbraco.Web.WebApi.Filters; using Umbraco.Core.Logging; using Umbraco.Core.Persistence; using Umbraco.Core.Services; +using Umbraco.Core.Dashboards; +using Umbraco.Web.Services; namespace Umbraco.Web.Editors { @@ -27,7 +29,7 @@ namespace Umbraco.Web.Editors [WebApi.UmbracoAuthorize] public class DashboardController : UmbracoApiController { - private readonly Dashboards _dashboards; + private readonly IDashboardService _dashboardService; /// /// Initializes a new instance of the with auto dependencies. @@ -38,10 +40,10 @@ namespace Umbraco.Web.Editors /// /// Initializes a new instance of the with all its dependencies. /// - public DashboardController(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, Dashboards dashboards) + public DashboardController(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, IDashboardService dashboardService) : base(globalSettings, umbracoContext, sqlContext, services, appCaches, logger, runtimeState) { - _dashboards = dashboards; + _dashboardService = dashboardService; } //we have just one instance of HttpClient shared for the entire application @@ -79,7 +81,7 @@ namespace Umbraco.Web.Editors } catch (HttpRequestException ex) { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from '{Url}'", url); + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url); //it's still new JObject() - we return it like this to avoid error codes which triggers UI warnings AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); @@ -117,7 +119,7 @@ namespace Umbraco.Web.Editors } catch (HttpRequestException ex) { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from '{Url}'", url); + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from {Url}", url); //it's still string.Empty - we return it like this to avoid error codes which triggers UI warnings AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); @@ -132,9 +134,9 @@ namespace Umbraco.Web.Editors [ValidateAngularAntiForgeryToken] [OutgoingEditorModelEvent] - public IEnumerable> GetDashboard(string section) + public IEnumerable> GetDashboard(string section) { - return _dashboards.GetDashboards(section, Security.CurrentUser); + return _dashboardService.GetDashboards(section, Security.CurrentUser); } } } diff --git a/src/Umbraco.Web/Editors/Dashboards.cs b/src/Umbraco.Web/Editors/Dashboards.cs deleted file mode 100644 index c837cbbf33..0000000000 --- a/src/Umbraco.Web/Editors/Dashboards.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Umbraco.Core; -using Umbraco.Core.Configuration.Dashboard; -using Umbraco.Core.IO; -using Umbraco.Core.Manifest; -using Umbraco.Core.Models.Membership; -using Umbraco.Core.Services; -using Umbraco.Web.Models.ContentEditing; -using Umbraco.Web.Services; - -namespace Umbraco.Web.Editors -{ - public class Dashboards - { - private readonly ISectionService _sectionService; - private readonly IDashboardSection _dashboardSection; - private readonly ManifestParser _manifestParser; - - public Dashboards(ISectionService sectionService, IDashboardSection dashboardSection, ManifestParser manifestParser) - { - _sectionService = sectionService ?? throw new ArgumentNullException(nameof(sectionService)); - _dashboardSection = dashboardSection; - _manifestParser = manifestParser; - } - - /// - /// Gets all dashboards, organized by section, for a user. - /// - public IDictionary>> GetDashboards(IUser currentUser) - { - return _sectionService.GetSections().ToDictionary(x => x.Alias, x => GetDashboards(x.Alias, currentUser)); - } - - /// - /// Returns dashboards for a specific section, for a user. - /// - public IEnumerable> GetDashboards(string section, IUser currentUser) - { - var tabId = 1; - var configDashboards = GetDashboardsFromConfig(ref tabId, section, currentUser); - var pluginDashboards = GetDashboardsFromPlugins(ref tabId, section, currentUser); - - // merge dashboards - // both collections contain tab.alias -> controls - var dashboards = configDashboards; - - // until now, it was fine to have duplicate tab.aliases in configDashboard - // so... the rule should be - just merge whatever we get, don't be clever - dashboards.AddRange(pluginDashboards); - - // re-sort by id - dashboards.Sort((tab1, tab2) => tab1.Id > tab2.Id ? 1 : 0); - - // re-assign ids (why?) - var i = 1; - foreach (var tab in dashboards) - { - tab.Id = i++; - tab.IsActive = tab.Id == 1; - } - - return configDashboards; - } - - // note: - // in dashboard.config we have 'sections' which define 'tabs' for 'areas' - // and 'areas' are the true UI sections - and each tab can have more than - // one control - // in a manifest, we directly have 'dashboards' which map to a unique - // control in a tab - - // gets all tabs & controls from the config file - private List> GetDashboardsFromConfig(ref int tabId, string section, IUser currentUser) - { - var tabs = new List>(); - - // disable packages section dashboard - if (section == "packages") return tabs; - - foreach (var dashboardSection in _dashboardSection.Sections.Where(x => x.Areas.InvariantContains(section))) - { - // validate access to this section - if (!DashboardSecurity.AuthorizeAccess(dashboardSection, currentUser, _sectionService)) - continue; - - foreach (var tab in dashboardSection.Tabs) - { - // validate access to this tab - if (!DashboardSecurity.AuthorizeAccess(tab, currentUser, _sectionService)) - continue; - - var dashboardControls = new List(); - - foreach (var control in tab.Controls) - { - // validate access to this control - if (!DashboardSecurity.AuthorizeAccess(control, currentUser, _sectionService)) - continue; - - // create and add control - var dashboardControl = new DashboardControl - { - Caption = control.PanelCaption, - Path = IOHelper.FindFile(control.ControlPath.Trim()) - }; - - if (dashboardControl.Path.InvariantEndsWith(".ascx")) - throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); - - dashboardControls.Add(dashboardControl); - } - - // create and add tab - tabs.Add(new Tab - { - Id = tabId++, - Alias = tab.Caption.ToSafeAlias(), - Label = tab.Caption, - Properties = dashboardControls - }); - } - } - - return tabs; - } - - private List> GetDashboardsFromPlugins(ref int tabId, string section, IUser currentUser) - { - var tabs = new List>(); - - foreach (var dashboard in _manifestParser.Manifest.Dashboards.Where(x => x.Sections.InvariantContains(section)).OrderBy(x => x.Weight)) - { - // validate access - if (!DashboardSecurity.CheckUserAccessByRules(currentUser, _sectionService, dashboard.AccessRules)) - continue; - - var dashboardControl = new DashboardControl - { - Caption = "", - Path = IOHelper.FindFile(dashboard.View.Trim()) - }; - - if (dashboardControl.Path.InvariantEndsWith(".ascx")) - throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); - - tabs.Add(new Tab - { - Id = tabId++, - Alias = dashboard.Alias.ToSafeAlias(), - Label = dashboard.Name, - Properties = new[] { dashboardControl } - }); - } - - return tabs; - } - } -} diff --git a/src/Umbraco.Web/Editors/EditorModelEventManager.cs b/src/Umbraco.Web/Editors/EditorModelEventManager.cs index 2225f5c577..dd5282d724 100644 --- a/src/Umbraco.Web/Editors/EditorModelEventManager.cs +++ b/src/Umbraco.Web/Editors/EditorModelEventManager.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Web.Http.Filters; +using Umbraco.Core.Dashboards; using Umbraco.Core.Events; using Umbraco.Web.Models.ContentEditing; @@ -14,9 +15,9 @@ namespace Umbraco.Web.Editors public static event TypedEventHandler> SendingMediaModel; public static event TypedEventHandler> SendingMemberModel; public static event TypedEventHandler> SendingUserModel; - public static event TypedEventHandler>>> SendingDashboardModel; + public static event TypedEventHandler>>> SendingDashboardModel; - private static void OnSendingDashboardModel(HttpActionExecutedContext sender, EditorModelEventArgs>> e) + private static void OnSendingDashboardModel(HttpActionExecutedContext sender, EditorModelEventArgs>> e) { var handler = SendingDashboardModel; handler?.Invoke(sender, e); @@ -65,8 +66,8 @@ namespace Umbraco.Web.Editors if (e.Model is UserDisplay) OnSendingUserModel(sender, new EditorModelEventArgs(e)); - if (e.Model is IEnumerable>) - OnSendingDashboardModel(sender, new EditorModelEventArgs>>(e)); + if (e.Model is IEnumerable) + OnSendingDashboardModel(sender, new EditorModelEventArgs>>(e)); } } } diff --git a/src/Umbraco.Web/Editors/SectionController.cs b/src/Umbraco.Web/Editors/SectionController.cs index 74a06d7149..f6973fcbb9 100644 --- a/src/Umbraco.Web/Editors/SectionController.cs +++ b/src/Umbraco.Web/Editors/SectionController.cs @@ -22,15 +22,15 @@ namespace Umbraco.Web.Editors [PluginController("UmbracoApi")] public class SectionController : UmbracoAuthorizedJsonController { - private readonly Dashboards _dashboards; + private readonly IDashboardService _dashboardService; private readonly ISectionService _sectionService; private readonly ITreeService _treeService; public SectionController(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, - Dashboards dashboards, ISectionService sectionService, ITreeService treeService) + IDashboardService dashboardService, ISectionService sectionService, ITreeService treeService) : base(globalSettings, umbracoContext, sqlContext, services, appCaches, logger, runtimeState) { - _dashboards = dashboards; + _dashboardService = dashboardService; _sectionService = sectionService; _treeService = treeService; } @@ -48,7 +48,7 @@ namespace Umbraco.Web.Editors ControllerContext = ControllerContext }; - var dashboards = _dashboards.GetDashboards(Security.CurrentUser); + var dashboards = _dashboardService.GetDashboards(Security.CurrentUser); //now we can add metadata for each section so that the UI knows if there's actually anything at all to render for //a dashboard for a given section, then the UI can deal with it accordingly (i.e. redirect to the first tree) diff --git a/src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs b/src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs deleted file mode 100644 index aad6bf2d64..0000000000 --- a/src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; - -namespace Umbraco.Web.Models.ContentEditing -{ - [DataContract(Name = "control", Namespace = "")] - public class DashboardControl - { - [DataMember(Name = "path")] - public string Path { get; set; } - - [DataMember(Name = "caption")] - public string Caption { get; set; } - } -} diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index 832699b5d7..d165559024 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -6,6 +6,7 @@ using Microsoft.AspNet.SignalR; using Umbraco.Core; using Umbraco.Core.Components; using Umbraco.Core.Composing; +using Umbraco.Core.Dashboards; using Umbraco.Core.Dictionary; using Umbraco.Core.Events; using Umbraco.Core.Models.PublishedContent; @@ -17,6 +18,7 @@ using Umbraco.Web.Actions; using Umbraco.Web.Cache; using Umbraco.Web.Composing.Composers; using Umbraco.Web.ContentApps; +using Umbraco.Web.Dashboards; using Umbraco.Web.Dictionary; using Umbraco.Web.Editors; using Umbraco.Web.Features; @@ -95,14 +97,13 @@ namespace Umbraco.Web.Runtime composition.RegisterUnique(); composition.RegisterUnique(); + composition.RegisterUnique(); + composition.RegisterUnique(factory => ExamineManager.Instance); // configure the container for web composition.ConfigureForWeb(); - - - composition.RegisterUnique(); - + composition .ComposeUmbracoControllers(GetType().Assembly) .SetDefaultRenderMvcController(); // default controller for template views @@ -202,6 +203,25 @@ namespace Umbraco.Web.Runtime .Append() .Append(); + + // register core CMS dashboards as types - will be ordered by weight attribute & merged with package.manifest dashboards + // TODO WB Maybe use typeloader?! + + composition.WithCollectionBuilder() + .Add(composition.TypeLoader.GetTypes()); + + //.Add() + //.Add() + //.Add() + //.Add() + //.Add() + //.Add() + //.Add() + //.Add() + //.Add() + //.Add(); + + // register back office trees foreach (var treeControllerType in umbracoApiControllerTypes .Where(x => typeof(TreeControllerBase).IsAssignableFrom(x))) diff --git a/src/Umbraco.Web/Editors/DashboardSecurity.cs b/src/Umbraco.Web/Services/DashboardService.cs similarity index 62% rename from src/Umbraco.Web/Editors/DashboardSecurity.cs rename to src/Umbraco.Web/Services/DashboardService.cs index fdbf5af7d9..9f70f876a3 100644 --- a/src/Umbraco.Web/Editors/DashboardSecurity.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -1,65 +1,63 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using Umbraco.Core; -using Umbraco.Core.Configuration.Dashboard; +using Umbraco.Core.Dashboards; using Umbraco.Core.Models.Membership; -using Umbraco.Core.Services; -using Umbraco.Web.Services; +using Umbraco.Web.Dashboards; +using Umbraco.Web.Models.ContentEditing; -namespace Umbraco.Web.Editors +namespace Umbraco.Web.Services { - /// - /// A utility class for determine dashboard security - /// - internal class DashboardSecurity + internal class DashboardService : IDashboardService { - //TODO: Unit test all this!!! :/ + private readonly ISectionService _sectionService; + private readonly DashboardCollection _dashboardCollection; - public static bool AuthorizeAccess(ISection dashboardSection, IUser user, ISectionService sectionService) + public DashboardService(ISectionService sectionService, DashboardCollection dashboardCollection) { - return CheckUserAccessByRules(user, sectionService, dashboardSection.AccessRights.Rules); + _sectionService = sectionService ?? throw new ArgumentNullException(nameof(sectionService)); + _dashboardCollection = dashboardCollection ?? throw new ArgumentNullException(nameof(dashboardCollection)); } - public static bool AuthorizeAccess(IDashboardTab dashboardTab, IUser user, ISectionService sectionService) + + /// + public IEnumerable> GetDashboards(string section, IUser currentUser) { - return CheckUserAccessByRules(user, sectionService, dashboardTab.AccessRights.Rules); - } + var tabs = new List>(); + var tabId = 0; - public static bool AuthorizeAccess(IDashboardControl dashboardControl, IUser user, ISectionService sectionService) - { - return CheckUserAccessByRules(user, sectionService, dashboardControl.AccessRights.Rules); - } - - private static (IAccessRule[], IAccessRule[], IAccessRule[]) GroupRules(IEnumerable rules) - { - IAccessRule[] denyRules = null, grantRules = null, grantBySectionRules = null; - - var groupedRules = rules.GroupBy(x => x.Type); - foreach (var group in groupedRules) + foreach (var dashboard in _dashboardCollection.Where(x => x.Sections.InvariantContains(section))) { - var a = group.ToArray(); - switch (group.Key) + // validate access + if (!CheckUserAccessByRules(currentUser, _sectionService, dashboard.AccessRules)) + continue; + + if (dashboard.View.InvariantEndsWith(".ascx")) + throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); + + var dashboards = new List(); + dashboards.Add(dashboard); + + tabs.Add(new Tab() { - case AccessRuleType.Deny: - denyRules = a; - break; - case AccessRuleType.Grant: - grantRules = a; - break; - case AccessRuleType.GrantBySection: - grantBySectionRules = a; - break; - default: - throw new Exception("panic"); - } + Id = tabId++, + Label = dashboard.Name, + Alias = dashboard.Alias, + Properties = dashboards + }); } - return (denyRules ?? Array.Empty(), grantRules ?? Array.Empty(), grantBySectionRules ?? Array.Empty()); + return tabs; } - public static bool CheckUserAccessByRules(IUser user, ISectionService sectionService, IEnumerable rules) + /// + public IDictionary>> GetDashboards(IUser currentUser) + { + return _sectionService.GetSections().ToDictionary(x => x.Alias, x => GetDashboards(x.Alias, currentUser)); + } + + private bool CheckUserAccessByRules(IUser user, ISectionService sectionService, IEnumerable rules) { if (user.Id == Constants.Security.SuperUserId) return true; @@ -111,5 +109,32 @@ namespace Umbraco.Web.Editors return hasAccess; } + + private (IAccessRule[], IAccessRule[], IAccessRule[]) GroupRules(IEnumerable rules) + { + IAccessRule[] denyRules = null, grantRules = null, grantBySectionRules = null; + + var groupedRules = rules.GroupBy(x => x.Type); + foreach (var group in groupedRules) + { + var a = group.ToArray(); + switch (group.Key) + { + case AccessRuleType.Deny: + denyRules = a; + break; + case AccessRuleType.Grant: + grantRules = a; + break; + case AccessRuleType.GrantBySection: + grantBySectionRules = a; + break; + default: + throw new Exception("panic"); + } + } + + return (denyRules ?? Array.Empty(), grantRules ?? Array.Empty(), grantBySectionRules ?? Array.Empty()); + } } } diff --git a/src/Umbraco.Web/Services/IDashboardService.cs b/src/Umbraco.Web/Services/IDashboardService.cs new file mode 100644 index 0000000000..a86715c83d --- /dev/null +++ b/src/Umbraco.Web/Services/IDashboardService.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; +using Umbraco.Core.Dashboards; +using Umbraco.Core.Models.Membership; +using Umbraco.Web.Models.ContentEditing; + +namespace Umbraco.Web.Services +{ + public interface IDashboardService + { + /// + /// Gets dashboard for a specific section/application + /// For a specific backoffice user + /// + /// + /// + /// + IEnumerable> GetDashboards(string section, IUser currentUser); + + /// + /// Gets all dashboards, organized by section, for a user. + /// + /// + /// + IDictionary>> GetDashboards(IUser currentUser); + + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index a6f380b0dd..bd3ff8910b 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -122,6 +122,18 @@ + + + + + + + + + + + + @@ -169,6 +181,8 @@ + + @@ -244,7 +258,6 @@ - @@ -705,7 +718,6 @@ - @@ -826,7 +838,6 @@ - From 5d34ee271cc6ee57568db49fe0d379e95c885e52 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 23 Jan 2019 14:42:49 +0000 Subject: [PATCH 14/76] Forgot to remove my test App_Plugin Dashboard --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index c7b6540b3d..0ff158dadb 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -178,7 +178,6 @@ - @@ -206,7 +205,6 @@ - 404handlers.config From f2cc0eebf5a79f0b9283e6e64d512810174788be Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 23 Jan 2019 14:43:05 +0000 Subject: [PATCH 15/76] Remove the dashboard XML config file --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 7 -- .../config/Dashboard.Release.config | 107 ----------------- src/Umbraco.Web.UI/config/Dashboard.config | 108 ------------------ 3 files changed, 222 deletions(-) delete mode 100644 src/Umbraco.Web.UI/config/Dashboard.Release.config delete mode 100644 src/Umbraco.Web.UI/config/Dashboard.config diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 0ff158dadb..65b5691241 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -251,10 +251,6 @@ feedProxy.config - - Dashboard.config - Designer - @@ -361,9 +357,6 @@ Designer - - Designer - Designer diff --git a/src/Umbraco.Web.UI/config/Dashboard.Release.config b/src/Umbraco.Web.UI/config/Dashboard.Release.config deleted file mode 100644 index fec6ab34ae..0000000000 --- a/src/Umbraco.Web.UI/config/Dashboard.Release.config +++ /dev/null @@ -1,107 +0,0 @@ - - - -
- - settings - - - - views/dashboard/settings/settingsdashboardintro.html - - - - - views/dashboard/settings/examinemanagement.html - - - - - views/dashboard/settings/publishedstatus.html - - -
- -
- - forms - - - - views/dashboard/forms/formsdashboardintro.html - - -
- -
- - media - - - - views/dashboard/media/mediafolderbrowser.html - - -
- -
- - translator - - - content - - - - admin - - - - views/dashboard/default/startupdashboardintro.html - - -
- -
- - member - - - - views/dashboard/members/membersdashboardvideos.html - - -
- -
- - settings - - - - /App_Plugins/ModelsBuilder/modelsbuilder.htm - - -
- -
- - settings - - - - views/dashboard/settings/healthcheck.html - - -
-
- - content - - - - views/dashboard/content/redirecturls.html - - -
-
diff --git a/src/Umbraco.Web.UI/config/Dashboard.config b/src/Umbraco.Web.UI/config/Dashboard.config deleted file mode 100644 index 94325913df..0000000000 --- a/src/Umbraco.Web.UI/config/Dashboard.config +++ /dev/null @@ -1,108 +0,0 @@ - - - -
- - settings - - - - views/dashboard/settings/settingsdashboardintro.html - - - - - views/dashboard/settings/examinemanagement.html - - - - - views/dashboard/settings/publishedstatus.html - - -
- -
- - forms - - - - views/dashboard/forms/formsdashboardintro.html - - -
- -
- - media - - - - views/dashboard/media/mediafolderbrowser.html - - -
- -
- - translator - - - content - - - - admin - - - - views/dashboard/default/startupdashboardintro.html - - -
- -
- - member - - - - views/dashboard/members/membersdashboardvideos.html - - -
- -
- - settings - - - - /App_Plugins/ModelsBuilder/modelsbuilder.htm - - -
- -
- - settings - - - - views/dashboard/settings/healthcheck.html - - -
- -
- - content - - - - views/dashboard/content/redirecturls.html - - -
-
From 5e9f8619912d6edffe2d1274836e6e2cc287593d Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 23 Jan 2019 15:09:31 +0000 Subject: [PATCH 16/76] Cleanup of WebRuntimeComposer --- src/Umbraco.Web/Runtime/WebRuntimeComposer.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index d165559024..22595d795c 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -204,23 +204,9 @@ namespace Umbraco.Web.Runtime .Append(); - // register core CMS dashboards as types - will be ordered by weight attribute & merged with package.manifest dashboards - // TODO WB Maybe use typeloader?! - + // register core CMS dashboards and 3rd party types - will be ordered by weight attribute & merged with package.manifest dashboards composition.WithCollectionBuilder() - .Add(composition.TypeLoader.GetTypes()); - - //.Add() - //.Add() - //.Add() - //.Add() - //.Add() - //.Add() - //.Add() - //.Add() - //.Add() - //.Add(); - + .Add(composition.TypeLoader.GetTypes()); // register back office trees foreach (var treeControllerType in umbracoApiControllerTypes From 9e0d2e58732c4ac00baa369451da5e855c39cc08 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 24 Jan 2019 11:37:28 +0100 Subject: [PATCH 17/76] Revert "Remove obsoleted RelatedLinks picker (replaced by Multi URL Picker)" This reverts commit fedf0c78de6d2ad365db1c112c22af13abd7b9fb. --- src/Umbraco.Core/Constants-PropertyEditors.cs | 7 +- .../Migrations/Install/DatabaseDataCreator.cs | 4 +- .../V_8_0_0/PropertyEditorsMigration.cs | 1 + .../Composing/TypeLoaderTests.cs | 2 +- .../Services/ContentServiceTests.cs | 2 +- .../TestHelpers/Entities/MockedContent.cs | 2 +- .../Entities/MockedContentTypes.cs | 2 +- .../Mvc/HtmlHelperExtensionMethodsTests.cs | 25 +++ src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 34 ++++ src/Umbraco.Web/Models/RelatedLink.cs | 11 ++ src/Umbraco.Web/Models/RelatedLinkBase.cs | 18 ++ src/Umbraco.Web/Models/RelatedLinkType.cs | 27 +++ src/Umbraco.Web/Models/RelatedLinks.cs | 42 +++++ .../RelatedLinksConfiguration.cs | 13 ++ .../RelatedLinksConfigurationEditor.cs | 18 ++ .../RelatedLinksPropertyEditor.cs | 16 ++ .../RelatedLinksLegacyValueConverter.cs | 132 ++++++++++++++ .../RelatedLinksValueConverter.cs | 169 ++++++++++++++++++ src/Umbraco.Web/RelatedLinksTypeConverter.cs | 98 ++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 10 ++ 20 files changed, 626 insertions(+), 7 deletions(-) create mode 100644 src/Umbraco.Web/Models/RelatedLink.cs create mode 100644 src/Umbraco.Web/Models/RelatedLinkBase.cs create mode 100644 src/Umbraco.Web/Models/RelatedLinkType.cs create mode 100644 src/Umbraco.Web/Models/RelatedLinks.cs create mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs create mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs create mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs create mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs create mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs create mode 100644 src/Umbraco.Web/RelatedLinksTypeConverter.cs diff --git a/src/Umbraco.Core/Constants-PropertyEditors.cs b/src/Umbraco.Core/Constants-PropertyEditors.cs index 8b637fe90e..b9f20fb449 100644 --- a/src/Umbraco.Core/Constants-PropertyEditors.cs +++ b/src/Umbraco.Core/Constants-PropertyEditors.cs @@ -118,7 +118,12 @@ namespace Umbraco.Core /// RadioButton list. ///
public const string RadioButtonList = "Umbraco.RadioButtonList"; - + + /// + /// Related Links. + /// + public const string RelatedLinks = "Umbraco.RelatedLinks"; + /// /// Slider. /// diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index 4e0b5dfa0f..f32ea1cb6f 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -135,7 +135,7 @@ namespace Umbraco.Core.Migrations.Install _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = new Guid("1EA2E01F-EBD8-4CE1-8D71-6B1149E63548"), Text = "Member Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = new Guid("135D60E0-64D9-49ED-AB08-893C9BA44AE5"), Text = "Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = new Guid("9DBBCBBB-2327-434A-B355-AF1B84E5010A"), Text = "Multiple Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Multi URL Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Related Links", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); } private void CreateLockData() @@ -301,7 +301,7 @@ namespace Umbraco.Core.Migrations.Install _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1048, EditorAlias = Constants.PropertyEditors.Aliases.MediaPicker, DbType = "Ntext" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1049, EditorAlias = Constants.PropertyEditors.Aliases.MediaPicker, DbType = "Ntext", Configuration = "{\"multiPicker\":1}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1050, EditorAlias = Constants.PropertyEditors.Aliases.MultiUrlPicker, DbType = "Ntext" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1050, EditorAlias = Constants.PropertyEditors.Aliases.RelatedLinks, DbType = "Ntext" }); } private void CreateRelationTypeData() diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs index 064ffc7228..ee439088be 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs @@ -16,6 +16,7 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 RenameDataType(Constants.PropertyEditors.Aliases.MediaPicker + "2", Constants.PropertyEditors.Aliases.MediaPicker); RenameDataType(Constants.PropertyEditors.Aliases.MemberPicker + "2", Constants.PropertyEditors.Aliases.MemberPicker); RenameDataType(Constants.PropertyEditors.Aliases.MultiNodeTreePicker + "2", Constants.PropertyEditors.Aliases.MultiNodeTreePicker); + RenameDataType(Constants.PropertyEditors.Aliases.RelatedLinks + "2", Constants.PropertyEditors.Aliases.RelatedLinks); RenameDataType("Umbraco.TextboxMultiple", Constants.PropertyEditors.Aliases.TextArea, false); RenameDataType("Umbraco.Textbox", Constants.PropertyEditors.Aliases.TextBox, false); } diff --git a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs index add3424599..6b3ce3eb4e 100644 --- a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs +++ b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs @@ -279,7 +279,7 @@ AnotherContentFinder public void GetDataEditors() { var types = _typeLoader.GetDataEditors(); - Assert.AreEqual(39, types.Count()); + Assert.AreEqual(40, types.Count()); } /// diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 9490213d62..039bcaed24 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -2215,7 +2215,7 @@ namespace Umbraco.Tests.Services Assert.That(sut.GetValue("contentPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Document, new Guid("74ECA1D4-934E-436A-A7C7-36CC16D4095C")))); Assert.That(sut.GetValue("mediaPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Media, new Guid("44CB39C8-01E5-45EB-9CF8-E70AAF2D1691")))); Assert.That(sut.GetValue("memberPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Member, new Guid("9A50A448-59C0-4D42-8F93-4F1D55B0F47D")))); - Assert.That(sut.GetValue("multiUrlPicker"), Is.EqualTo("[{\"name\":\"https://test.com\",\"url\":\"https://test.com\"}]")); + Assert.That(sut.GetValue("relatedLinks"), Is.EqualTo("")); Assert.That(sut.GetValue("tags"), Is.EqualTo("this,is,tags")); } diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs index 19a57d7775..faf4acf8a4 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs @@ -132,7 +132,7 @@ namespace Umbraco.Tests.TestHelpers.Entities content.SetValue("contentPicker", Udi.Create(Constants.UdiEntityType.Document, new Guid("74ECA1D4-934E-436A-A7C7-36CC16D4095C")).ToString()); content.SetValue("mediaPicker", Udi.Create(Constants.UdiEntityType.Media, new Guid("44CB39C8-01E5-45EB-9CF8-E70AAF2D1691")).ToString()); content.SetValue("memberPicker", Udi.Create(Constants.UdiEntityType.Member, new Guid("9A50A448-59C0-4D42-8F93-4F1D55B0F47D")).ToString()); - content.SetValue("multiUrlPicker", "[{\"name\":\"https://test.com\",\"url\":\"https://test.com\"}]"); + content.SetValue("relatedLinks", ""); content.SetValue("tags", "this,is,tags"); return content; diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index d7dcf8e79a..14b967b1c9 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -370,7 +370,7 @@ namespace Umbraco.Tests.TestHelpers.Entities contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.ContentPicker, ValueStorageType.Integer) { Alias = "contentPicker", Name = "Content Picker", Mandatory = false, SortOrder = 16, DataTypeId = 1046 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MediaPicker, ValueStorageType.Integer) { Alias = "mediaPicker", Name = "Media Picker", Mandatory = false, SortOrder = 17, DataTypeId = 1048 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MemberPicker, ValueStorageType.Integer) { Alias = "memberPicker", Name = "Member Picker", Mandatory = false, SortOrder = 18, DataTypeId = 1047 }); - contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MultiUrlPicker, ValueStorageType.Nvarchar) { Alias = "multiUrlPicker", Name = "Multi URL Picker", Mandatory = false, SortOrder = 21, DataTypeId = 1050 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.RelatedLinks, ValueStorageType.Ntext) { Alias = "relatedLinks", Name = "Related Links", Mandatory = false, SortOrder = 21, DataTypeId = 1050 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Tags, ValueStorageType.Ntext) { Alias = "tags", Name = "Tags", Mandatory = false, SortOrder = 22, DataTypeId = 1041 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); diff --git a/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs b/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs index ba19f41e74..cc83dcb1c9 100644 --- a/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs @@ -29,5 +29,30 @@ namespace Umbraco.Tests.Web.Mvc var output = _htmlHelper.Wrap("div", "hello world", new {style = "color:red;", onclick = "void();"}); Assert.AreEqual("
hello world
", output.ToHtmlString()); } + + [Test] + public void GetRelatedLinkHtml_Simple() + { + var relatedLink = new Umbraco.Web.Models.RelatedLink { + Caption = "Link Caption", + NewWindow = true, + Link = "https://www.google.com/" + }; + var output = _htmlHelper.GetRelatedLinkHtml(relatedLink); + Assert.AreEqual("Link Caption", output.ToHtmlString()); + } + + [Test] + public void GetRelatedLinkHtml_HtmlAttributes() + { + var relatedLink = new Umbraco.Web.Models.RelatedLink + { + Caption = "Link Caption", + NewWindow = true, + Link = "https://www.google.com/" + }; + var output = _htmlHelper.GetRelatedLinkHtml(relatedLink, new { @class = "test-class"}); + Assert.AreEqual("Link Caption", output.ToHtmlString()); + } } } diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 1186102bc8..626a19a369 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -830,5 +830,39 @@ namespace Umbraco.Web } #endregion + + + #region RelatedLink + + /// + /// Renders an anchor element for a RelatedLink instance. + /// Format: <a href="relatedLink.Link" target="_blank/_self">relatedLink.Caption</a> + /// + /// The HTML helper instance that this method extends. + /// The RelatedLink instance + /// An anchor element + public static MvcHtmlString GetRelatedLinkHtml(this HtmlHelper htmlHelper, RelatedLink relatedLink) + { + return htmlHelper.GetRelatedLinkHtml(relatedLink, null); + } + + /// + /// Renders an anchor element for a RelatedLink instance, accepting htmlAttributes. + /// Format: <a href="relatedLink.Link" target="_blank/_self" htmlAttributes>relatedLink.Caption</a> + /// + /// The HTML helper instance that this method extends. + /// The RelatedLink instance + /// An object that contains the HTML attributes to set for the element. + /// + public static MvcHtmlString GetRelatedLinkHtml(this HtmlHelper htmlHelper, RelatedLink relatedLink, object htmlAttributes) + { + var tagBuilder = new TagBuilder("a"); + tagBuilder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); + tagBuilder.MergeAttribute("href", relatedLink.Link); + tagBuilder.MergeAttribute("target", relatedLink.NewWindow ? "_blank" : "_self"); + tagBuilder.InnerHtml = HttpUtility.HtmlEncode(relatedLink.Caption); + return MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.Normal)); + } + #endregion } } diff --git a/src/Umbraco.Web/Models/RelatedLink.cs b/src/Umbraco.Web/Models/RelatedLink.cs new file mode 100644 index 0000000000..1e1d7636ad --- /dev/null +++ b/src/Umbraco.Web/Models/RelatedLink.cs @@ -0,0 +1,11 @@ +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Web.Models +{ + public class RelatedLink : RelatedLinkBase + { + public int? Id { get; internal set; } + internal bool IsDeleted { get; set; } + public IPublishedContent Content { get; set; } + } +} diff --git a/src/Umbraco.Web/Models/RelatedLinkBase.cs b/src/Umbraco.Web/Models/RelatedLinkBase.cs new file mode 100644 index 0000000000..c2077ce4a9 --- /dev/null +++ b/src/Umbraco.Web/Models/RelatedLinkBase.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace Umbraco.Web.Models +{ + public abstract class RelatedLinkBase + { + [JsonProperty("caption")] + public string Caption { get; set; } + [JsonProperty("link")] + public string Link { get; set; } + [JsonProperty("newWindow")] + public bool NewWindow { get; set; } + [JsonProperty("isInternal")] + public bool IsInternal { get; set; } + [JsonProperty("type")] + public RelatedLinkType Type { get; set; } + } +} diff --git a/src/Umbraco.Web/Models/RelatedLinkType.cs b/src/Umbraco.Web/Models/RelatedLinkType.cs new file mode 100644 index 0000000000..eec7817ab6 --- /dev/null +++ b/src/Umbraco.Web/Models/RelatedLinkType.cs @@ -0,0 +1,27 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Umbraco +// +// +// Defines the RelatedLinkType type. +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace Umbraco.Web.Models +{ + /// + /// The related link type. + /// + public enum RelatedLinkType + { + /// + /// Internal link type + /// + Internal, + + /// + /// External link type + /// + External + } +} diff --git a/src/Umbraco.Web/Models/RelatedLinks.cs b/src/Umbraco.Web/Models/RelatedLinks.cs new file mode 100644 index 0000000000..22cdcd11b6 --- /dev/null +++ b/src/Umbraco.Web/Models/RelatedLinks.cs @@ -0,0 +1,42 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace Umbraco.Web.Models +{ + [TypeConverter(typeof(RelatedLinksTypeConverter))] + public class RelatedLinks : IEnumerable + { + private readonly string _propertyData; + + private readonly IEnumerable _relatedLinks; + + public RelatedLinks(IEnumerable relatedLinks, string propertyData) + { + _relatedLinks = relatedLinks; + _propertyData = propertyData; + } + + /// + /// Gets the property data. + /// + internal string PropertyData + { + get + { + return this._propertyData; + } + } + + public IEnumerator GetEnumerator() + { + return _relatedLinks.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return this.GetEnumerator(); + } + } +} diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs new file mode 100644 index 0000000000..5db14c6842 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs @@ -0,0 +1,13 @@ +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Web.PropertyEditors +{ + /// + /// Represents the configuration for the related links value editor. + /// + public class RelatedLinksConfiguration + { + [ConfigurationField("max", "Maximum number of links", "number", Description = "Enter the maximum amount of links to be added, enter 0 for unlimited")] + public int Maximum { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs new file mode 100644 index 0000000000..07ff359a82 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Web.PropertyEditors +{ + /// + /// Represents the configuration editor for the related links value editor. + /// + public class RelatedLinksConfigurationEditor : ConfigurationEditor + { + public override IDictionary ToValueEditor(object configuration) + { + var d = base.ToValueEditor(configuration); + d["idType"] = "udi"; + return d; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs new file mode 100644 index 0000000000..b450fcc67f --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs @@ -0,0 +1,16 @@ +using Umbraco.Core; +using Umbraco.Core.Logging; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Web.PropertyEditors +{ + [DataEditor(Constants.PropertyEditors.Aliases.RelatedLinks, "Related links", "relatedlinks", ValueType = ValueTypes.Json, Icon = "icon-thumbnail-list", Group = "pickers")] + public class RelatedLinksPropertyEditor : DataEditor + { + public RelatedLinksPropertyEditor(ILogger logger) + : base(logger) + { } + + protected override IConfigurationEditor CreateConfigurationEditor() => new RelatedLinksConfigurationEditor(); + } +} diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs new file mode 100644 index 0000000000..6c2a4331d0 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.PropertyEditors; +using Umbraco.Core.PropertyEditors.ValueConverters; +using Umbraco.Core.Services; + +namespace Umbraco.Web.PropertyEditors.ValueConverters +{ + [DefaultPropertyValueConverter(typeof(JsonValueConverter))] //this shadows the JsonValueConverter + public class RelatedLinksLegacyValueConverter : PropertyValueConverterBase + { + private static readonly string[] MatchingEditors = { + Constants.PropertyEditors.Aliases.RelatedLinks + }; + + private readonly IUmbracoContextAccessor _umbracoContextAccessor; + private readonly ILogger _logger; + private readonly ServiceContext _services; + + public RelatedLinksLegacyValueConverter(IUmbracoContextAccessor umbracoContextAccessor, ServiceContext services, ILogger logger) + { + _umbracoContextAccessor = umbracoContextAccessor; + _services = services; + _logger = logger; + } + + public override bool IsConverter(PublishedPropertyType propertyType) + => MatchingEditors.Contains(propertyType.EditorAlias); + + public override Type GetPropertyValueType(PublishedPropertyType propertyType) + => typeof (JArray); + + public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType) + => PropertyCacheLevel.Element; + + public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + if (sourceString.DetectIsJson()) + { + try + { + var obj = JsonConvert.DeserializeObject(sourceString); + //update the internal links if we have a context + if (UmbracoContext.Current != null) + { + var helper = new UmbracoHelper(_umbracoContextAccessor.UmbracoContext, _services); + foreach (var a in obj) + { + var type = a.Value("type"); + if (type.IsNullOrWhiteSpace() == false) + { + if (type == "internal") + { + switch (propertyType.EditorAlias) + { + case Constants.PropertyEditors.Aliases.RelatedLinks: + var strLinkId = a.Value("link"); + var udiAttempt = strLinkId.TryConvertTo(); + if (udiAttempt) + { + var content = helper.PublishedContent(udiAttempt.Result); + if (content == null) break; + a["link"] = helper.Url(content.Id); + } + break; + } + } + } + } + } + return obj; + } + catch (Exception ex) + { + _logger.Error(ex, "Could not parse the string '{Json}' to a json object", sourceString); + } + } + + //it's not json, just return the string + return sourceString; + } + + public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + if (sourceString.DetectIsJson()) + { + try + { + var obj = JsonConvert.DeserializeObject(sourceString); + + var d = new XmlDocument(); + var e = d.CreateElement("links"); + d.AppendChild(e); + + foreach (dynamic link in obj) + { + var ee = d.CreateElement("link"); + ee.SetAttribute("title", link.title); + ee.SetAttribute("link", link.link); + ee.SetAttribute("type", link.type); + ee.SetAttribute("newwindow", link.newWindow); + + e.AppendChild(ee); + } + + return d.CreateNavigator(); + } + catch (Exception ex) + { + _logger.Error(ex, "Could not parse the string '{Json}' to a json object", sourceString); + } + } + + //it's not json, just return the string + return sourceString; + } + } +} diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs new file mode 100644 index 0000000000..983d122a83 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Xml; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Umbraco.Core; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.PropertyEditors; +using Umbraco.Core.PropertyEditors.ValueConverters; +using Umbraco.Web.Models; +using Umbraco.Web.PublishedCache; + +namespace Umbraco.Web.PropertyEditors.ValueConverters +{ + /// + /// The related links property value converter. + /// + [DefaultPropertyValueConverter(typeof(RelatedLinksLegacyValueConverter), typeof(JsonValueConverter))] + public class RelatedLinksValueConverter : PropertyValueConverterBase + { + private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; + private readonly IUmbracoContextAccessor _umbracoContextAccessor; + private readonly ILogger _logger; + + public RelatedLinksValueConverter(IPublishedSnapshotAccessor publishedSnapshotAccessor, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger) + { + _publishedSnapshotAccessor = publishedSnapshotAccessor; + _umbracoContextAccessor = umbracoContextAccessor; + _logger = logger; + } + + /// + /// Checks if this converter can convert the property editor and registers if it can. + /// + /// + /// The property type. + /// + /// + /// The . + /// + public override bool IsConverter(PublishedPropertyType propertyType) + => propertyType.EditorAlias.Equals(Constants.PropertyEditors.Aliases.RelatedLinks); + + public override Type GetPropertyValueType(PublishedPropertyType propertyType) + => typeof (JArray); + + public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType) + => PropertyCacheLevel.Element; + + public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) + { + if (source == null) return null; + var sourceString = source.ToString(); + + var relatedLinksData = JsonConvert.DeserializeObject>(sourceString); + var relatedLinks = new List(); + + foreach (var linkData in relatedLinksData) + { + var relatedLink = new RelatedLink + { + Caption = linkData.Caption, + NewWindow = linkData.NewWindow, + IsInternal = linkData.IsInternal, + Type = linkData.Type, + Link = linkData.Link + }; + + int contentId; + if (int.TryParse(relatedLink.Link, out contentId)) + { + relatedLink.Id = contentId; + relatedLink = CreateLink(relatedLink); + } + else + { + var strLinkId = linkData.Link; + var udiAttempt = strLinkId.TryConvertTo(); + if (udiAttempt.Success && udiAttempt.Result != null) + { + var content = _publishedSnapshotAccessor.PublishedSnapshot.Content.GetById(udiAttempt.Result.Guid); + if (content != null) + { + relatedLink.Id = content.Id; + relatedLink = CreateLink(relatedLink); + relatedLink.Content = content; + } + } + } + + if (relatedLink.IsDeleted == false) + { + relatedLinks.Add(relatedLink); + } + else + { + _logger.Warn("Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {RelatedLinkNodeId}, Link Caption: '{RelatedLinkCaption}')", relatedLink.Link, relatedLink.Caption); + } + } + + return new RelatedLinks(relatedLinks, sourceString); + } + + private RelatedLink CreateLink(RelatedLink link) + { + var umbracoContext = _umbracoContextAccessor.UmbracoContext; + + if (link.IsInternal && link.Id != null) + { + if (umbracoContext == null) + return null; + + var urlProvider = umbracoContext.UrlProvider; + + link.Link = urlProvider.GetUrl((int)link.Id); + if (link.Link.Equals("#")) + { + link.IsDeleted = true; + link.Link = link.Id.ToString(); + } + else + { + link.IsDeleted = false; + } + } + + return link; + } + + public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview) + { + if (inter == null) return null; + var sourceString = inter.ToString(); + + if (sourceString.DetectIsJson()) + { + try + { + var obj = JsonConvert.DeserializeObject(sourceString); + + var d = new XmlDocument(); + var e = d.CreateElement("links"); + d.AppendChild(e); + + foreach (dynamic link in obj) + { + var ee = d.CreateElement("link"); + ee.SetAttribute("title", link.title); + ee.SetAttribute("link", link.link); + ee.SetAttribute("type", link.type); + ee.SetAttribute("newwindow", link.newWindow); + + e.AppendChild(ee); + } + + return d.CreateNavigator(); + } + catch (Exception ex) + { + _logger.Error(ex, "Could not parse the string {Json} to a json object", sourceString); + } + } + + //it's not json, just return the string + return sourceString; + } + } +} diff --git a/src/Umbraco.Web/RelatedLinksTypeConverter.cs b/src/Umbraco.Web/RelatedLinksTypeConverter.cs new file mode 100644 index 0000000000..647959b920 --- /dev/null +++ b/src/Umbraco.Web/RelatedLinksTypeConverter.cs @@ -0,0 +1,98 @@ +using System; +using System.ComponentModel; +using System.Globalization; +using System.Linq; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +using Umbraco.Core; +using Umbraco.Core.Logging; +using Umbraco.Core.Composing; +using Umbraco.Web.Models; + +namespace Umbraco.Web +{ + public class RelatedLinksTypeConverter : TypeConverter + { + private readonly UmbracoHelper _umbracoHelper; + + public RelatedLinksTypeConverter(UmbracoHelper umbracoHelper) + { + _umbracoHelper = umbracoHelper; + } + + public RelatedLinksTypeConverter() + { + + } + + private static readonly Type[] ConvertableTypes = new[] + { + typeof(JArray) + }; + + public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) + { + return ConvertableTypes.Any(x => TypeHelper.IsTypeAssignableFrom(x, destinationType)) + || base.CanConvertFrom(context, destinationType); + } + + public override object ConvertTo( + ITypeDescriptorContext context, + CultureInfo culture, + object value, + Type destinationType) + { + var relatedLinks = value as RelatedLinks; + if (relatedLinks == null) + return null; + + if (TypeHelper.IsTypeAssignableFrom(destinationType)) + { + // Conversion to JArray taken from old value converter + + var obj = JsonConvert.DeserializeObject(relatedLinks.PropertyData); + + var umbracoHelper = GetUmbracoHelper(); + + //update the internal links if we have a context + if (umbracoHelper != null) + { + foreach (var a in obj) + { + var type = a.Value("type"); + if (type.IsNullOrWhiteSpace() == false) + { + if (type == "internal") + { + var linkId = a.Value("link"); + var link = umbracoHelper.Url(linkId); + a["link"] = link; + } + } + } + } + return obj; + + } + + return base.ConvertTo(context, culture, value, destinationType); + } + + private UmbracoHelper GetUmbracoHelper() + { + if (_umbracoHelper != null) + return _umbracoHelper; + + if (UmbracoContext.Current == null) + { + Current.Logger.Warn("Cannot create an UmbracoHelper the UmbracoContext is null"); + return null; + } + + //DO NOT assign to _umbracoHelper variable, this is a singleton class and we cannot assign this based on an UmbracoHelper which is request based + return new UmbracoHelper(UmbracoContext.Current, Current.Services); + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 64a60d824a..6736f7512b 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -404,6 +404,10 @@ + + + + @@ -449,6 +453,9 @@ + + + @@ -464,6 +471,7 @@ + @@ -527,6 +535,7 @@ + @@ -851,6 +860,7 @@ + From eef6c783eafb358a5d29eae59021efe6b284190b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 24 Jan 2019 11:59:33 +0100 Subject: [PATCH 18/76] updated package-lock.json --- src/Umbraco.Web.UI.Client/package-lock.json | 96 ++++++++++----------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index ed28a93caf..fe657ae470 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -937,7 +937,7 @@ }, "ansi-colors": { "version": "1.1.0", - "resolved": "http://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", "dev": true, "requires": { @@ -955,7 +955,7 @@ }, "ansi-escapes": { "version": "3.1.0", - "resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", "dev": true }, @@ -1170,7 +1170,7 @@ "array-slice": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", - "integrity": "sha1-42jqFfibxwaff/uJrsOmx9SsItQ=", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", "dev": true }, "array-sort": { @@ -1216,7 +1216,7 @@ "arraybuffer.slice": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz", - "integrity": "sha1-O7xCdd1YTMGxCAm4nU6LY6aednU=", + "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", "dev": true }, "asap": { @@ -1269,7 +1269,7 @@ "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", - "integrity": "sha1-ePrtjD0HSrgfIrTphdeehzj3IPg=", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "dev": true }, "asynckit": { @@ -2379,7 +2379,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -2459,7 +2459,7 @@ "content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha1-4TjMdeBAxyexlm/l5fjJruJW/js=", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", "dev": true }, "continuable-cache": { @@ -2502,7 +2502,7 @@ "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", - "integrity": "sha1-+XJgj/DOrWi4QaFqky0LGDeRgU4=", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", "dev": true }, "core-util-is": { @@ -3425,7 +3425,7 @@ "doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha1-XNAfwQFiG0LEzX9dGmYkNxbT850=", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { "esutils": "^2.0.2" @@ -3953,7 +3953,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -3989,7 +3989,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -4153,7 +4153,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, "optional": true } @@ -4248,7 +4248,7 @@ "eslint-scope": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", - "integrity": "sha1-UL8wcekzi83EMzF5Sgy1M/ATYXI=", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -4258,13 +4258,13 @@ "eslint-utils": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", - "integrity": "sha1-moUbqJ7nxGA0b5fPiTnHKYgn5RI=", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", "dev": true }, "eslint-visitor-keys": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha1-PzGA+y4pEBdxastMnW1bXDSmqB0=", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", "dev": true }, "espree": { @@ -4287,7 +4287,7 @@ "esquery": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", - "integrity": "sha1-QGxRZYsfWZGl+bYrHcJbAOPlxwg=", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", "dev": true, "requires": { "estraverse": "^4.0.0" @@ -4296,7 +4296,7 @@ "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha1-AHo7n9vCs7uH5IeeoZyS/b05Qs8=", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { "estraverse": "^4.1.0" @@ -4356,7 +4356,7 @@ "eventemitter3": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha1-CQtNbNvWRe0Qv3UNS1QHlC17oWM=", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", "dev": true }, "exec-buffer": { @@ -4571,7 +4571,7 @@ "fill-range": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "integrity": "sha1-6x53OrsFbc2N8r/favWbizqTZWU=", "dev": true, "requires": { "is-number": "^2.1.0", @@ -5891,7 +5891,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -6461,7 +6461,7 @@ "gulp-eslint": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/gulp-eslint/-/gulp-eslint-5.0.0.tgz", - "integrity": "sha1-KiaECV93Syz3kxAmIHjFbMehK1I=", + "integrity": "sha512-9GUqCqh85C7rP9120cpxXuZz2ayq3BZc85pCTuPJS03VQYxne0aWPIXWx6LSvsGPa3uRqtSO537vaugOh+5cXg==", "dev": true, "requires": { "eslint": "^5.0.1", @@ -7415,7 +7415,7 @@ "has-binary2": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz", - "integrity": "sha1-d3asYn8+p3JQz8My2rfd9eT10R0=", + "integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==", "dev": true, "requires": { "isarray": "2.0.1" @@ -7566,7 +7566,7 @@ "http-proxy": { "version": "1.17.0", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha1-etOElGWPhGBeL220Q230EPTlvpo=", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", "dev": true, "requires": { "eventemitter3": "^3.0.0", @@ -7860,7 +7860,7 @@ "is-absolute": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", - "integrity": "sha1-OV4a6EsR8mrReV5zwXN45IowFXY=", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", "dev": true, "requires": { "is-relative": "^1.0.0", @@ -8155,7 +8155,7 @@ "is-relative": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", - "integrity": "sha1-obtpNc6MXboei5dUubLcwCDiJg0=", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", "dev": true, "requires": { "is-unc-path": "^1.0.0" @@ -8164,7 +8164,7 @@ "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha1-+xj4fOH+uSUWnJpAfBkxijIG7Yg=", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", "dev": true }, "is-retry-allowed": { @@ -8212,7 +8212,7 @@ "is-unc-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", - "integrity": "sha1-1zHoiY7QkKEsNSrS6u1Qla0yLJ0=", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", "dev": true, "requires": { "unc-path-regex": "^0.1.2" @@ -8369,7 +8369,7 @@ "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha1-afaofZUTq4u4/mO9sJecRI5oRmA=", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, "json-stable-stringify-without-jsonify": { @@ -8496,7 +8496,7 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true } } @@ -9146,7 +9146,7 @@ "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", - "integrity": "sha1-KbM/MSqo9UfEpeSQ9Wr87JkTOtY=", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", "dev": true, "requires": { "kind-of": "^6.0.2" @@ -9327,7 +9327,7 @@ "mimic-fn": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha1-ggyGo5M0ZA6ZUWkovQP8qIBX0CI=", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "dev": true }, "minimatch": { @@ -12855,7 +12855,7 @@ "pluralize": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha1-KYuJ34uTsCIdv0Ia0rGx6iP8Z3c=", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", "dev": true }, "posix-character-classes": { @@ -13345,7 +13345,7 @@ "qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", - "integrity": "sha1-xF6cYYAL0IfviNfiVkI73Unl0HE=", + "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", "dev": true }, "qs": { @@ -13541,7 +13541,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -14039,7 +14039,7 @@ "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, "sax": { @@ -14226,7 +14226,7 @@ "setprototypeof": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha1-0L2FU2iHtv58DYGMuWLZ2RxU5lY=", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==", "dev": true }, "shebang-command": { @@ -14516,7 +14516,7 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha1-W7WgZyYotkFJVmuhaBnmFRjGcmE=", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { "ms": "2.0.0" @@ -14796,7 +14796,7 @@ "stream-consume": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", - "integrity": "sha1-0721mMK9CugrjKx6xQsRB6eZbEg=", + "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", "dev": true }, "stream-shift": { @@ -14808,7 +14808,7 @@ "streamroller": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-0.7.0.tgz", - "integrity": "sha1-odG3z4PTmvsNYwSaWsv5NJO99ks=", + "integrity": "sha512-WREzfy0r0zUqp3lGO096wRuUp7ho1X6uo/7DJfTlEi0Iv/4gT7YHqXDjKC2ioVGBZtE8QzsQD9nx1nIuoZ57jQ==", "dev": true, "requires": { "date-format": "^1.2.0", @@ -14835,7 +14835,7 @@ "readable-stream": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha1-sRwn2IuP8fvgcGQ8+UsMea4bCq8=", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { "core-util-is": "~1.0.0", @@ -14850,7 +14850,7 @@ "string_decoder": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { "safe-buffer": "~5.1.0" @@ -14867,7 +14867,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, "requires": { "is-fullwidth-code-point": "^2.0.0", @@ -15409,7 +15409,7 @@ "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha1-bTQzWIl2jSGyvNoKonfO07G/rfk=", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, "requires": { "os-tmpdir": "~1.0.2" @@ -15573,7 +15573,7 @@ "type-is": { "version": "1.6.16", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha1-+JzjQVQcZysl7nrjxz3uOyvlAZQ=", + "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", "dev": true, "requires": { "media-typer": "0.3.0", @@ -15615,7 +15615,7 @@ "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha1-n+FTahCmZKZSZqHjzPhf02MCvJw=", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", "dev": true }, "unc-path-regex": { @@ -15777,13 +15777,13 @@ "upath": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha1-NSVll+RqWB20eT0M5H+prr/J+r0=", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", "dev": true }, "uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha1-lMVA4f93KVbiKZUHwBCupsiDjrA=", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", "dev": true, "requires": { "punycode": "^2.1.0" @@ -16218,7 +16218,7 @@ "ws": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha1-8c+E/i1ekB686U767OeF8YeiKPI=", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", "dev": true, "requires": { "async-limiter": "~1.0.0", From 49b2a9a080a390bf07a4c69e51b7cafffac2b176 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Thu, 24 Jan 2019 12:17:30 +0100 Subject: [PATCH 19/76] Fixes for search of members + Removed fixme in member that apparently are not necessary after tags refactoring --- src/Umbraco.Core/Cache/HttpRequestAppCache.cs | 2 +- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- .../Persistence/Repositories/Implement/DataTypeRepository.cs | 2 +- .../Persistence/Repositories/Implement/DocumentRepository.cs | 2 +- src/Umbraco.Web/PublishedContentExtensions.cs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/Cache/HttpRequestAppCache.cs b/src/Umbraco.Core/Cache/HttpRequestAppCache.cs index a255fea133..0fdf70ac27 100644 --- a/src/Umbraco.Core/Cache/HttpRequestAppCache.cs +++ b/src/Umbraco.Core/Cache/HttpRequestAppCache.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Cache ///
/// /// Will use HttpContext.Current. - /// fixme/task: use IHttpContextAccessor NOT HttpContext.Current + /// TODO - https://github.com/umbraco/Umbraco-CMS/issues/4239 - use IHttpContextAccessor NOT HttpContext.Current /// public HttpRequestAppCache() { } diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 7cb1a61cf1..bc5b6993e3 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -81,7 +81,7 @@ namespace Umbraco.Core.Configuration { try { - // fixme/task - stop having version in web.config appSettings + // TODO - https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"]; return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null; } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs index f4f0da8bee..0e6ff0310d 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { private readonly Lazy _editors; - // fixme/task - get rid of Lazy injection and fix circular dependencies + // TODO - https://github.com/umbraco/Umbraco-CMS/issues/4237 - get rid of Lazy injection and fix circular dependencies public DataTypeRepository(IScopeAccessor scopeAccessor, AppCaches cache, Lazy editors, ILogger logger) : base(scopeAccessor, cache, logger) { diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs index 344c0b9489..8bee55060b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs @@ -260,7 +260,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected override void PersistNewItem(IContent entity) { - // fixme/task - sort out IContent vs Content + // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4234 - sort out IContent vs Content // however, it's not just so we have access to AddingEntity // there are tons of things at the end of the methods, that can only work with a true Content // and basically, the repository requires a Content, not an IContent diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 231aa2a307..1284cf513d 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -954,7 +954,7 @@ namespace Umbraco.Web /// public static IEnumerable Children(this IPublishedContent content, string culture = null) { - if (content == null) throw new ArgumentNullException(nameof(content)); // fixme/task wtf is this? + if (content == null) throw new ArgumentNullException(nameof(content)); return content.Children.WhereIsInvariantOrHasCulture(culture); } From 31a6f2d67c40f78e6f65ff905f7a7b35d5ad4bd4 Mon Sep 17 00:00:00 2001 From: Stephan Date: Wed, 23 Jan 2019 21:22:49 +0100 Subject: [PATCH 20/76] Add runtime hooks for Deploy --- .../Migrations/Install/DatabaseBuilder.cs | 64 ++++++---- .../Persistence/UmbracoDatabaseFactory.cs | 8 +- src/Umbraco.Core/Runtime/CoreRuntime.cs | 10 +- src/Umbraco.Core/RuntimeOptions.cs | 114 ++++++++++++++++++ src/Umbraco.Core/RuntimeState.cs | 8 +- src/Umbraco.Core/RuntimeStateOptions.cs | 40 ------ src/Umbraco.Core/Umbraco.Core.csproj | 2 +- 7 files changed, 172 insertions(+), 74 deletions(-) create mode 100644 src/Umbraco.Core/RuntimeOptions.cs delete mode 100644 src/Umbraco.Core/RuntimeStateOptions.cs diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index 4104ce947c..e73fc7453f 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -283,48 +283,60 @@ namespace Umbraco.Core.Migrations.Install if (string.IsNullOrWhiteSpace(connectionString)) throw new ArgumentNullOrEmptyException(nameof(connectionString)); if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName)); - // set the connection string for the new datalayer - var connectionStringSettings = new ConnectionStringSettings(Constants.System.UmbracoConnectionName, connectionString, providerName); + var fileSource = "web.config"; + var fileName = IOHelper.MapPath(Path.Combine(SystemDirectories.Root, fileSource)); - var fileName = IOHelper.MapPath($"{SystemDirectories.Root}/web.config"); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); - if (xml.Root == null) throw new Exception("Invalid web.config file."); - var connectionStrings = xml.Root.DescendantsAndSelf("connectionStrings").FirstOrDefault(); - if (connectionStrings == null) throw new Exception("Invalid web.config file."); + if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root)."); - // honour configSource, if its set, change the xml file we are saving the configuration - // to the one set in the configSource attribute - if (connectionStrings.Attribute("configSource") != null) + var connectionStrings = xml.Root.DescendantsAndSelf("connectionStrings").FirstOrDefault(); + if (connectionStrings == null) throw new Exception($"Invalid {fileSource} file (no connection strings)."); + + // handle configSource + var configSourceAttribute = connectionStrings.Attribute("configSource"); + if (configSourceAttribute != null) { - var source = connectionStrings.Attribute("configSource").Value; - var configFile = IOHelper.MapPath($"{SystemDirectories.Root}/{source}"); - logger.Info("Storing ConnectionString in {ConfigFile}", configFile); - if (File.Exists(configFile)) - { - xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); - fileName = configFile; - } + fileSource = configSourceAttribute.Value; + fileName = IOHelper.MapPath(Path.Combine(SystemDirectories.Root, fileSource)); + + if (!File.Exists(fileName)) + throw new Exception($"Invalid configSource \"{fileSource}\" (no such file)."); + + xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); + if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root)."); + connectionStrings = xml.Root.DescendantsAndSelf("connectionStrings").FirstOrDefault(); - if (connectionStrings == null) throw new Exception("Invalid web.config file."); + if (connectionStrings == null) throw new Exception($"Invalid {fileSource} file (no connection strings)."); } - // update connectionString if it exists, or else create a new connectionString - var setting = connectionStrings.Descendants("add").FirstOrDefault(s => s.Attribute("name").Value == Constants.System.UmbracoConnectionName); + // create or update connection string + var setting = connectionStrings.Descendants("add").FirstOrDefault(s => s.Attribute("name")?.Value == Constants.System.UmbracoConnectionName); if (setting == null) { connectionStrings.Add(new XElement("add", new XAttribute("name", Constants.System.UmbracoConnectionName), - new XAttribute("connectionString", connectionStringSettings), + new XAttribute("connectionString", connectionString), new XAttribute("providerName", providerName))); } else { - setting.Attribute("connectionString").Value = connectionString; - setting.Attribute("providerName").Value = providerName; + AddOrUpdateAttribute(setting, "connectionString", connectionString); + AddOrUpdateAttribute(setting, "providerName", providerName); } + // save + logger.Info("Saving connection string to {ConfigFile}.", fileSource); xml.Save(fileName, SaveOptions.DisableFormatting); - logger.Info("Configured a new ConnectionString using the '{ProviderName}' provider.", providerName); + logger.Info("Saved connection string to {ConfigFile}.", fileSource); + } + + private static void AddOrUpdateAttribute(XElement element, string name, string value) + { + var attribute = element.Attribute(name); + if (attribute == null) + element.Add(new XAttribute(name, value)); + else + attribute.Value = value; } internal bool IsConnectionStringConfigured(ConnectionStringSettings databaseSettings) @@ -422,7 +434,7 @@ namespace Umbraco.Core.Migrations.Install _logger.Info("Database configuration status: Started"); var database = scope.Database; - + var message = string.Empty; var schemaResult = ValidateSchema(); @@ -482,7 +494,7 @@ namespace Umbraco.Core.Migrations.Install } _logger.Info("Database upgrade started"); - + // upgrade var upgrader = new UmbracoUpgrader(); upgrader.Execute(_scopeProvider, _migrationBuilder, _keyValueService, _logger, _postMigrations); diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs index cd6da569c5..aec49b8eb5 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs @@ -59,14 +59,18 @@ namespace Umbraco.Core.Persistence /// Used by the other ctor and in tests. public UmbracoDatabaseFactory(string connectionStringName, ILogger logger, Lazy mappers) { - if (string.IsNullOrWhiteSpace(connectionStringName)) throw new ArgumentNullOrEmptyException(nameof(connectionStringName)); + if (string.IsNullOrWhiteSpace(connectionStringName)) + throw new ArgumentNullOrEmptyException(nameof(connectionStringName)); _mappers = mappers ?? throw new ArgumentNullException(nameof(mappers)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); var settings = ConfigurationManager.ConnectionStrings[connectionStringName]; if (settings == null) + { + logger.Debug("Missing connection string, defer configuration."); return; // not configured + } // could as well be // so need to test the values too @@ -74,7 +78,7 @@ namespace Umbraco.Core.Persistence var providerName = settings.ProviderName; if (string.IsNullOrWhiteSpace(connectionString) || string.IsNullOrWhiteSpace(providerName)) { - logger.Debug("Missing connection string or provider name, defer configuration."); + logger.Debug("Empty connection string or provider name, defer configuration."); return; // not configured } diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs index 13e6aae149..793eb751dd 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntime.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs @@ -100,6 +100,9 @@ namespace Umbraco.Core.Runtime // throws if not full-trust new AspNetHostingPermission(AspNetHostingPermissionLevel.Unrestricted).Demand(); + // run handlers + RuntimeOptions.DoRuntimeBoot(ProfilingLogger); + // application caches var appCaches = GetAppCaches(); @@ -131,12 +134,17 @@ namespace Umbraco.Core.Runtime composition = new Composition(register, typeLoader, ProfilingLogger, _state, configs); composition.RegisterEssentials(Logger, Profiler, ProfilingLogger, mainDom, appCaches, databaseFactory, typeLoader, _state); + // run handlers + RuntimeOptions.DoRuntimeEssentials(composition, appCaches, typeLoader, databaseFactory); + // register runtime-level services // there should be none, really - this is here "just in case" Compose(composition); - // acquire the main domain, determine our runtime level + // acquire the main domain AcquireMainDom(mainDom); + + // determine our runtime level DetermineRuntimeLevel(databaseFactory, ProfilingLogger); // get composers, and compose diff --git a/src/Umbraco.Core/RuntimeOptions.cs b/src/Umbraco.Core/RuntimeOptions.cs new file mode 100644 index 0000000000..1f89ee6314 --- /dev/null +++ b/src/Umbraco.Core/RuntimeOptions.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Runtime.CompilerServices; +using Umbraco.Core.Cache; +using Umbraco.Core.Components; +using Umbraco.Core.Composing; +using Umbraco.Core.Logging; +using Umbraco.Core.Persistence; + +namespace Umbraco.Core +{ + /// + /// Provides static options for the runtime. + /// + /// + /// These options can be configured in PreApplicationStart or via appSettings. + /// + public static class RuntimeOptions + { + private static List> _onBoot; + private static List> _onEssentials; + private static bool? _installMissingDatabase; + private static bool? _installEmptyDatabase; + + // reads a boolean appSetting + private static bool BoolSetting(string key, bool missing) => ConfigurationManager.AppSettings[key]?.InvariantEquals("true") ?? missing; + + /// + /// Gets a value indicating whether the runtime should enter Install level when the database is missing. + /// + /// + /// By default, when a database connection string is configured but it is not possible to + /// connect to the database, the runtime enters the BootFailed level. If this options is set to true, + /// it enters the Install level instead. + /// It is then up to the implementor, that is setting this value, to take over the installation + /// sequence. + /// + public static bool InstallMissingDatabase + { + get => _installEmptyDatabase ?? BoolSetting("Umbraco.Core.RuntimeState.InstallMissingDatabase", false); + set => _installEmptyDatabase = value; + } + + /// + /// Gets a value indicating whether the runtime should enter Install level when the database is empty. + /// + /// + /// By default, when a database connection string is configured and it is possible to connect to + /// the database, but the database is empty, the runtime enters the BootFailed level. If this options + /// is set to true, it enters the Install level instead. + /// It is then up to the implementor, that is setting this value, to take over the installation + /// sequence. + /// + public static bool InstallEmptyDatabase + { + get => _installMissingDatabase ?? BoolSetting("Umbraco.Core.RuntimeState.InstallEmptyDatabase", false); + set => _installMissingDatabase = value; + } + + /// + /// Executes the RuntimeBoot handlers. + /// + internal static void DoRuntimeBoot(IProfilingLogger logger) + { + if (_onBoot == null) + return; + + foreach (var action in _onBoot) + action(logger); + } + + /// + /// Executes the RuntimeEssentials handlers. + /// + internal static void DoRuntimeEssentials(Composition composition, AppCaches appCaches, TypeLoader typeLoader, IUmbracoDatabaseFactory databaseFactory) + { + if (_onEssentials== null) + return; + + foreach (var action in _onEssentials) + action(composition, appCaches, typeLoader, databaseFactory); + } + + /// + /// Registers a RuntimeBoot handler. + /// + /// + /// A RuntimeBoot handler runs when the runtime boots, right after the + /// loggers have been created, but before anything else. + /// + public static void OnRuntimeBoot(Action action) + { + if (_onBoot == null) + _onBoot = new List>(); + _onBoot.Add(action); + } + + /// + /// Registers a RuntimeEssentials handler. + /// + /// + /// A RuntimeEssentials handler runs after the runtime has created a few + /// essential things (AppCaches, a TypeLoader, and a database factory) but + /// before anything else. + /// + public static void OnRuntimeEssentials(Action action) + { + if (_onEssentials == null) + _onEssentials = new List>(); + _onEssentials.Add(action); + } + } +} diff --git a/src/Umbraco.Core/RuntimeState.cs b/src/Umbraco.Core/RuntimeState.cs index 85e8c7370d..b21c02fdb9 100644 --- a/src/Umbraco.Core/RuntimeState.cs +++ b/src/Umbraco.Core/RuntimeState.cs @@ -169,7 +169,7 @@ namespace Umbraco.Core else if (databaseFactory.Configured == false) { // local version *does* match code version, but the database is not configured - // install (again? this is a weird situation...) + // install - may happen with Deploy/Cloud/etc logger.Debug("Database is not configured, need to install Umbraco."); Level = RuntimeLevel.Install; Reason = RuntimeLevelReason.InstallNoDatabase; @@ -179,7 +179,7 @@ namespace Umbraco.Core // else, keep going, // anything other than install wants a database - see if we can connect // (since this is an already existing database, assume localdb is ready) - var tries = RuntimeStateOptions.InstallMissingDatabase ? 2 : 5; + var tries = RuntimeOptions.InstallMissingDatabase ? 2 : 5; for (var i = 0;;) { connect = databaseFactory.CanConnect; @@ -193,7 +193,7 @@ namespace Umbraco.Core // cannot connect to configured database, this is bad, fail logger.Debug("Could not connect to database."); - if (RuntimeStateOptions.InstallMissingDatabase) + if (RuntimeOptions.InstallMissingDatabase) { // ok to install on a configured but missing database Level = RuntimeLevel.Install; @@ -222,7 +222,7 @@ namespace Umbraco.Core // can connect to the database but cannot check the upgrade state... oops logger.Warn(e, "Could not check the upgrade state."); - if (RuntimeStateOptions.InstallEmptyDatabase) + if (RuntimeOptions.InstallEmptyDatabase) { // ok to install on an empty database Level = RuntimeLevel.Install; diff --git a/src/Umbraco.Core/RuntimeStateOptions.cs b/src/Umbraco.Core/RuntimeStateOptions.cs deleted file mode 100644 index 9262a8a990..0000000000 --- a/src/Umbraco.Core/RuntimeStateOptions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Configuration; - -namespace Umbraco.Core -{ - /// - /// Allows configuration of the in PreApplicationStart or in appSettings - /// - public static class RuntimeStateOptions - { - // configured statically or via app settings - private static bool BoolSetting(string key, bool missing) => ConfigurationManager.AppSettings[key]?.InvariantEquals("true") ?? missing; - - /// - /// If true the RuntimeState will continue the installation sequence when a database is missing - /// - /// - /// In this case it will be up to the implementor that is setting this value to true to take over the bootup/installation sequence - /// - public static bool InstallMissingDatabase - { - get => _installEmptyDatabase ?? BoolSetting("Umbraco.Core.RuntimeState.InstallMissingDatabase", false); - set => _installEmptyDatabase = value; - } - - /// - /// If true the RuntimeState will continue the installation sequence when a database is available but is empty - /// - /// - /// In this case it will be up to the implementor that is setting this value to true to take over the bootup/installation sequence - /// - public static bool InstallEmptyDatabase - { - get => _installMissingDatabase ?? BoolSetting("Umbraco.Core.RuntimeState.InstallEmptyDatabase", false); - set => _installMissingDatabase = value; - } - - private static bool? _installMissingDatabase; - private static bool? _installEmptyDatabase; - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 9a52cb8dc5..1a978650f0 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -530,7 +530,7 @@ - + From a6d3078638972f1a175bb14af8c5b9e117b7b387 Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 24 Jan 2019 13:54:54 +0100 Subject: [PATCH 21/76] Improve CoreRuntime handling of boot fails --- src/Umbraco.Core/Runtime/CoreRuntime.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Runtime/CoreRuntime.cs b/src/Umbraco.Core/Runtime/CoreRuntime.cs index 793eb751dd..9c18b3d8c3 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntime.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntime.cs @@ -296,7 +296,7 @@ namespace Umbraco.Core.Runtime /// public virtual void Terminate() { - _components.Terminate(); + _components?.Terminate(); } /// From 38ec97bbe34f2408a40ef9f70e35d4baf79f739d Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 24 Jan 2019 15:22:20 +0100 Subject: [PATCH 22/76] Need to refactor IsPublished --- .../Models/PublishedContent/IPublishedContent.cs | 11 +++++++++-- .../PublishedContent/PublishedContentWrapped.cs | 1 - src/Umbraco.Web/Models/PublishedContentBase.cs | 1 + .../PublishedCache/NuCache/PublishedContent.cs | 5 +++-- .../XmlPublishedCache/XmlPublishedContent.cs | 4 ++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs index e50fb2c396..f613f926e9 100644 --- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs +++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs @@ -156,10 +156,17 @@ namespace Umbraco.Core.Models.PublishedContent /// /// Gets a value indicating whether the content is published. /// - /// + /// + /// A content is published when it has a published version. + /// When retrieving documents from cache in non-preview mode, IsPublished is always + /// true, as only published documents are returned. When retrieving in draft mode, IsPublished + /// can either be true (document has a published version) or false (document has no + /// published version). + /// It is therefore possible for both IsDraft and IsPublished to be true at the same + /// time, meaning that the content is the draft version, and a published version exists. + /// bool IsPublished(string culture = null); - #endregion #region Tree diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs index 42ff16bae5..8bf8cec244 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentWrapped.cs @@ -114,7 +114,6 @@ namespace Umbraco.Core.Models.PublishedContent /// public virtual bool IsPublished(string culture = null) => _content.IsPublished(culture); - #endregion #region Tree diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs index 12acb6b0c8..45243b86e6 100644 --- a/src/Umbraco.Web/Models/PublishedContentBase.cs +++ b/src/Umbraco.Web/Models/PublishedContentBase.cs @@ -144,6 +144,7 @@ namespace Umbraco.Web.Models /// public abstract bool IsDraft(string culture = null); + /// public abstract bool IsPublished(string culture = null); #endregion diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index 69c672ab98..3f57bf3340 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -293,8 +293,11 @@ namespace Umbraco.Web.PublishedCache.NuCache return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && cvar.IsDraft; } + /// public override bool IsPublished(string culture = null) { + // fixme I don't understand this - and it does probably not do what's expected + if (!ContentType.VariesByCulture()) { return _contentData.Published; @@ -302,9 +305,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // handle context culture if (culture == null) - { culture = VariationContextAccessor?.VariationContext?.Culture ?? ""; - } //If the current culture is not a draft, it must be the published version return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && !cvar.IsDraft; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index c3cf22559d..f601114ffd 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -232,7 +232,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache public override bool IsPublished(string culture = null) { EnsureNodeInitialized(); - return _isPublished; + return _isPublished; // bah } public override IEnumerable Properties @@ -309,7 +309,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache name = writerName = urlName = creatorName = docTypeAlias = path = null; createDate = updateDate = default(DateTime); isDraft = false; - isPublished = false; + isPublished = false; // fixme not implemented? contentType = null; properties = null; From e4c644e745165d7f13d1a3a294c876dfdf3720bb Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 24 Jan 2019 15:29:50 +0100 Subject: [PATCH 23/76] Consistent PublishedContentExtensions, culture always optional --- src/Umbraco.Web/PublishedContentExtensions.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index 1284cf513d..c57d0249c1 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -749,9 +749,9 @@ namespace Umbraco.Web /// /// This can be useful in order to return all nodes in an entire site by a type when combined with TypedContentAtRoot /// - public static IEnumerable DescendantsOrSelf(this IEnumerable parentNodes, string docTypeAlias, string culture = null) + public static IEnumerable DescendantsOrSelfOfType(this IEnumerable parentNodes, string docTypeAlias, string culture = null) { - return parentNodes.SelectMany(x => x.DescendantsOrSelf(docTypeAlias, culture)); + return parentNodes.SelectMany(x => x.DescendantsOrSelfOfType(docTypeAlias, culture)); } /// @@ -799,7 +799,7 @@ namespace Umbraco.Web return content.DescendantsOrSelf(false, p => p.Level >= level, culture); } - public static IEnumerable Descendants(this IPublishedContent content, string contentTypeAlias, string culture) + public static IEnumerable DescendantsOfType(this IPublishedContent content, string contentTypeAlias, string culture = null) { return content.DescendantsOrSelf(false, p => p.ContentType.Alias == contentTypeAlias, culture); } @@ -826,7 +826,7 @@ namespace Umbraco.Web return content.DescendantsOrSelf(true, p => p.Level >= level, culture); } - public static IEnumerable DescendantsOrSelf(this IPublishedContent content, string contentTypeAlias, string culture) + public static IEnumerable DescendantsOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null) { return content.DescendantsOrSelf(true, p => p.ContentType.Alias == contentTypeAlias, culture); } @@ -853,7 +853,7 @@ namespace Umbraco.Web return content.EnumerateDescendants(false, culture).FirstOrDefault(x => x.Level == level); } - public static IPublishedContent Descendant(this IPublishedContent content, string contentTypeAlias, string culture) + public static IPublishedContent DescendantOfType(this IPublishedContent content, string contentTypeAlias, string culture = null) { return content.EnumerateDescendants(false, culture).FirstOrDefault(x => x.ContentType.Alias == contentTypeAlias); } @@ -880,7 +880,7 @@ namespace Umbraco.Web return content.EnumerateDescendants(true, culture).FirstOrDefault(x => x.Level == level); } - public static IPublishedContent DescendantOrSelf(this IPublishedContent content, string contentTypeAlias, string culture) + public static IPublishedContent DescendantOrSelfOfType(this IPublishedContent content, string contentTypeAlias, string culture = null) { return content.EnumerateDescendants(true, culture).FirstOrDefault(x => x.ContentType.Alias == contentTypeAlias); } @@ -1010,7 +1010,7 @@ namespace Umbraco.Web /// /// Gets the first child of the content, of a given content type. /// - public static IPublishedContent FirstChild(this IPublishedContent content, string alias, string culture) + public static IPublishedContent FirstChildOfType(this IPublishedContent content, string alias, string culture = null) { return content.Children(culture,alias).FirstOrDefault(); } From 3e69ceb4871769682cea28089733022d0dd76083 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Thu, 24 Jan 2019 15:52:56 +0000 Subject: [PATCH 24/76] Remove dashboard from web.config --- src/Umbraco.Web.UI/web.Template.config | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index 2371282a14..e7399f600b 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -14,7 +14,6 @@
-
@@ -28,7 +27,6 @@ - From 0ffa4702bad8ae8ae1b196053b3aed0fc01f9c7b Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 24 Jan 2019 18:26:08 +0100 Subject: [PATCH 25/76] Bugfix install --- src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs index e73fc7453f..9c6ff208f8 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseBuilder.cs @@ -284,7 +284,7 @@ namespace Umbraco.Core.Migrations.Install if (string.IsNullOrWhiteSpace(providerName)) throw new ArgumentNullOrEmptyException(nameof(providerName)); var fileSource = "web.config"; - var fileName = IOHelper.MapPath(Path.Combine(SystemDirectories.Root, fileSource)); + var fileName = IOHelper.MapPath(SystemDirectories.Root +"/" + fileSource); var xml = XDocument.Load(fileName, LoadOptions.PreserveWhitespace); if (xml.Root == null) throw new Exception($"Invalid {fileSource} file (no root)."); @@ -297,7 +297,7 @@ namespace Umbraco.Core.Migrations.Install if (configSourceAttribute != null) { fileSource = configSourceAttribute.Value; - fileName = IOHelper.MapPath(Path.Combine(SystemDirectories.Root, fileSource)); + fileName = IOHelper.MapPath(SystemDirectories.Root + "/" + fileSource); if (!File.Exists(fileName)) throw new Exception($"Invalid configSource \"{fileSource}\" (no such file)."); From d25739601372e3bf1f8855904747b976820dd576 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 08:21:43 +0000 Subject: [PATCH 26/76] =?UTF-8?q?Missing=20Serilog.Formatting.Compact.Read?= =?UTF-8?q?er=20from=20Nuspec=20for=20the=20Logviewer=20stuff-=20thanks=20?= =?UTF-8?q?Twitter=20for=20the=20heads=20up=20=F0=9F=91=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/NuSpecs/UmbracoCms.Core.nuspec | 1 + 1 file changed, 1 insertion(+) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 8826705157..9e6e375745 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -35,6 +35,7 @@ + From 5f80faa7256534390c0c60241871c6a6ee21e1e9 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 09:52:18 +0100 Subject: [PATCH 27/76] Review fix suggestions for dashboards. --- src/Umbraco.Core/Dashboards/IAccessRule.cs | 5 +- .../Dashboards/IDashboardSection.cs | 12 +- ...gnoreDataMemberWhenSerializingAttribute.cs | 15 + src/Umbraco.Core/Manifest/ManifestParser.cs | 374 +++++++++--------- src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../Dashboards/ContentDashboard.cs | 23 +- .../Dashboards/DashboardCollectionBuilder.cs | 30 +- .../Dashboards/ExamineDashboard.cs | 9 +- src/Umbraco.Web/Dashboards/FormsDashboard.cs | 9 +- .../Dashboards/HealthCheckDashboard.cs | 9 +- src/Umbraco.Web/Dashboards/MediaDashboard.cs | 9 +- .../Dashboards/MembersDashboard.cs | 9 +- .../Dashboards/ModelsBuilderDashboard.cs | 9 +- .../Dashboards/PublishedStatusDashboard.cs | 9 +- .../Dashboards/RedirectUrlDashboard.cs | 9 +- .../Dashboards/SettingsDashboards.cs | 9 +- .../Editors/DashboardController.cs | 2 + src/Umbraco.Web/Services/DashboardService.cs | 19 +- src/Umbraco.Web/Umbraco.Web.csproj | 1 + ...taMemberWhenSerializingContractResolver.cs | 31 ++ .../WebApi/JsonCamelCaseFormatter.cs | 3 +- 21 files changed, 310 insertions(+), 287 deletions(-) create mode 100644 src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs create mode 100644 src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs diff --git a/src/Umbraco.Core/Dashboards/IAccessRule.cs b/src/Umbraco.Core/Dashboards/IAccessRule.cs index f44a846248..e3ac583379 100644 --- a/src/Umbraco.Core/Dashboards/IAccessRule.cs +++ b/src/Umbraco.Core/Dashboards/IAccessRule.cs @@ -1,4 +1,7 @@ -namespace Umbraco.Core.Dashboards +using Newtonsoft.Json; +using Umbraco.Core.Manifest; + +namespace Umbraco.Core.Dashboards { /// /// Represents an access rule. diff --git a/src/Umbraco.Core/Dashboards/IDashboardSection.cs b/src/Umbraco.Core/Dashboards/IDashboardSection.cs index 90d351bcd2..7b5963c9f5 100644 --- a/src/Umbraco.Core/Dashboards/IDashboardSection.cs +++ b/src/Umbraco.Core/Dashboards/IDashboardSection.cs @@ -1,30 +1,40 @@ -namespace Umbraco.Core.Dashboards +using System.Runtime.Serialization; +using Umbraco.Core.Manifest; + +namespace Umbraco.Core.Dashboards { public interface IDashboardSection { /// /// Display name of the dashboard tab /// + [DataMember(Name="name")] string Name { get; } /// /// Alias to refer to this dashboard via code /// + [DataMember(Name = "alias")] string Alias { get; } /// /// A collection of sections/application aliases that this dashboard will appear on /// + [DataMember(Name = "sections")] + [IgnoreDataMemberWhenSerializing] string[] Sections { get; } /// /// The HTML view to load for the dashboard /// + [DataMember(Name = "view")] string View { get; } /// /// Dashboards can be shown/hidden based on access rights /// + [DataMember(Name = "access")] + [IgnoreDataMemberWhenSerializing] IAccessRule[] AccessRules { get; } } } diff --git a/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs b/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs new file mode 100644 index 0000000000..8486e1b6a9 --- /dev/null +++ b/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs @@ -0,0 +1,15 @@ +using System; +using System.Runtime.Serialization; + +namespace Umbraco.Core.Manifest +{ + /// + /// When applied to the member of a type, specifies that the member is not part of a data contract when + /// serialized but still when deserialized as opposite to . + /// + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] + public class IgnoreDataMemberWhenSerializingAttribute : Attribute + { + + } +} diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 01bc0b1983..674449c4f0 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -1,184 +1,190 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Umbraco.Core.Cache; -using Umbraco.Core.Exceptions; -using Umbraco.Core.IO; -using Umbraco.Core.Logging; -using Umbraco.Core.Models.ContentEditing; -using Umbraco.Core.Models.Trees; -using Umbraco.Core.PropertyEditors; - -namespace Umbraco.Core.Manifest -{ - /// - /// Parses the Main.js file and replaces all tokens accordingly. - /// - public class ManifestParser - { - private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); - - private readonly IAppPolicyCache _cache; - private readonly ILogger _logger; - private readonly ManifestValueValidatorCollection _validators; - - private string _path; - - /// - /// Initializes a new instance of the class. - /// - public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger) - : this(appCaches, validators, "~/App_Plugins", logger) - { } - - /// - /// Initializes a new instance of the class. - /// - private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger) - { - if (appCaches == null) throw new ArgumentNullException(nameof(appCaches)); - _cache = appCaches.RuntimeCache; - _validators = validators ?? throw new ArgumentNullException(nameof(validators)); - if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path)); - Path = path; - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - } - - public string Path - { - get => _path; - set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value; - } - - /// - /// Gets all manifests, merged into a single manifest object. - /// - /// - public PackageManifest Manifest - => _cache.GetCacheItem("Umbraco.Core.Manifest.ManifestParser::Manifests", () => - { - var manifests = GetManifests(); - return MergeManifests(manifests); - }, new TimeSpan(0, 4, 0)); - - /// - /// Gets all manifests. - /// - private IEnumerable GetManifests() - { - var manifests = new List(); - - foreach (var path in GetManifestFiles()) - { - try - { - var text = File.ReadAllText(path); - text = TrimPreamble(text); - if (string.IsNullOrWhiteSpace(text)) - continue; - var manifest = ParseManifest(text); - manifests.Add(manifest); - } - catch (Exception e) - { - _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); - } - } - - return manifests; - } - - /// - /// Merges all manifests into one. - /// - private static PackageManifest MergeManifests(IEnumerable manifests) - { - var scripts = new HashSet(); - var stylesheets = new HashSet(); - var propertyEditors = new List(); - var parameterEditors = new List(); - var gridEditors = new List(); - var contentApps = new List(); - var dashboards = new List(); - var sections = new List(); - - foreach (var manifest in manifests) - { - if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script); - if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet); - if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors); - if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors); - if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors); - if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps); - if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards); - if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant())); - } - - return new PackageManifest - { - Scripts = scripts.ToArray(), - Stylesheets = stylesheets.ToArray(), - PropertyEditors = propertyEditors.ToArray(), - ParameterEditors = parameterEditors.ToArray(), - GridEditors = gridEditors.ToArray(), - ContentApps = contentApps.ToArray(), - Dashboards = dashboards.ToArray(), - Sections = sections.ToArray() - }; - } - - // gets all manifest files (recursively) - private IEnumerable GetManifestFiles() - { - if (Directory.Exists(_path) == false) - return new string[0]; - return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories); - } - - private static string TrimPreamble(string text) - { - // strangely StartsWith(preamble) would always return true - if (text.Substring(0, 1) == Utf8Preamble) - text = text.Remove(0, Utf8Preamble.Length); - - return text; - } - - /// - /// Parses a manifest. - /// - internal PackageManifest ParseManifest(string text) - { - if (string.IsNullOrWhiteSpace(text)) - throw new ArgumentNullOrEmptyException(nameof(text)); - - var manifest = JsonConvert.DeserializeObject(text, - new DataEditorConverter(_logger), - new ValueValidatorConverter(_validators), - new DashboardAccessRuleConverter()); - - // scripts and stylesheets are raw string, must process here - for (var i = 0; i < manifest.Scripts.Length; i++) - manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]); - for (var i = 0; i < manifest.Stylesheets.Length; i++) - manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]); - - // add property editors that are also parameter editors, to the parameter editors list - // (the manifest format is kinda legacy) - var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList(); - if (ppEditors.Count > 0) - manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray(); - - return manifest; - } - - // purely for tests - internal IEnumerable ParseGridEditors(string text) - { - return JsonConvert.DeserializeObject>(text); - } - } -} +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Umbraco.Core.Cache; +using Umbraco.Core.Exceptions; +using Umbraco.Core.IO; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.ContentEditing; +using Umbraco.Core.Models.Trees; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Core.Manifest +{ + /// + /// Parses the Main.js file and replaces all tokens accordingly. + /// + public class ManifestParser + { + private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); + + private readonly IAppPolicyCache _cache; + private readonly ILogger _logger; + private readonly ManifestValueValidatorCollection _validators; + + private string _path; + + /// + /// Initializes a new instance of the class. + /// + public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger) + : this(appCaches, validators, "~/App_Plugins", logger) + { } + + /// + /// Initializes a new instance of the class. + /// + private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger) + { + if (appCaches == null) throw new ArgumentNullException(nameof(appCaches)); + _cache = appCaches.RuntimeCache; + _validators = validators ?? throw new ArgumentNullException(nameof(validators)); + if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path)); + Path = path; + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + } + + public string Path + { + get => _path; + set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value; + } + + /// + /// Gets all manifests, merged into a single manifest object. + /// + /// + public PackageManifest Manifest + => _cache.GetCacheItem("Umbraco.Core.Manifest.ManifestParser::Manifests", () => + { + var manifests = GetManifests(); + return MergeManifests(manifests); + }, new TimeSpan(0, 4, 0)); + + /// + /// Gets all manifests. + /// + private IEnumerable GetManifests() + { + var manifests = new List(); + + foreach (var path in GetManifestFiles()) + { + try + { + var text = File.ReadAllText(path); + text = TrimPreamble(text); + if (string.IsNullOrWhiteSpace(text)) + continue; + var manifest = ParseManifest(text); + manifests.Add(manifest); + } + catch (Exception e) + { + _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); + } + } + + return manifests; + } + + /// + /// Merges all manifests into one. + /// + private static PackageManifest MergeManifests(IEnumerable manifests) + { + var scripts = new HashSet(); + var stylesheets = new HashSet(); + var propertyEditors = new List(); + var parameterEditors = new List(); + var gridEditors = new List(); + var contentApps = new List(); + var dashboards = new List(); + var sections = new List(); + + foreach (var manifest in manifests) + { + if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script); + if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet); + if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors); + if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors); + if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors); + if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps); + if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards); + if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant())); + } + + return new PackageManifest + { + Scripts = scripts.ToArray(), + Stylesheets = stylesheets.ToArray(), + PropertyEditors = propertyEditors.ToArray(), + ParameterEditors = parameterEditors.ToArray(), + GridEditors = gridEditors.ToArray(), + ContentApps = contentApps.ToArray(), + Dashboards = dashboards.ToArray(), + Sections = sections.ToArray() + }; + } + + // gets all manifest files (recursively) + private IEnumerable GetManifestFiles() + { + if (Directory.Exists(_path) == false) + return new string[0]; + return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories); + } + + private static string TrimPreamble(string text) + { + // strangely StartsWith(preamble) would always return true + if (text.Substring(0, 1) == Utf8Preamble) + text = text.Remove(0, Utf8Preamble.Length); + + return text; + } + + /// + /// Parses a manifest. + /// + internal PackageManifest ParseManifest(string text) + { + if (string.IsNullOrWhiteSpace(text)) + throw new ArgumentNullOrEmptyException(nameof(text)); + + var manifest = JsonConvert.DeserializeObject(text, new JsonSerializerSettings() + { + Converters = new JsonConverter[] + { + new DataEditorConverter(_logger), + new ValueValidatorConverter(_validators), + new DashboardAccessRuleConverter() + }, + } + ); + + // scripts and stylesheets are raw string, must process here + for (var i = 0; i < manifest.Scripts.Length; i++) + manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]); + for (var i = 0; i < manifest.Stylesheets.Length; i++) + manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]); + + // add property editors that are also parameter editors, to the parameter editors list + // (the manifest format is kinda legacy) + var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList(); + if (ppEditors.Count > 0) + manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray(); + + return manifest; + } + + // purely for tests + internal IEnumerable ParseGridEditors(string text) + { + return JsonConvert.DeserializeObject>(text); + } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 1f6141d834..ebd0e2735b 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -354,6 +354,7 @@ + diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index c184e593aa..6a41b07c2c 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -1,37 +1,30 @@ -using System.Collections.Generic; -using System.Runtime.Serialization; +using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - //[HideFromTypeFinder] - [DataContract] public class ContentDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Get Started"; - [DataMember(Name = "alias")] public string Alias => "contentIntro"; - [IgnoreDataMember] - public string[] Sections => new string[] { "content" }; + public string[] Sections => new [] { "content" }; - [DataMember(Name = "view")] public string View => "views/dashboard/default/startupdashboardintro.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules { get { - //TODO: WB Not convinced these rules work correctly?! - var rules = new List(); - rules.Add(new AccessRule { Type = AccessRuleType.Deny, Value = "translator" }); - rules.Add(new AccessRule { Type = AccessRuleType.Grant, Value = "admin" }); - return rules.ToArray(); + var rules = new IAccessRule[] + { + new AccessRule {Type = AccessRuleType.Deny, Value = Constants.Security.TranslatorGroupAlias}, + new AccessRule {Type = AccessRuleType.Grant, Value = Constants.Security.AdminGroupAlias} + }; + return rules; } } } diff --git a/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs index d4a89a61b2..336625c415 100644 --- a/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs +++ b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Dashboards { public class DashboardCollectionBuilder : WeightedCollectionBuilderBase { - protected override DashboardCollectionBuilder This => this; + protected override DashboardCollectionBuilder This => this; protected override IEnumerable CreateItems(IFactory factory) { @@ -17,8 +17,32 @@ namespace Umbraco.Web.Dashboards // its dependencies too, and that can create cycles or other oddities var manifestParser = factory.GetInstance(); - //TODO WB: We will need to re-sort items from package manifest with the C# Types - return base.CreateItems(factory).Concat(manifestParser.Manifest.Dashboards); + var dashboardSections = Merge(base.CreateItems(factory).ToArray(), manifestParser.Manifest.Dashboards); + + return dashboardSections; + } + + private IEnumerable Merge(IReadOnlyList dashboardsFromCode, IReadOnlyList dashboardFromManifest) + { + var list = dashboardsFromCode.Concat(dashboardFromManifest) + .Where(x=>!string.IsNullOrEmpty(x.Alias)) + .Select(x => (Weight: GetWeight(x), DashboardSection: x)) + .OrderBy(x=>x.Weight); + + return list.Select(x => x.DashboardSection); + } + + private static int GetWeight(IDashboardSection dashboardSection) + { + switch (dashboardSection) + { + case ManifestDashboardDefinition danifestDashboardDefinition: + return danifestDashboardDefinition.Weight; + default: + var weightAttribute = dashboardSection.GetType().GetCustomAttributes(typeof(WeightAttribute), false) + .Cast().FirstOrDefault(); + return weightAttribute.Weight; + } } } } diff --git a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs index 5f04a4b78d..e686545b51 100644 --- a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(20)] - [DataContract] public class ExamineDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Examine Management"; - [DataMember(Name = "alias")] public string Alias => "settingsExamine"; - [IgnoreDataMember] - public string[] Sections => new string[] { "settings" }; + public string[] Sections => new [] { "settings" }; - [DataMember(Name = "view")] public string View => "views/dashboard/settings/examinemanagement.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs index c9e8e06b7d..3592c88d13 100644 --- a/src/Umbraco.Web/Dashboards/FormsDashboard.cs +++ b/src/Umbraco.Web/Dashboards/FormsDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - [DataContract] public class FormsDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Install Umbraco Forms"; - [DataMember(Name = "alias")] public string Alias => "formsInstall"; - [IgnoreDataMember] - public string[] Sections => new string[] { "forms" }; + public string[] Sections => new [] { "forms" }; - [DataMember(Name = "view")] public string View => "views/dashboard/forms/formsdashboardintro.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } } diff --git a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs index 808dc099e8..b7373a6d44 100644 --- a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs +++ b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(50)] - [DataContract] public class HealthCheckDashboard : IDashboardSection { - [DataMember(Name="name")] public string Name => "Health Check"; - [DataMember(Name = "alias")] public string Alias => "settingsHealthCheck"; - [IgnoreDataMember] - public string[] Sections => new string[] { "settings" }; + public string[] Sections => new [] { "settings" }; - [DataMember(Name = "view")] public string View => "views/dashboard/settings/healthcheck.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } diff --git a/src/Umbraco.Web/Dashboards/MediaDashboard.cs b/src/Umbraco.Web/Dashboards/MediaDashboard.cs index c122ba1f7f..c72046388e 100644 --- a/src/Umbraco.Web/Dashboards/MediaDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MediaDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - [DataContract] public class MediaDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Content"; - [DataMember(Name = "alias")] public string Alias => "mediaFolderBrowser"; - [IgnoreDataMember] - public string[] Sections => new string[] { "media" }; + public string[] Sections => new [] { "media" }; - [DataMember(Name = "view")] public string View => "views/dashboard/media/mediafolderbrowser.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } } diff --git a/src/Umbraco.Web/Dashboards/MembersDashboard.cs b/src/Umbraco.Web/Dashboards/MembersDashboard.cs index 9da6f59108..44aa6c4de6 100644 --- a/src/Umbraco.Web/Dashboards/MembersDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MembersDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - [DataContract] public class MembersDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Get Started"; - [DataMember(Name = "alias")] public string Alias => "memberIntro"; - [IgnoreDataMember] - public string[] Sections => new string[] { "member" }; + public string[] Sections => new [] { "member" }; - [DataMember(Name = "view")] public string View => "views/dashboard/members/membersdashboardvideos.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } } diff --git a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs index f25a9f7ea0..431e129840 100644 --- a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(40)] - [DataContract] public class ModelsBuilderDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Models Builder"; - [DataMember(Name = "alias")] public string Alias => "settingsModelsBuilder"; - [IgnoreDataMember] - public string[] Sections => new string[] { "settings" }; + public string[] Sections => new [] { "settings" }; - [DataMember(Name = "view")] public string View => "/App_Plugins/ModelsBuilder/modelsbuilder.htm"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } diff --git a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs index d2fa5b217b..5feca94324 100644 --- a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs +++ b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(30)] - [DataContract] public class PublishedStatusDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Published Status"; - [DataMember(Name = "alias")] public string Alias => "settingsPublishedStatus"; - [IgnoreDataMember] - public string[] Sections => new string[] { "settings" }; + public string[] Sections => new [] { "settings" }; - [DataMember(Name = "view")] public string View => "views/dashboard/settings/publishedstatus.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } diff --git a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs index 731d259d39..748db64658 100644 --- a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs +++ b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(20)] - [DataContract] public class RedirectUrlDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Redirect URL Management"; - [DataMember(Name = "alias")] public string Alias => "contentRedirectManager"; - [IgnoreDataMember] - public string[] Sections => new string[] { "content" }; + public string[] Sections => new [] { "content" }; - [DataMember(Name = "view")] public string View => "views/dashboard/content/redirecturls.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } } diff --git a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs index 47c1723075..b5ab56c319 100644 --- a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs +++ b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs @@ -1,27 +1,20 @@ using System; -using System.Runtime.Serialization; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - [DataContract] public class SettingsDashboard : IDashboardSection { - [DataMember(Name = "name")] public string Name => "Welcome"; - [DataMember(Name = "alias")] public string Alias => "settingsWelcome"; - [IgnoreDataMember] - public string[] Sections => new string[] { "settings" }; + public string[] Sections => new [] { "settings" }; - [DataMember(Name = "view")] public string View => "views/dashboard/settings/settingsdashboardintro.html"; - [IgnoreDataMember] public IAccessRule[] AccessRules => Array.Empty(); } } diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index 11d31a86b4..00635d852f 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -27,6 +27,8 @@ namespace Umbraco.Web.Editors [AngularJsonOnlyConfiguration] [IsBackOffice] [WebApi.UmbracoAuthorize] + [JsonCamelCaseFormatter] + public class DashboardController : UmbracoApiController { private readonly IDashboardService _dashboardService; diff --git a/src/Umbraco.Web/Services/DashboardService.cs b/src/Umbraco.Web/Services/DashboardService.cs index 9f70f876a3..89f241252f 100644 --- a/src/Umbraco.Web/Services/DashboardService.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.Services _dashboardCollection = dashboardCollection ?? throw new ArgumentNullException(nameof(dashboardCollection)); } - + /// public IEnumerable> GetDashboards(string section, IUser currentUser) { @@ -32,20 +32,19 @@ namespace Umbraco.Web.Services // validate access if (!CheckUserAccessByRules(currentUser, _sectionService, dashboard.AccessRules)) continue; - + if (dashboard.View.InvariantEndsWith(".ascx")) throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); - var dashboards = new List(); - dashboards.Add(dashboard); + var dashboards = new List {dashboard}; - tabs.Add(new Tab() + tabs.Add(new Tab { Id = tabId++, Label = dashboard.Name, Alias = dashboard.Alias, Properties = dashboards - }); + }); } return tabs; @@ -56,7 +55,7 @@ namespace Umbraco.Web.Services { return _sectionService.GetSections().ToDictionary(x => x.Alias, x => GetDashboards(x.Alias, currentUser)); } - + private bool CheckUserAccessByRules(IUser user, ISectionService sectionService, IEnumerable rules) { if (user.Id == Constants.Security.SuperUserId) @@ -97,7 +96,7 @@ namespace Umbraco.Web.Services } if (!hasAccess || denyRules.Length == 0) - return false; + return true; // check if this item has any deny arguments, if so check if the user is in one of the denied user groups, if so they will // be denied to see it no matter what @@ -110,7 +109,7 @@ namespace Umbraco.Web.Services return hasAccess; } - private (IAccessRule[], IAccessRule[], IAccessRule[]) GroupRules(IEnumerable rules) + private static (IAccessRule[], IAccessRule[], IAccessRule[]) GroupRules(IEnumerable rules) { IAccessRule[] denyRules = null, grantRules = null, grantBySectionRules = null; @@ -130,7 +129,7 @@ namespace Umbraco.Web.Services grantBySectionRules = a; break; default: - throw new Exception("panic"); + throw new NotSupportedException($"The '{group.Key.ToString()}'-AccessRuleType is not supported."); } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index f81eff75ad..c3ff7d47da 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -262,6 +262,7 @@ + diff --git a/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs b/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs new file mode 100644 index 0000000000..49ab02a12e --- /dev/null +++ b/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Newtonsoft.Json.Serialization; +using Umbraco.Core.Manifest; + +namespace Umbraco.Web.WebApi +{ + + public class CamelCaseAndDataMemberWhenSerializingContractResolver : CamelCasePropertyNamesContractResolver + { + /// + protected override List GetSerializableMembers(Type objectType) + { + return base.GetSerializableMembers(objectType) + .Where(HasNotTheIgnoreDataMemberWhenSerializingAttribute) + .ToList(); + } + + private bool HasNotTheIgnoreDataMemberWhenSerializingAttribute(MemberInfo member) + { + if (member.GetCustomAttributes(typeof(IgnoreDataMemberWhenSerializingAttribute), true).Any()) + { + return false; + } + + return true; + } + } +} diff --git a/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs b/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs index 19683f7f86..5803afc819 100644 --- a/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs +++ b/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs @@ -4,6 +4,7 @@ using System.Net.Http.Formatting; using System.Web.Http.Controllers; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using Umbraco.Core.Manifest; namespace Umbraco.Web.WebApi { @@ -25,7 +26,7 @@ namespace Umbraco.Web.WebApi { SerializerSettings = { - ContractResolver = new CamelCasePropertyNamesContractResolver() + ContractResolver = new CamelCaseAndDataMemberWhenSerializingContractResolver() } }; controllerSettings.Formatters.Add(jsonFormatter); From 6626edbfa8aab59ce4a090d2982d8796a4b8faef Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 10:04:18 +0100 Subject: [PATCH 28/76] unused using --- .../Editors/DashboardController.cs | 252 ++++++++++-------- 1 file changed, 145 insertions(+), 107 deletions(-) diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index 00635d852f..825ffb7314 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -1,144 +1,182 @@ -using System.Collections.Generic; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Web.Models.ContentEditing; -using Umbraco.Web.Mvc; -using Newtonsoft.Json.Linq; -using System.Threading.Tasks; -using System.Net.Http; -using System.Web.Http; -using System; -using System.Net; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Text; +using Newtonsoft.Json; using Umbraco.Core.Cache; -using Umbraco.Web.WebApi; -using Umbraco.Web.WebApi.Filters; +using Umbraco.Core.Exceptions; +using Umbraco.Core.IO; using Umbraco.Core.Logging; -using Umbraco.Core.Persistence; -using Umbraco.Core.Services; -using Umbraco.Core.Dashboards; -using Umbraco.Web.Services; +using Umbraco.Core.PropertyEditors; -namespace Umbraco.Web.Editors +namespace Umbraco.Core.Manifest { - //we need to fire up the controller like this to enable loading of remote css directly from this controller - [PluginController("UmbracoApi")] - [ValidationFilter] - [AngularJsonOnlyConfiguration] - [IsBackOffice] - [WebApi.UmbracoAuthorize] - [JsonCamelCaseFormatter] - - public class DashboardController : UmbracoApiController + /// + /// Parses the Main.js file and replaces all tokens accordingly. + /// + public class ManifestParser { - private readonly IDashboardService _dashboardService; + private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); + + private readonly IAppPolicyCache _cache; + private readonly ILogger _logger; + private readonly ManifestValueValidatorCollection _validators; + + private string _path; /// - /// Initializes a new instance of the with auto dependencies. + /// Initializes a new instance of the class. /// - public DashboardController() + public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger) + : this(appCaches, validators, "~/App_Plugins", logger) { } /// - /// Initializes a new instance of the with all its dependencies. + /// Initializes a new instance of the class. /// - public DashboardController(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, IDashboardService dashboardService) - : base(globalSettings, umbracoContext, sqlContext, services, appCaches, logger, runtimeState) + private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger) { - _dashboardService = dashboardService; + if (appCaches == null) throw new ArgumentNullException(nameof(appCaches)); + _cache = appCaches.RuntimeCache; + _validators = validators ?? throw new ArgumentNullException(nameof(validators)); + if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path)); + Path = path; + _logger = logger ?? throw new ArgumentNullException(nameof(logger)); } - //we have just one instance of HttpClient shared for the entire application - private static readonly HttpClient HttpClient = new HttpClient(); - - //we have baseurl as a param to make previewing easier, so we can test with a dev domain from client side - [ValidateAngularAntiForgeryToken] - public async Task GetRemoteDashboardContent(string section, string baseUrl = "https://dashboard.umbraco.org/") + public string Path { - var user = Security.CurrentUser; - var allowedSections = string.Join(",", user.AllowedSections); - var language = user.Language; - var version = UmbracoVersion.SemanticVersion.ToSemanticString(); - - var url = string.Format(baseUrl + "{0}?section={0}&allowed={1}&lang={2}&version={3}", section, allowedSections, language, version); - var key = "umbraco-dynamic-dashboard-" + language + allowedSections.Replace(",", "-") + section; - - var content = AppCaches.RuntimeCache.GetCacheItem(key); - var result = new JObject(); - if (content != null) - { - result = content; - } - else - { - //content is null, go get it - try - { - //fetch dashboard json and parse to JObject - var json = await HttpClient.GetStringAsync(url); - content = JObject.Parse(json); - result = content; - - AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 30, 0)); - } - catch (HttpRequestException ex) - { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url); - - //it's still new JObject() - we return it like this to avoid error codes which triggers UI warnings - AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); - } - } - - return result; + get => _path; + set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value; } - public async Task GetRemoteDashboardCss(string section, string baseUrl = "https://dashboard.umbraco.org/") + /// + /// Gets all manifests, merged into a single manifest object. + /// + /// + public PackageManifest Manifest + => _cache.GetCacheItem("Umbraco.Core.Manifest.ManifestParser::Manifests", () => + { + var manifests = GetManifests(); + return MergeManifests(manifests); + }, new TimeSpan(0, 4, 0)); + + /// + /// Gets all manifests. + /// + private IEnumerable GetManifests() { - var url = string.Format(baseUrl + "css/dashboard.css?section={0}", section); - var key = "umbraco-dynamic-dashboard-css-" + section; + var manifests = new List(); - var content = AppCaches.RuntimeCache.GetCacheItem(key); - var result = string.Empty; - - if (content != null) + foreach (var path in GetManifestFiles()) { - result = content; - } - else - { - //content is null, go get it try { - //fetch remote css - content = await HttpClient.GetStringAsync(url); - - //can't use content directly, modified closure problem - result = content; - - //save server content for 30 mins - AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 30, 0)); + var text = File.ReadAllText(path); + text = TrimPreamble(text); + if (string.IsNullOrWhiteSpace(text)) + continue; + var manifest = ParseManifest(text); + manifests.Add(manifest); } - catch (HttpRequestException ex) + catch (Exception e) { - Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from {Url}", url); - - //it's still string.Empty - we return it like this to avoid error codes which triggers UI warnings - AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); + _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); } } - return new HttpResponseMessage(HttpStatusCode.OK) + return manifests; + } + + /// + /// Merges all manifests into one. + /// + private static PackageManifest MergeManifests(IEnumerable manifests) + { + var scripts = new HashSet(); + var stylesheets = new HashSet(); + var propertyEditors = new List(); + var parameterEditors = new List(); + var gridEditors = new List(); + var contentApps = new List(); + var dashboards = new List(); + var sections = new List(); + + foreach (var manifest in manifests) { - Content = new StringContent(result, Encoding.UTF8, "text/css") + if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script); + if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet); + if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors); + if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors); + if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors); + if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps); + if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards); + if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant())); + } + + return new PackageManifest + { + Scripts = scripts.ToArray(), + Stylesheets = stylesheets.ToArray(), + PropertyEditors = propertyEditors.ToArray(), + ParameterEditors = parameterEditors.ToArray(), + GridEditors = gridEditors.ToArray(), + ContentApps = contentApps.ToArray(), + Dashboards = dashboards.ToArray(), + Sections = sections.ToArray() }; } - [ValidateAngularAntiForgeryToken] - [OutgoingEditorModelEvent] - public IEnumerable> GetDashboard(string section) + // gets all manifest files (recursively) + private IEnumerable GetManifestFiles() { - return _dashboardService.GetDashboards(section, Security.CurrentUser); + if (Directory.Exists(_path) == false) + return new string[0]; + return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories); + } + + private static string TrimPreamble(string text) + { + // strangely StartsWith(preamble) would always return true + if (text.Substring(0, 1) == Utf8Preamble) + text = text.Remove(0, Utf8Preamble.Length); + + return text; + } + + /// + /// Parses a manifest. + /// + internal PackageManifest ParseManifest(string text) + { + if (string.IsNullOrWhiteSpace(text)) + throw new ArgumentNullOrEmptyException(nameof(text)); + + var manifest = JsonConvert.DeserializeObject(text, + new DataEditorConverter(_logger), + new ValueValidatorConverter(_validators), + new DashboardAccessRuleConverter()); + + // scripts and stylesheets are raw string, must process here + for (var i = 0; i < manifest.Scripts.Length; i++) + manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]); + for (var i = 0; i < manifest.Stylesheets.Length; i++) + manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]); + + // add property editors that are also parameter editors, to the parameter editors list + // (the manifest format is kinda legacy) + var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList(); + if (ppEditors.Count > 0) + manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray(); + + return manifest; + } + + // purely for tests + internal IEnumerable ParseGridEditors(string text) + { + return JsonConvert.DeserializeObject>(text); } } } From 8926e28706333b5c47b098db9e072a073f0e9cfa Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 10:08:52 +0100 Subject: [PATCH 29/76] revert --- .../Editors/DashboardController.cs | 241 ++++++++---------- 1 file changed, 101 insertions(+), 140 deletions(-) diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index 825ffb7314..b166a8b4bf 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -1,182 +1,143 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.Collections.Generic; +using Umbraco.Core; +using Umbraco.Core.Configuration; +using Umbraco.Web.Models.ContentEditing; +using Umbraco.Web.Mvc; +using Newtonsoft.Json.Linq; +using System.Threading.Tasks; +using System.Net.Http; +using System; +using System.Net; using System.Text; -using Newtonsoft.Json; using Umbraco.Core.Cache; -using Umbraco.Core.Exceptions; -using Umbraco.Core.IO; +using Umbraco.Web.WebApi; +using Umbraco.Web.WebApi.Filters; using Umbraco.Core.Logging; -using Umbraco.Core.PropertyEditors; +using Umbraco.Core.Persistence; +using Umbraco.Core.Services; +using Umbraco.Core.Dashboards; +using Umbraco.Web.Services; -namespace Umbraco.Core.Manifest +namespace Umbraco.Web.Editors { - /// - /// Parses the Main.js file and replaces all tokens accordingly. - /// - public class ManifestParser + //we need to fire up the controller like this to enable loading of remote css directly from this controller + [PluginController("UmbracoApi")] + [ValidationFilter] + [AngularJsonOnlyConfiguration] + [IsBackOffice] + [WebApi.UmbracoAuthorize] + [JsonCamelCaseFormatter] + + public class DashboardController : UmbracoApiController { - private static readonly string Utf8Preamble = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()); - - private readonly IAppPolicyCache _cache; - private readonly ILogger _logger; - private readonly ManifestValueValidatorCollection _validators; - - private string _path; + private readonly IDashboardService _dashboardService; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the with auto dependencies. /// - public ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, ILogger logger) - : this(appCaches, validators, "~/App_Plugins", logger) + public DashboardController() { } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the with all its dependencies. /// - private ManifestParser(AppCaches appCaches, ManifestValueValidatorCollection validators, string path, ILogger logger) + public DashboardController(IGlobalSettings globalSettings, UmbracoContext umbracoContext, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, IDashboardService dashboardService) + : base(globalSettings, umbracoContext, sqlContext, services, appCaches, logger, runtimeState) { - if (appCaches == null) throw new ArgumentNullException(nameof(appCaches)); - _cache = appCaches.RuntimeCache; - _validators = validators ?? throw new ArgumentNullException(nameof(validators)); - if (string.IsNullOrWhiteSpace(path)) throw new ArgumentNullOrEmptyException(nameof(path)); - Path = path; - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); + _dashboardService = dashboardService; } - public string Path + //we have just one instance of HttpClient shared for the entire application + private static readonly HttpClient HttpClient = new HttpClient(); + + //we have baseurl as a param to make previewing easier, so we can test with a dev domain from client side + [ValidateAngularAntiForgeryToken] + public async Task GetRemoteDashboardContent(string section, string baseUrl = "https://dashboard.umbraco.org/") { - get => _path; - set => _path = value.StartsWith("~/") ? IOHelper.MapPath(value) : value; - } + var user = Security.CurrentUser; + var allowedSections = string.Join(",", user.AllowedSections); + var language = user.Language; + var version = UmbracoVersion.SemanticVersion.ToSemanticString(); - /// - /// Gets all manifests, merged into a single manifest object. - /// - /// - public PackageManifest Manifest - => _cache.GetCacheItem("Umbraco.Core.Manifest.ManifestParser::Manifests", () => + var url = string.Format(baseUrl + "{0}?section={0}&allowed={1}&lang={2}&version={3}", section, allowedSections, language, version); + var key = "umbraco-dynamic-dashboard-" + language + allowedSections.Replace(",", "-") + section; + + var content = AppCaches.RuntimeCache.GetCacheItem(key); + var result = new JObject(); + if (content != null) { - var manifests = GetManifests(); - return MergeManifests(manifests); - }, new TimeSpan(0, 4, 0)); - - /// - /// Gets all manifests. - /// - private IEnumerable GetManifests() - { - var manifests = new List(); - - foreach (var path in GetManifestFiles()) + result = content; + } + else { + //content is null, go get it try { - var text = File.ReadAllText(path); - text = TrimPreamble(text); - if (string.IsNullOrWhiteSpace(text)) - continue; - var manifest = ParseManifest(text); - manifests.Add(manifest); + //fetch dashboard json and parse to JObject + var json = await HttpClient.GetStringAsync(url); + content = JObject.Parse(json); + result = content; + + AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 30, 0)); } - catch (Exception e) + catch (HttpRequestException ex) { - _logger.Error(e, "Failed to parse manifest at '{Path}', ignoring.", path); + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard content from {Url}", url); + + //it's still new JObject() - we return it like this to avoid error codes which triggers UI warnings + AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); } } - return manifests; + return result; } - /// - /// Merges all manifests into one. - /// - private static PackageManifest MergeManifests(IEnumerable manifests) + public async Task GetRemoteDashboardCss(string section, string baseUrl = "https://dashboard.umbraco.org/") { - var scripts = new HashSet(); - var stylesheets = new HashSet(); - var propertyEditors = new List(); - var parameterEditors = new List(); - var gridEditors = new List(); - var contentApps = new List(); - var dashboards = new List(); - var sections = new List(); + var url = string.Format(baseUrl + "css/dashboard.css?section={0}", section); + var key = "umbraco-dynamic-dashboard-css-" + section; - foreach (var manifest in manifests) + var content = AppCaches.RuntimeCache.GetCacheItem(key); + var result = string.Empty; + + if (content != null) { - if (manifest.Scripts != null) foreach (var script in manifest.Scripts) scripts.Add(script); - if (manifest.Stylesheets != null) foreach (var stylesheet in manifest.Stylesheets) stylesheets.Add(stylesheet); - if (manifest.PropertyEditors != null) propertyEditors.AddRange(manifest.PropertyEditors); - if (manifest.ParameterEditors != null) parameterEditors.AddRange(manifest.ParameterEditors); - if (manifest.GridEditors != null) gridEditors.AddRange(manifest.GridEditors); - if (manifest.ContentApps != null) contentApps.AddRange(manifest.ContentApps); - if (manifest.Dashboards != null) dashboards.AddRange(manifest.Dashboards); - if (manifest.Sections != null) sections.AddRange(manifest.Sections.DistinctBy(x => x.Alias.ToLowerInvariant())); + result = content; + } + else + { + //content is null, go get it + try + { + //fetch remote css + content = await HttpClient.GetStringAsync(url); + + //can't use content directly, modified closure problem + result = content; + + //save server content for 30 mins + AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 30, 0)); + } + catch (HttpRequestException ex) + { + Logger.Error(ex.InnerException ?? ex, "Error getting dashboard CSS from {Url}", url); + + //it's still string.Empty - we return it like this to avoid error codes which triggers UI warnings + AppCaches.RuntimeCache.InsertCacheItem(key, () => result, new TimeSpan(0, 5, 0)); + } } - return new PackageManifest + return new HttpResponseMessage(HttpStatusCode.OK) { - Scripts = scripts.ToArray(), - Stylesheets = stylesheets.ToArray(), - PropertyEditors = propertyEditors.ToArray(), - ParameterEditors = parameterEditors.ToArray(), - GridEditors = gridEditors.ToArray(), - ContentApps = contentApps.ToArray(), - Dashboards = dashboards.ToArray(), - Sections = sections.ToArray() + Content = new StringContent(result, Encoding.UTF8, "text/css") }; } - // gets all manifest files (recursively) - private IEnumerable GetManifestFiles() + [ValidateAngularAntiForgeryToken] + [OutgoingEditorModelEvent] + public IEnumerable> GetDashboard(string section) { - if (Directory.Exists(_path) == false) - return new string[0]; - return Directory.GetFiles(_path, "package.manifest", SearchOption.AllDirectories); - } - - private static string TrimPreamble(string text) - { - // strangely StartsWith(preamble) would always return true - if (text.Substring(0, 1) == Utf8Preamble) - text = text.Remove(0, Utf8Preamble.Length); - - return text; - } - - /// - /// Parses a manifest. - /// - internal PackageManifest ParseManifest(string text) - { - if (string.IsNullOrWhiteSpace(text)) - throw new ArgumentNullOrEmptyException(nameof(text)); - - var manifest = JsonConvert.DeserializeObject(text, - new DataEditorConverter(_logger), - new ValueValidatorConverter(_validators), - new DashboardAccessRuleConverter()); - - // scripts and stylesheets are raw string, must process here - for (var i = 0; i < manifest.Scripts.Length; i++) - manifest.Scripts[i] = IOHelper.ResolveVirtualUrl(manifest.Scripts[i]); - for (var i = 0; i < manifest.Stylesheets.Length; i++) - manifest.Stylesheets[i] = IOHelper.ResolveVirtualUrl(manifest.Stylesheets[i]); - - // add property editors that are also parameter editors, to the parameter editors list - // (the manifest format is kinda legacy) - var ppEditors = manifest.PropertyEditors.Where(x => (x.Type & EditorType.MacroParameter) > 0).ToList(); - if (ppEditors.Count > 0) - manifest.ParameterEditors = manifest.ParameterEditors.Union(ppEditors).ToArray(); - - return manifest; - } - - // purely for tests - internal IEnumerable ParseGridEditors(string text) - { - return JsonConvert.DeserializeObject>(text); + return _dashboardService.GetDashboards(section, Security.CurrentUser); } } } From 1c55f4ed4fa4ad6b3de48d89d76d1716e0427ede Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 10:09:28 +0100 Subject: [PATCH 30/76] changed correct file --- src/Umbraco.Core/Manifest/ManifestParser.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 674449c4f0..825ffb7314 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -8,8 +8,6 @@ using Umbraco.Core.Cache; using Umbraco.Core.Exceptions; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using Umbraco.Core.Models.ContentEditing; -using Umbraco.Core.Models.Trees; using Umbraco.Core.PropertyEditors; namespace Umbraco.Core.Manifest @@ -155,16 +153,10 @@ namespace Umbraco.Core.Manifest if (string.IsNullOrWhiteSpace(text)) throw new ArgumentNullOrEmptyException(nameof(text)); - var manifest = JsonConvert.DeserializeObject(text, new JsonSerializerSettings() - { - Converters = new JsonConverter[] - { - new DataEditorConverter(_logger), - new ValueValidatorConverter(_validators), - new DashboardAccessRuleConverter() - }, - } - ); + var manifest = JsonConvert.DeserializeObject(text, + new DataEditorConverter(_logger), + new ValueValidatorConverter(_validators), + new DashboardAccessRuleConverter()); // scripts and stylesheets are raw string, must process here for (var i = 0; i < manifest.Scripts.Length; i++) From 6ee8ef0a07d09bb45f87311a00a18c69bb9a30b8 Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 09:18:19 +0000 Subject: [PATCH 31/76] =?UTF-8?q?Fix=20the=20build!=20Sorry=20Stephan=20?= =?UTF-8?q?=F0=9F=91=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/NuSpecs/UmbracoCms.Core.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 9e6e375745..dc1224842e 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -35,7 +35,7 @@ - + From 15c197abd3398d77a9e195c0c52db1476ad3c9ba Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 11:04:56 +0100 Subject: [PATCH 32/76] public AccessRule.cs, to let third party create dashboards from code without having to implement there own --- src/Umbraco.Core/Dashboards/AccessRule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Dashboards/AccessRule.cs b/src/Umbraco.Core/Dashboards/AccessRule.cs index 70f9da8fa9..4f725e32f0 100644 --- a/src/Umbraco.Core/Dashboards/AccessRule.cs +++ b/src/Umbraco.Core/Dashboards/AccessRule.cs @@ -3,7 +3,7 @@ /// /// Implements . /// - internal class AccessRule : IAccessRule + public class AccessRule : IAccessRule { /// public AccessRuleType Type { get; set; } From a8e8832a759a2b9dee260e0a08e0da864b4bd3dc Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 10:17:40 +0000 Subject: [PATCH 33/76] Bye bye dashboard.config.install XDT transform as part of NuGet install --- build/NuSpecs/UmbracoCms.nuspec | 1 - .../tools/Dashboard.config.install.xdt | 95 ------------------- src/umbraco.sln | 1 - 3 files changed, 97 deletions(-) delete mode 100644 build/NuSpecs/tools/Dashboard.config.install.xdt diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index a188377c19..622671dd9d 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -53,7 +53,6 @@ - diff --git a/build/NuSpecs/tools/Dashboard.config.install.xdt b/build/NuSpecs/tools/Dashboard.config.install.xdt deleted file mode 100644 index a81af8c365..0000000000 --- a/build/NuSpecs/tools/Dashboard.config.install.xdt +++ /dev/null @@ -1,95 +0,0 @@ - - -
- - - - views/dashboard/settings/settingsdashboardintro.html - - -
- -
- - forms - - - - views/dashboard/forms/formsdashboardintro.html - - -
- -
- - developer - -
- -
- - - views/dashboard/developer/developerdashboardvideos.html - - - -
- -
- - - views/dashboard/developer/examinemanagement.html - - -
- -
- - - - - views/dashboard/media/mediafolderbrowser.html - - -
- -
- - - - views/dashboard/members/membersdashboardvideos.html - - -
- -
- -
- -
- - -
- -
- - content - - - - views/dashboard/developer/redirecturls.html - - -
- -
- - developer - - - - views/dashboard/developer/healthcheck.html - - -
- diff --git a/src/umbraco.sln b/src/umbraco.sln index 0bdcb53d99..c02a5ba85c 100644 --- a/src/umbraco.sln +++ b/src/umbraco.sln @@ -70,7 +70,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{E3F9F378 ProjectSection(SolutionItems) = preProject ..\build\NuSpecs\tools\applications.config.install.xdt = ..\build\NuSpecs\tools\applications.config.install.xdt ..\build\NuSpecs\tools\ClientDependency.config.install.xdt = ..\build\NuSpecs\tools\ClientDependency.config.install.xdt - ..\build\NuSpecs\tools\Dashboard.config.install.xdt = ..\build\NuSpecs\tools\Dashboard.config.install.xdt ..\build\NuSpecs\tools\install.core.ps1 = ..\build\NuSpecs\tools\install.core.ps1 ..\build\NuSpecs\tools\install.ps1 = ..\build\NuSpecs\tools\install.ps1 ..\build\NuSpecs\tools\Readme.txt = ..\build\NuSpecs\tools\Readme.txt From bb079213636b54a7756d2a628e37e5fe17d83677 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 25 Jan 2019 11:57:08 +0100 Subject: [PATCH 34/76] KeyValueService supports more weird situations --- src/Umbraco.Core/Services/Implement/KeyValueService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Services/Implement/KeyValueService.cs b/src/Umbraco.Core/Services/Implement/KeyValueService.cs index b30543ed48..eb68cea25c 100644 --- a/src/Umbraco.Core/Services/Implement/KeyValueService.cs +++ b/src/Umbraco.Core/Services/Implement/KeyValueService.cs @@ -40,7 +40,7 @@ namespace Umbraco.Core.Services.Implement // if already running 8, either following an upgrade or an install, // then everything should be ok (the table should exist, etc) - if (UmbracoVersion.LocalVersion.Major >= 8) + if (UmbracoVersion.LocalVersion != null && UmbracoVersion.LocalVersion.Major >= 8) return; // else we are upgrading from 7, we can assume that the locks table From 427ac259f4121280b5c909aa26f043d015a31335 Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 25 Jan 2019 11:57:42 +0100 Subject: [PATCH 35/76] Refactor datatype configuration connector --- .../Deploy/IDataTypeConfigurationConnector.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs index f2a08575b5..7b292307cc 100644 --- a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs +++ b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using Umbraco.Core.Models; namespace Umbraco.Core.Deploy { @@ -17,18 +18,17 @@ namespace Umbraco.Core.Deploy IEnumerable PropertyEditorAliases { get; } /// - /// Gets the environment-agnostic data type configurations corresponding to environment-specific configurations. + /// Gets the artifact datatype configuration corresponding to the actual datatype configuration. /// - /// The environment-specific configuration. + /// The datatype. /// The dependencies. - /// - IDictionary ConvertToDeploy(IDictionary configuration, ICollection dependencies); + IDictionary ToArtifact(IDataType dataType, ICollection dependencies); /// - /// Gets the environment-specific data type configurations corresponding to environment-agnostic configurations. + /// Gets the actual datatype configuration corresponding to the artifact configuration. /// - /// The environment-agnostic configuration. - /// - IDictionary ConvertToLocalEnvironment(IDictionary configuration); + /// The datatype. + /// The artifact configuration. + object FromArtifact(IDataType dataType, IDictionary configuration); } } From e8cb30fbc4cb5ee71aec1ed5a6e29b7681aed8ab Mon Sep 17 00:00:00 2001 From: Stephan Date: Fri, 25 Jan 2019 12:33:20 +0100 Subject: [PATCH 36/76] Fix exception when replacing IServerRegistrar --- .../Runtime/CoreRuntimeComposer.cs | 18 ++++++---- ...aseServerRegistrarAndMessengerComponent.cs | 36 ++++++++++++------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs b/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs index 5535d5c67b..83cc456127 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs @@ -73,16 +73,20 @@ namespace Umbraco.Core.Runtime // register a server registrar, by default it's the db registrar composition.RegisterUnique(f => { - if ("true".InvariantEquals(ConfigurationManager.AppSettings["umbracoDisableElectionForSingleServer"])) - return new SingleServerRegistrar(f.GetInstance()); - return new DatabaseServerRegistrar( - new Lazy(f.GetInstance), - new DatabaseServerRegistrarOptions()); + // TODO this is a hack, use proper configuration! + // also: we still register the full IServerMessenger because + // even on 1 single server we can have 2 concurrent app domains + var singleServer = "true".InvariantEquals(ConfigurationManager.AppSettings["umbracoDisableElectionForSingleServer"]); + return singleServer + ? (IServerRegistrar) new SingleServerRegistrar(f.GetInstance()) + : new DatabaseServerRegistrar( + new Lazy(f.GetInstance), + new DatabaseServerRegistrarOptions()); }); // by default we'll use the database server messenger with default options (no callbacks), - // this will be overridden by either the legacy thing or the db thing in the corresponding - // components in the web project - todo - should obsolete the legacy thing + // this will be overridden by the db thing in the corresponding components in the web + // project composition.RegisterUnique(factory => new DatabaseServerMessenger( factory.GetInstance(), diff --git a/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs b/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs index 2e3132a82c..589502e6a2 100644 --- a/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs +++ b/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs @@ -106,30 +106,36 @@ namespace Umbraco.Web.Components public DatabaseServerRegistrarAndMessengerComponent(IRuntimeState runtime, IServerRegistrar serverRegistrar, IServerMessenger serverMessenger, IServerRegistrationService registrationService, ILogger logger, IndexRebuilder indexRebuilder) { - _registrar = serverRegistrar as DatabaseServerRegistrar; - if (_registrar == null) throw new Exception("panic: registar."); - - _messenger = serverMessenger as BatchedDatabaseServerMessenger; - if (_messenger == null) throw new Exception("panic: messenger"); - _runtime = runtime; _logger = logger; _registrationService = registrationService; _indexRebuilder = indexRebuilder; - _touchTaskRunner = new BackgroundTaskRunner("ServerRegistration", - new BackgroundTaskRunnerOptions { AutoStart = true }, logger); - _processTaskRunner = new BackgroundTaskRunner("ServerInstProcess", - new BackgroundTaskRunnerOptions { AutoStart = true }, logger); + // create task runner for DatabaseServerRegistrar + _registrar = serverRegistrar as DatabaseServerRegistrar; + if (_registrar != null) + { + _touchTaskRunner = new BackgroundTaskRunner("ServerRegistration", + new BackgroundTaskRunnerOptions { AutoStart = true }, logger); + } + + // create task runner for BatchedDatabaseServerMessenger + _messenger = serverMessenger as BatchedDatabaseServerMessenger; + if (_messenger != null) + { + _processTaskRunner = new BackgroundTaskRunner("ServerInstProcess", + new BackgroundTaskRunnerOptions { AutoStart = true }, logger); + } } public void Initialize() { //We will start the whole process when a successful request is made - UmbracoModule.RouteAttempt += RegisterBackgroundTasksOnce; + if (_registrar != null || _messenger != null) + UmbracoModule.RouteAttempt += RegisterBackgroundTasksOnce; // must come last, as it references some _variables - _messenger.Startup(); + _messenger?.Startup(); } public void Terminate() @@ -175,6 +181,9 @@ namespace Umbraco.Web.Components private IBackgroundTask RegisterInstructionProcess() { + if (_messenger == null) + return null; + var task = new InstructionProcessTask(_processTaskRunner, 60000, //delay before first execution _messenger.Options.ThrottleSeconds*1000, //amount of ms between executions @@ -186,6 +195,9 @@ namespace Umbraco.Web.Components private IBackgroundTask RegisterTouchServer(IServerRegistrationService registrationService, string serverAddress) { + if (_registrar == null) + return null; + var task = new TouchServerTask(_touchTaskRunner, 15000, //delay before first execution _registrar.Options.RecurringSeconds*1000, //amount of ms between executions From 66959baabee4803e2dc4004a9d6ec8b3890ce030 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 25 Jan 2019 12:56:53 +0100 Subject: [PATCH 37/76] Reimplemented IsPublished on PublishedContent --- .../NuCache/DataSource/CultureVariation.cs | 3 +++ .../NuCache/PublishedContent.cs | 14 ++++++++++--- .../NuCache/PublishedSnapshotService.cs | 21 +++++++++++++------ 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs index c6e603f5a9..27bae6bf39 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs @@ -16,5 +16,8 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource [JsonProperty("isDraft")] public bool IsDraft { get; set; } + + [JsonProperty("isPublished")] + public bool IsPublished { get; set; } } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index 3f57bf3340..e145f89220 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -296,7 +296,10 @@ namespace Umbraco.Web.PublishedCache.NuCache /// public override bool IsPublished(string culture = null) { - // fixme I don't understand this - and it does probably not do what's expected + if (!IsDraft(culture)) + { + return true; + } if (!ContentType.VariesByCulture()) { @@ -307,8 +310,13 @@ namespace Umbraco.Web.PublishedCache.NuCache if (culture == null) culture = VariationContextAccessor?.VariationContext?.Culture ?? ""; - //If the current culture is not a draft, it must be the published version - return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && !cvar.IsDraft; + if (_contentData.CultureInfos.TryGetValue(culture, out var variant)) + { + return variant.IsPublished; + } + + return false; + } #endregion diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 8675aefd1a..ff0d330a3c 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -1202,16 +1202,25 @@ namespace Umbraco.Web.PublishedCache.NuCache // sanitize - names should be ok but ... never knows if (content.GetContentType().VariesByCulture()) { - var infos = content is IContent document - ? (published - ? document.PublishCultureInfos - : document.CultureInfos) - : content.CultureInfos; + + IReadOnlyDictionary infos = content.CultureInfos; + var publishedCultures = new HashSet(); + + if (content is IContent document) + { + if (published) + { + infos = document.PublishCultureInfos; + } + + publishedCultures = new HashSet(document.PublishedCultures); + } + foreach (var (culture, info) in infos) { var cultureIsDraft = !published && content is IContent d && d.IsCultureEdited(culture); - cultureData[culture] = new CultureVariation { Name = info.Name, Date = content.GetUpdateDate(culture) ?? DateTime.MinValue, IsDraft = cultureIsDraft }; + cultureData[culture] = new CultureVariation { Name = info.Name, Date = content.GetUpdateDate(culture) ?? DateTime.MinValue, IsDraft = cultureIsDraft, IsPublished = publishedCultures.Contains(culture)}; } } From 19d084e0863183012057ad17e699a95e716af54b Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 12:11:07 +0000 Subject: [PATCH 38/76] Localize dashboard tabs with a convention of dashboardsTabs_dashboardAlias as the localization key --- src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 12 ++++++++++++ src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 12 ++++++++++++ src/Umbraco.Web/Services/DashboardService.cs | 10 +++++++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index 2e63acd3c3..3dcbfcded2 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -2016,4 +2016,16 @@ To manage your website, simply open the Umbraco back office and start adding con Relation Type Relations + + Getting Started + Redirect URL Management + Content + Welcome + Examine Management + Published Status + Models Builder + Health Check + Getting Started + Install Umbraco Forms + > diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index 86484b1393..8c8a405e29 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -2049,4 +2049,16 @@ To manage your website, simply open the Umbraco back office and start adding con Relation Type Relations + + Getting Started + Redirect URL Management + Content + Welcome + Examine Management + Published Status + Models Builder + Health Check + Getting Started + Install Umbraco Forms + diff --git a/src/Umbraco.Web/Services/DashboardService.cs b/src/Umbraco.Web/Services/DashboardService.cs index 89f241252f..e33bdb800a 100644 --- a/src/Umbraco.Web/Services/DashboardService.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Core; +using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; using Umbraco.Core.Models.Membership; +using Umbraco.Core.Services; +using Umbraco.Core.Services.Implement; using Umbraco.Web.Dashboards; using Umbraco.Web.Models.ContentEditing; @@ -13,11 +16,13 @@ namespace Umbraco.Web.Services { private readonly ISectionService _sectionService; private readonly DashboardCollection _dashboardCollection; + private readonly ILocalizedTextService _localizedText; - public DashboardService(ISectionService sectionService, DashboardCollection dashboardCollection) + public DashboardService(ISectionService sectionService, DashboardCollection dashboardCollection, ILocalizedTextService localizedText) { _sectionService = sectionService ?? throw new ArgumentNullException(nameof(sectionService)); _dashboardCollection = dashboardCollection ?? throw new ArgumentNullException(nameof(dashboardCollection)); + _localizedText = localizedText ?? throw new ArgumentNullException(nameof(localizedText)); } @@ -37,11 +42,10 @@ namespace Umbraco.Web.Services throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); var dashboards = new List {dashboard}; - tabs.Add(new Tab { Id = tabId++, - Label = dashboard.Name, + Label = _localizedText.Localize("dashboardTabs", dashboard.Alias), Alias = dashboard.Alias, Properties = dashboards }); From 4b3cd9118883680f3fd315e3589c70dcc9c8786d Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 12:17:52 +0000 Subject: [PATCH 39/76] Remove Name property from IDashboardSection & the C# types (We use localization of dashboardTabs_alias) --- src/Umbraco.Core/Dashboards/IDashboardSection.cs | 6 ------ src/Umbraco.Web/Dashboards/ContentDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/ExamineDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/FormsDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/MediaDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/MembersDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs | 2 -- src/Umbraco.Web/Dashboards/SettingsDashboards.cs | 2 -- 11 files changed, 26 deletions(-) diff --git a/src/Umbraco.Core/Dashboards/IDashboardSection.cs b/src/Umbraco.Core/Dashboards/IDashboardSection.cs index 7b5963c9f5..73cf8513f9 100644 --- a/src/Umbraco.Core/Dashboards/IDashboardSection.cs +++ b/src/Umbraco.Core/Dashboards/IDashboardSection.cs @@ -5,12 +5,6 @@ namespace Umbraco.Core.Dashboards { public interface IDashboardSection { - /// - /// Display name of the dashboard tab - /// - [DataMember(Name="name")] - string Name { get; } - /// /// Alias to refer to this dashboard via code /// diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 6a41b07c2c..1ff741b7e4 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class ContentDashboard : IDashboardSection { - public string Name => "Get Started"; - public string Alias => "contentIntro"; public string[] Sections => new [] { "content" }; diff --git a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs index e686545b51..8363e8079c 100644 --- a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(20)] public class ExamineDashboard : IDashboardSection { - public string Name => "Examine Management"; - public string Alias => "settingsExamine"; public string[] Sections => new [] { "settings" }; diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs index 3592c88d13..0121fcd2c1 100644 --- a/src/Umbraco.Web/Dashboards/FormsDashboard.cs +++ b/src/Umbraco.Web/Dashboards/FormsDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class FormsDashboard : IDashboardSection { - public string Name => "Install Umbraco Forms"; - public string Alias => "formsInstall"; public string[] Sections => new [] { "forms" }; diff --git a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs index b7373a6d44..a8347f1806 100644 --- a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs +++ b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(50)] public class HealthCheckDashboard : IDashboardSection { - public string Name => "Health Check"; - public string Alias => "settingsHealthCheck"; public string[] Sections => new [] { "settings" }; diff --git a/src/Umbraco.Web/Dashboards/MediaDashboard.cs b/src/Umbraco.Web/Dashboards/MediaDashboard.cs index c72046388e..ae8f8343ce 100644 --- a/src/Umbraco.Web/Dashboards/MediaDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MediaDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class MediaDashboard : IDashboardSection { - public string Name => "Content"; - public string Alias => "mediaFolderBrowser"; public string[] Sections => new [] { "media" }; diff --git a/src/Umbraco.Web/Dashboards/MembersDashboard.cs b/src/Umbraco.Web/Dashboards/MembersDashboard.cs index 44aa6c4de6..57183ab6a6 100644 --- a/src/Umbraco.Web/Dashboards/MembersDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MembersDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class MembersDashboard : IDashboardSection { - public string Name => "Get Started"; - public string Alias => "memberIntro"; public string[] Sections => new [] { "member" }; diff --git a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs index 431e129840..5e284ee0c2 100644 --- a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(40)] public class ModelsBuilderDashboard : IDashboardSection { - public string Name => "Models Builder"; - public string Alias => "settingsModelsBuilder"; public string[] Sections => new [] { "settings" }; diff --git a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs index 5feca94324..17e99bdf5b 100644 --- a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs +++ b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(30)] public class PublishedStatusDashboard : IDashboardSection { - public string Name => "Published Status"; - public string Alias => "settingsPublishedStatus"; public string[] Sections => new [] { "settings" }; diff --git a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs index 748db64658..76cc03202d 100644 --- a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs +++ b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(20)] public class RedirectUrlDashboard : IDashboardSection { - public string Name => "Redirect URL Management"; - public string Alias => "contentRedirectManager"; public string[] Sections => new [] { "content" }; diff --git a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs index b5ab56c319..1fd32bee14 100644 --- a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs +++ b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs @@ -7,8 +7,6 @@ namespace Umbraco.Web.Dashboards [Weight(10)] public class SettingsDashboard : IDashboardSection { - public string Name => "Welcome"; - public string Alias => "settingsWelcome"; public string[] Sections => new [] { "settings" }; From b1f94c66dca390d04e6625335e5454957bacaa5e Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 25 Jan 2019 12:18:15 +0000 Subject: [PATCH 40/76] Remove name property from dashboard package.manifest collection --- src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs | 3 --- src/Umbraco.Tests/Manifest/ManifestParserTests.cs | 4 ---- 2 files changed, 7 deletions(-) diff --git a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs b/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs index b2b3fd5dfb..879f78e19c 100644 --- a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs +++ b/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs @@ -10,9 +10,6 @@ namespace Umbraco.Core.Manifest { private string _view; - [JsonProperty("name", Required = Required.Always)] - public string Name { get; set; } - [JsonProperty("alias", Required = Required.Always)] public string Alias { get; set; } diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index a12f90c4eb..546831974c 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -387,7 +387,6 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 { const string json = @"{'dashboards': [ { - 'name': 'First One', 'alias': 'something', 'view': '~/App_Plugins/MyPackage/Dashboards/one.html', 'sections': [ 'content' ], @@ -395,7 +394,6 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 }, { - 'name': 'Second-One', 'alias': 'something.else', 'weight': -1, 'view': '~/App_Plugins/MyPackage/Dashboards/two.html', @@ -409,7 +407,6 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 Assert.IsInstanceOf(manifest.Dashboards[0]); var db0 = manifest.Dashboards[0]; Assert.AreEqual("something", db0.Alias); - Assert.AreEqual("First One", db0.Name); Assert.AreEqual(100, db0.Weight); Assert.AreEqual("/App_Plugins/MyPackage/Dashboards/one.html", db0.View); Assert.AreEqual(1, db0.Sections.Length); @@ -423,7 +420,6 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 Assert.IsInstanceOf(manifest.Dashboards[1]); var db1 = manifest.Dashboards[1]; Assert.AreEqual("something.else", db1.Alias); - Assert.AreEqual("Second-One", db1.Name); Assert.AreEqual(-1, db1.Weight); Assert.AreEqual("/App_Plugins/MyPackage/Dashboards/two.html", db1.View); Assert.AreEqual(1, db1.Sections.Length); From 2c6b5f21b0cbfadb07a1d1998154798c07e97f57 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Fri, 25 Jan 2019 16:06:32 +0100 Subject: [PATCH 41/76] Migrates RelatedLink data to MultiUrlPicker and changes all RelatedLink datatypes to MultiUrlPicker ones --- .../Migrations/Upgrade/UmbracoPlan.cs | 1 + .../ConvertRelatedLinksToMultiUrlPicker.cs | 142 ++++++++++++++++++ src/Umbraco.Core/Umbraco.Core.csproj | 1 + .../MultiUrlPickerPropertyEditor.cs | 2 +- 4 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs diff --git a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs index 833955ee6a..f4732acc4b 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/UmbracoPlan.cs @@ -124,6 +124,7 @@ namespace Umbraco.Core.Migrations.Upgrade To("{64EBCE53-E1F0-463A-B40B-E98EFCCA8AE2}"); To("{0009109C-A0B8-4F3F-8FEB-C137BBDDA268}"); To("{8A027815-D5CD-4872-8B88-9A51AB5986A6}"); // from 7.14.0 + To("{ED28B66A-E248-4D94-8CDB-9BDF574023F0}"); //FINAL diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs new file mode 100644 index 0000000000..7e7f398791 --- /dev/null +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Umbraco.Core.Logging; +using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.Persistence; +using Umbraco.Core.Persistence.Dtos; + +namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 +{ + public class ConvertRelatedLinksToMultiUrlPicker : MigrationBase + { + public ConvertRelatedLinksToMultiUrlPicker(IMigrationContext context) : base(context) + { } + + public override void Migrate() + { + var sqlDataTypes = Sql() + .Select() + .From() + .Where(x => x.EditorAlias == "Umbraco.RelatedLinks" + || x.EditorAlias == "Umbraco.RelatedLinks2"); + + var dataTypes = Database.Fetch(sqlDataTypes); + var dataTypeIds = dataTypes.Select(x => x.NodeId).ToList(); + + var sqlPropertyTpes = Sql() + .Select() + .From() + .Where(x => dataTypeIds.Contains(x.DataTypeId)); + + var propertyTypeIds = Database.Fetch(sqlPropertyTpes).Select(x => x.Id); + + var sqlPropertyData = Sql() + .Select() + .From() + .Where(x => propertyTypeIds.Contains(x.PropertyTypeId)); + + var properties = Database.Fetch(sqlPropertyData); + + // Create a Multi URL Picker datatype for the converted RelatedLinks data + if (properties.Any() == false) + return; + + foreach (var property in properties) + { + var value = property.Value.ToString(); + if (string.IsNullOrWhiteSpace(value)) + continue; + + var relatedLinks = JsonConvert.DeserializeObject>(value); + var links = new List(); + foreach (var relatedLink in relatedLinks) + { + GuidUdi udi = null; + if (relatedLink.IsInternal) + { + var linkIsUdi = GuidUdi.TryParse(relatedLink.Link, out udi); + if (linkIsUdi == false) + { + // oh no.. probably an integer, yikes! + if (int.TryParse(relatedLink.Link, out var intId)) + { + var sqlNodeData = Sql() + .Select() + .Where(x => x.NodeId == intId); + + var node = Database.Fetch(sqlNodeData).FirstOrDefault(); + if (node != null) + // Note: RelatedLinks did not allow for picking media items, + // so if there's a value this will be a content item - hence + // the hardcoded "document" here + udi = new GuidUdi("document", node.UniqueId); + } + } + } + + var link = new LinkDto + { + Name = relatedLink.Caption, + Target = relatedLink.NewWindow ? "_blank" : null, + Udi = udi, + // Should only have a URL if it's an external link otherwise it wil be a UDI + Url = relatedLink.IsInternal == false ? relatedLink.Link : null + }; + + links.Add(link); + } + + var json = JsonConvert.SerializeObject(links); + + // Update existing data + property.TextValue = json; + Database.Update(property); + } + + foreach (var dataType in dataTypes) + { + // Change existing datatypes from RelatedLinks to MultiUrlPicker + var dataTypeResult = Database.Fetch(Sql() + .Select() + .From() + .Where(x => x.NodeId == dataType.NodeId)).First(); + + dataTypeResult.EditorAlias = Constants.PropertyEditors.Aliases.MultiUrlPicker; + Database.Update(dataTypeResult); + } + } + } + + internal class RelatedLink + { + public int? Id { get; internal set; } + internal bool IsDeleted { get; set; } + [JsonProperty("caption")] + public string Caption { get; set; } + [JsonProperty("link")] + public string Link { get; set; } + [JsonProperty("newWindow")] + public bool NewWindow { get; set; } + [JsonProperty("isInternal")] + public bool IsInternal { get; set; } + } + + [DataContract] + internal class LinkDto + { + [DataMember(Name = "name")] + public string Name { get; set; } + + [DataMember(Name = "target")] + public string Target { get; set; } + + [DataMember(Name = "udi")] + public GuidUdi Udi { get; set; } + + [DataMember(Name = "url")] + public string Url { get; set; } + } +} diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 9a52cb8dc5..723c9c4c22 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -393,6 +393,7 @@ + diff --git a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs index 54bf5c4d15..1648b81623 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiUrlPickerPropertyEditor.cs @@ -7,7 +7,7 @@ using Umbraco.Web.PublishedCache; namespace Umbraco.Web.PropertyEditors { - [DataEditor(Constants.PropertyEditors.Aliases.MultiUrlPicker, EditorType.PropertyValue|EditorType.MacroParameter, "Multi Url Picker", "multiurlpicker", ValueType = "JSON", Group = "pickers", Icon = "icon-link")] + [DataEditor(Constants.PropertyEditors.Aliases.MultiUrlPicker, EditorType.PropertyValue|EditorType.MacroParameter, "Multi Url Picker", "multiurlpicker", ValueType = ValueTypes.Json, Group = "pickers", Icon = "icon-link")] public class MultiUrlPickerPropertyEditor : DataEditor { private readonly IEntityService _entityService; From 5a896e74171b1b6c38dd7ee86119ea60d80317ca Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 23 Jan 2019 08:56:20 +0100 Subject: [PATCH 42/76] Remove obsoleted RelatedLinks picker (replaced by Multi URL Picker) (cherry picked from commit fedf0c78de6d2ad365db1c112c22af13abd7b9fb) --- src/Umbraco.Core/Constants-PropertyEditors.cs | 7 +- .../Migrations/Install/DatabaseDataCreator.cs | 4 +- .../V_8_0_0/PropertyEditorsMigration.cs | 1 - .../Composing/TypeLoaderTests.cs | 2 +- .../Services/ContentServiceTests.cs | 2 +- .../TestHelpers/Entities/MockedContent.cs | 2 +- .../Entities/MockedContentTypes.cs | 2 +- .../Mvc/HtmlHelperExtensionMethodsTests.cs | 25 --- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 34 ---- src/Umbraco.Web/Models/RelatedLink.cs | 11 -- src/Umbraco.Web/Models/RelatedLinkBase.cs | 18 -- src/Umbraco.Web/Models/RelatedLinkType.cs | 27 --- src/Umbraco.Web/Models/RelatedLinks.cs | 42 ----- .../RelatedLinksConfiguration.cs | 13 -- .../RelatedLinksConfigurationEditor.cs | 18 -- .../RelatedLinksPropertyEditor.cs | 16 -- .../RelatedLinksLegacyValueConverter.cs | 132 -------------- .../RelatedLinksValueConverter.cs | 169 ------------------ src/Umbraco.Web/RelatedLinksTypeConverter.cs | 98 ---------- src/Umbraco.Web/Umbraco.Web.csproj | 10 -- 20 files changed, 7 insertions(+), 626 deletions(-) delete mode 100644 src/Umbraco.Web/Models/RelatedLink.cs delete mode 100644 src/Umbraco.Web/Models/RelatedLinkBase.cs delete mode 100644 src/Umbraco.Web/Models/RelatedLinkType.cs delete mode 100644 src/Umbraco.Web/Models/RelatedLinks.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs delete mode 100644 src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs delete mode 100644 src/Umbraco.Web/RelatedLinksTypeConverter.cs diff --git a/src/Umbraco.Core/Constants-PropertyEditors.cs b/src/Umbraco.Core/Constants-PropertyEditors.cs index b9f20fb449..8b637fe90e 100644 --- a/src/Umbraco.Core/Constants-PropertyEditors.cs +++ b/src/Umbraco.Core/Constants-PropertyEditors.cs @@ -118,12 +118,7 @@ namespace Umbraco.Core /// RadioButton list. ///
public const string RadioButtonList = "Umbraco.RadioButtonList"; - - /// - /// Related Links. - /// - public const string RelatedLinks = "Umbraco.RelatedLinks"; - + /// /// Slider. /// diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index f32ea1cb6f..4e0b5dfa0f 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -135,7 +135,7 @@ namespace Umbraco.Core.Migrations.Install _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1047, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1047", SortOrder = 2, UniqueId = new Guid("1EA2E01F-EBD8-4CE1-8D71-6B1149E63548"), Text = "Member Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1048, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1048", SortOrder = 2, UniqueId = new Guid("135D60E0-64D9-49ED-AB08-893C9BA44AE5"), Text = "Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1049, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1049", SortOrder = 2, UniqueId = new Guid("9DBBCBBB-2327-434A-B355-AF1B84E5010A"), Text = "Multiple Media Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); - _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Related Links", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); + _database.Insert(Constants.DatabaseSchema.Tables.Node, "id", false, new NodeDto { NodeId = 1050, Trashed = false, ParentId = -1, UserId = -1, Level = 1, Path = "-1,1050", SortOrder = 2, UniqueId = new Guid("B4E3535A-1753-47E2-8568-602CF8CFEE6F"), Text = "Multi URL Picker", NodeObjectType = Constants.ObjectTypes.DataType, CreateDate = DateTime.Now }); } private void CreateLockData() @@ -301,7 +301,7 @@ namespace Umbraco.Core.Migrations.Install _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1048, EditorAlias = Constants.PropertyEditors.Aliases.MediaPicker, DbType = "Ntext" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1049, EditorAlias = Constants.PropertyEditors.Aliases.MediaPicker, DbType = "Ntext", Configuration = "{\"multiPicker\":1}" }); - _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1050, EditorAlias = Constants.PropertyEditors.Aliases.RelatedLinks, DbType = "Ntext" }); + _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = 1050, EditorAlias = Constants.PropertyEditors.Aliases.MultiUrlPicker, DbType = "Ntext" }); } private void CreateRelationTypeData() diff --git a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs index ee439088be..064ffc7228 100644 --- a/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs +++ b/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/PropertyEditorsMigration.cs @@ -16,7 +16,6 @@ namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0 RenameDataType(Constants.PropertyEditors.Aliases.MediaPicker + "2", Constants.PropertyEditors.Aliases.MediaPicker); RenameDataType(Constants.PropertyEditors.Aliases.MemberPicker + "2", Constants.PropertyEditors.Aliases.MemberPicker); RenameDataType(Constants.PropertyEditors.Aliases.MultiNodeTreePicker + "2", Constants.PropertyEditors.Aliases.MultiNodeTreePicker); - RenameDataType(Constants.PropertyEditors.Aliases.RelatedLinks + "2", Constants.PropertyEditors.Aliases.RelatedLinks); RenameDataType("Umbraco.TextboxMultiple", Constants.PropertyEditors.Aliases.TextArea, false); RenameDataType("Umbraco.Textbox", Constants.PropertyEditors.Aliases.TextBox, false); } diff --git a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs index 6b3ce3eb4e..add3424599 100644 --- a/src/Umbraco.Tests/Composing/TypeLoaderTests.cs +++ b/src/Umbraco.Tests/Composing/TypeLoaderTests.cs @@ -279,7 +279,7 @@ AnotherContentFinder public void GetDataEditors() { var types = _typeLoader.GetDataEditors(); - Assert.AreEqual(40, types.Count()); + Assert.AreEqual(39, types.Count()); } /// diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 039bcaed24..9490213d62 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -2215,7 +2215,7 @@ namespace Umbraco.Tests.Services Assert.That(sut.GetValue("contentPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Document, new Guid("74ECA1D4-934E-436A-A7C7-36CC16D4095C")))); Assert.That(sut.GetValue("mediaPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Media, new Guid("44CB39C8-01E5-45EB-9CF8-E70AAF2D1691")))); Assert.That(sut.GetValue("memberPicker"), Is.EqualTo(Udi.Create(Constants.UdiEntityType.Member, new Guid("9A50A448-59C0-4D42-8F93-4F1D55B0F47D")))); - Assert.That(sut.GetValue("relatedLinks"), Is.EqualTo("")); + Assert.That(sut.GetValue("multiUrlPicker"), Is.EqualTo("[{\"name\":\"https://test.com\",\"url\":\"https://test.com\"}]")); Assert.That(sut.GetValue("tags"), Is.EqualTo("this,is,tags")); } diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs index faf4acf8a4..19a57d7775 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContent.cs @@ -132,7 +132,7 @@ namespace Umbraco.Tests.TestHelpers.Entities content.SetValue("contentPicker", Udi.Create(Constants.UdiEntityType.Document, new Guid("74ECA1D4-934E-436A-A7C7-36CC16D4095C")).ToString()); content.SetValue("mediaPicker", Udi.Create(Constants.UdiEntityType.Media, new Guid("44CB39C8-01E5-45EB-9CF8-E70AAF2D1691")).ToString()); content.SetValue("memberPicker", Udi.Create(Constants.UdiEntityType.Member, new Guid("9A50A448-59C0-4D42-8F93-4F1D55B0F47D")).ToString()); - content.SetValue("relatedLinks", ""); + content.SetValue("multiUrlPicker", "[{\"name\":\"https://test.com\",\"url\":\"https://test.com\"}]"); content.SetValue("tags", "this,is,tags"); return content; diff --git a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs index 14b967b1c9..d7dcf8e79a 100644 --- a/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs +++ b/src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs @@ -370,7 +370,7 @@ namespace Umbraco.Tests.TestHelpers.Entities contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.ContentPicker, ValueStorageType.Integer) { Alias = "contentPicker", Name = "Content Picker", Mandatory = false, SortOrder = 16, DataTypeId = 1046 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MediaPicker, ValueStorageType.Integer) { Alias = "mediaPicker", Name = "Media Picker", Mandatory = false, SortOrder = 17, DataTypeId = 1048 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MemberPicker, ValueStorageType.Integer) { Alias = "memberPicker", Name = "Member Picker", Mandatory = false, SortOrder = 18, DataTypeId = 1047 }); - contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.RelatedLinks, ValueStorageType.Ntext) { Alias = "relatedLinks", Name = "Related Links", Mandatory = false, SortOrder = 21, DataTypeId = 1050 }); + contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.MultiUrlPicker, ValueStorageType.Nvarchar) { Alias = "multiUrlPicker", Name = "Multi URL Picker", Mandatory = false, SortOrder = 21, DataTypeId = 1050 }); contentCollection.Add(new PropertyType(Constants.PropertyEditors.Aliases.Tags, ValueStorageType.Ntext) { Alias = "tags", Name = "Tags", Mandatory = false, SortOrder = 22, DataTypeId = 1041 }); contentType.PropertyGroups.Add(new PropertyGroup(contentCollection) { Name = "Content", SortOrder = 1 }); diff --git a/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs b/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs index cc83dcb1c9..ba19f41e74 100644 --- a/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/HtmlHelperExtensionMethodsTests.cs @@ -29,30 +29,5 @@ namespace Umbraco.Tests.Web.Mvc var output = _htmlHelper.Wrap("div", "hello world", new {style = "color:red;", onclick = "void();"}); Assert.AreEqual("
hello world
", output.ToHtmlString()); } - - [Test] - public void GetRelatedLinkHtml_Simple() - { - var relatedLink = new Umbraco.Web.Models.RelatedLink { - Caption = "Link Caption", - NewWindow = true, - Link = "https://www.google.com/" - }; - var output = _htmlHelper.GetRelatedLinkHtml(relatedLink); - Assert.AreEqual("Link Caption", output.ToHtmlString()); - } - - [Test] - public void GetRelatedLinkHtml_HtmlAttributes() - { - var relatedLink = new Umbraco.Web.Models.RelatedLink - { - Caption = "Link Caption", - NewWindow = true, - Link = "https://www.google.com/" - }; - var output = _htmlHelper.GetRelatedLinkHtml(relatedLink, new { @class = "test-class"}); - Assert.AreEqual("Link Caption", output.ToHtmlString()); - } } } diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 626a19a369..1186102bc8 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -830,39 +830,5 @@ namespace Umbraco.Web } #endregion - - - #region RelatedLink - - /// - /// Renders an anchor element for a RelatedLink instance. - /// Format: <a href="relatedLink.Link" target="_blank/_self">relatedLink.Caption</a> - /// - /// The HTML helper instance that this method extends. - /// The RelatedLink instance - /// An anchor element - public static MvcHtmlString GetRelatedLinkHtml(this HtmlHelper htmlHelper, RelatedLink relatedLink) - { - return htmlHelper.GetRelatedLinkHtml(relatedLink, null); - } - - /// - /// Renders an anchor element for a RelatedLink instance, accepting htmlAttributes. - /// Format: <a href="relatedLink.Link" target="_blank/_self" htmlAttributes>relatedLink.Caption</a> - /// - /// The HTML helper instance that this method extends. - /// The RelatedLink instance - /// An object that contains the HTML attributes to set for the element. - /// - public static MvcHtmlString GetRelatedLinkHtml(this HtmlHelper htmlHelper, RelatedLink relatedLink, object htmlAttributes) - { - var tagBuilder = new TagBuilder("a"); - tagBuilder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); - tagBuilder.MergeAttribute("href", relatedLink.Link); - tagBuilder.MergeAttribute("target", relatedLink.NewWindow ? "_blank" : "_self"); - tagBuilder.InnerHtml = HttpUtility.HtmlEncode(relatedLink.Caption); - return MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.Normal)); - } - #endregion } } diff --git a/src/Umbraco.Web/Models/RelatedLink.cs b/src/Umbraco.Web/Models/RelatedLink.cs deleted file mode 100644 index 1e1d7636ad..0000000000 --- a/src/Umbraco.Web/Models/RelatedLink.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Umbraco.Core.Models.PublishedContent; - -namespace Umbraco.Web.Models -{ - public class RelatedLink : RelatedLinkBase - { - public int? Id { get; internal set; } - internal bool IsDeleted { get; set; } - public IPublishedContent Content { get; set; } - } -} diff --git a/src/Umbraco.Web/Models/RelatedLinkBase.cs b/src/Umbraco.Web/Models/RelatedLinkBase.cs deleted file mode 100644 index c2077ce4a9..0000000000 --- a/src/Umbraco.Web/Models/RelatedLinkBase.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Newtonsoft.Json; - -namespace Umbraco.Web.Models -{ - public abstract class RelatedLinkBase - { - [JsonProperty("caption")] - public string Caption { get; set; } - [JsonProperty("link")] - public string Link { get; set; } - [JsonProperty("newWindow")] - public bool NewWindow { get; set; } - [JsonProperty("isInternal")] - public bool IsInternal { get; set; } - [JsonProperty("type")] - public RelatedLinkType Type { get; set; } - } -} diff --git a/src/Umbraco.Web/Models/RelatedLinkType.cs b/src/Umbraco.Web/Models/RelatedLinkType.cs deleted file mode 100644 index eec7817ab6..0000000000 --- a/src/Umbraco.Web/Models/RelatedLinkType.cs +++ /dev/null @@ -1,27 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// -// Umbraco -// -// -// Defines the RelatedLinkType type. -// -// -------------------------------------------------------------------------------------------------------------------- - -namespace Umbraco.Web.Models -{ - /// - /// The related link type. - /// - public enum RelatedLinkType - { - /// - /// Internal link type - /// - Internal, - - /// - /// External link type - /// - External - } -} diff --git a/src/Umbraco.Web/Models/RelatedLinks.cs b/src/Umbraco.Web/Models/RelatedLinks.cs deleted file mode 100644 index 22cdcd11b6..0000000000 --- a/src/Umbraco.Web/Models/RelatedLinks.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; - -namespace Umbraco.Web.Models -{ - [TypeConverter(typeof(RelatedLinksTypeConverter))] - public class RelatedLinks : IEnumerable - { - private readonly string _propertyData; - - private readonly IEnumerable _relatedLinks; - - public RelatedLinks(IEnumerable relatedLinks, string propertyData) - { - _relatedLinks = relatedLinks; - _propertyData = propertyData; - } - - /// - /// Gets the property data. - /// - internal string PropertyData - { - get - { - return this._propertyData; - } - } - - public IEnumerator GetEnumerator() - { - return _relatedLinks.GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return this.GetEnumerator(); - } - } -} diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs deleted file mode 100644 index 5db14c6842..0000000000 --- a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfiguration.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Umbraco.Core.PropertyEditors; - -namespace Umbraco.Web.PropertyEditors -{ - /// - /// Represents the configuration for the related links value editor. - /// - public class RelatedLinksConfiguration - { - [ConfigurationField("max", "Maximum number of links", "number", Description = "Enter the maximum amount of links to be added, enter 0 for unlimited")] - public int Maximum { get; set; } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs deleted file mode 100644 index 07ff359a82..0000000000 --- a/src/Umbraco.Web/PropertyEditors/RelatedLinksConfigurationEditor.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Collections.Generic; -using Umbraco.Core.PropertyEditors; - -namespace Umbraco.Web.PropertyEditors -{ - /// - /// Represents the configuration editor for the related links value editor. - /// - public class RelatedLinksConfigurationEditor : ConfigurationEditor - { - public override IDictionary ToValueEditor(object configuration) - { - var d = base.ToValueEditor(configuration); - d["idType"] = "udi"; - return d; - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs deleted file mode 100644 index b450fcc67f..0000000000 --- a/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Umbraco.Core; -using Umbraco.Core.Logging; -using Umbraco.Core.PropertyEditors; - -namespace Umbraco.Web.PropertyEditors -{ - [DataEditor(Constants.PropertyEditors.Aliases.RelatedLinks, "Related links", "relatedlinks", ValueType = ValueTypes.Json, Icon = "icon-thumbnail-list", Group = "pickers")] - public class RelatedLinksPropertyEditor : DataEditor - { - public RelatedLinksPropertyEditor(ILogger logger) - : base(logger) - { } - - protected override IConfigurationEditor CreateConfigurationEditor() => new RelatedLinksConfigurationEditor(); - } -} diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs deleted file mode 100644 index 6c2a4331d0..0000000000 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksLegacyValueConverter.cs +++ /dev/null @@ -1,132 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Xml; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Umbraco.Core; -using Umbraco.Core.Cache; -using Umbraco.Core.Logging; -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.PropertyEditors; -using Umbraco.Core.PropertyEditors.ValueConverters; -using Umbraco.Core.Services; - -namespace Umbraco.Web.PropertyEditors.ValueConverters -{ - [DefaultPropertyValueConverter(typeof(JsonValueConverter))] //this shadows the JsonValueConverter - public class RelatedLinksLegacyValueConverter : PropertyValueConverterBase - { - private static readonly string[] MatchingEditors = { - Constants.PropertyEditors.Aliases.RelatedLinks - }; - - private readonly IUmbracoContextAccessor _umbracoContextAccessor; - private readonly ILogger _logger; - private readonly ServiceContext _services; - - public RelatedLinksLegacyValueConverter(IUmbracoContextAccessor umbracoContextAccessor, ServiceContext services, ILogger logger) - { - _umbracoContextAccessor = umbracoContextAccessor; - _services = services; - _logger = logger; - } - - public override bool IsConverter(PublishedPropertyType propertyType) - => MatchingEditors.Contains(propertyType.EditorAlias); - - public override Type GetPropertyValueType(PublishedPropertyType propertyType) - => typeof (JArray); - - public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType) - => PropertyCacheLevel.Element; - - public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) - { - if (source == null) return null; - var sourceString = source.ToString(); - - if (sourceString.DetectIsJson()) - { - try - { - var obj = JsonConvert.DeserializeObject(sourceString); - //update the internal links if we have a context - if (UmbracoContext.Current != null) - { - var helper = new UmbracoHelper(_umbracoContextAccessor.UmbracoContext, _services); - foreach (var a in obj) - { - var type = a.Value("type"); - if (type.IsNullOrWhiteSpace() == false) - { - if (type == "internal") - { - switch (propertyType.EditorAlias) - { - case Constants.PropertyEditors.Aliases.RelatedLinks: - var strLinkId = a.Value("link"); - var udiAttempt = strLinkId.TryConvertTo(); - if (udiAttempt) - { - var content = helper.PublishedContent(udiAttempt.Result); - if (content == null) break; - a["link"] = helper.Url(content.Id); - } - break; - } - } - } - } - } - return obj; - } - catch (Exception ex) - { - _logger.Error(ex, "Could not parse the string '{Json}' to a json object", sourceString); - } - } - - //it's not json, just return the string - return sourceString; - } - - public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object source, bool preview) - { - if (source == null) return null; - var sourceString = source.ToString(); - - if (sourceString.DetectIsJson()) - { - try - { - var obj = JsonConvert.DeserializeObject(sourceString); - - var d = new XmlDocument(); - var e = d.CreateElement("links"); - d.AppendChild(e); - - foreach (dynamic link in obj) - { - var ee = d.CreateElement("link"); - ee.SetAttribute("title", link.title); - ee.SetAttribute("link", link.link); - ee.SetAttribute("type", link.type); - ee.SetAttribute("newwindow", link.newWindow); - - e.AppendChild(ee); - } - - return d.CreateNavigator(); - } - catch (Exception ex) - { - _logger.Error(ex, "Could not parse the string '{Json}' to a json object", sourceString); - } - } - - //it's not json, just return the string - return sourceString; - } - } -} diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs deleted file mode 100644 index 983d122a83..0000000000 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/RelatedLinksValueConverter.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Xml; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Umbraco.Core; -using Umbraco.Core.Logging; -using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.PropertyEditors; -using Umbraco.Core.PropertyEditors.ValueConverters; -using Umbraco.Web.Models; -using Umbraco.Web.PublishedCache; - -namespace Umbraco.Web.PropertyEditors.ValueConverters -{ - /// - /// The related links property value converter. - /// - [DefaultPropertyValueConverter(typeof(RelatedLinksLegacyValueConverter), typeof(JsonValueConverter))] - public class RelatedLinksValueConverter : PropertyValueConverterBase - { - private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; - private readonly IUmbracoContextAccessor _umbracoContextAccessor; - private readonly ILogger _logger; - - public RelatedLinksValueConverter(IPublishedSnapshotAccessor publishedSnapshotAccessor, IUmbracoContextAccessor umbracoContextAccessor, ILogger logger) - { - _publishedSnapshotAccessor = publishedSnapshotAccessor; - _umbracoContextAccessor = umbracoContextAccessor; - _logger = logger; - } - - /// - /// Checks if this converter can convert the property editor and registers if it can. - /// - /// - /// The property type. - /// - /// - /// The . - /// - public override bool IsConverter(PublishedPropertyType propertyType) - => propertyType.EditorAlias.Equals(Constants.PropertyEditors.Aliases.RelatedLinks); - - public override Type GetPropertyValueType(PublishedPropertyType propertyType) - => typeof (JArray); - - public override PropertyCacheLevel GetPropertyCacheLevel(PublishedPropertyType propertyType) - => PropertyCacheLevel.Element; - - public override object ConvertSourceToIntermediate(IPublishedElement owner, PublishedPropertyType propertyType, object source, bool preview) - { - if (source == null) return null; - var sourceString = source.ToString(); - - var relatedLinksData = JsonConvert.DeserializeObject>(sourceString); - var relatedLinks = new List(); - - foreach (var linkData in relatedLinksData) - { - var relatedLink = new RelatedLink - { - Caption = linkData.Caption, - NewWindow = linkData.NewWindow, - IsInternal = linkData.IsInternal, - Type = linkData.Type, - Link = linkData.Link - }; - - int contentId; - if (int.TryParse(relatedLink.Link, out contentId)) - { - relatedLink.Id = contentId; - relatedLink = CreateLink(relatedLink); - } - else - { - var strLinkId = linkData.Link; - var udiAttempt = strLinkId.TryConvertTo(); - if (udiAttempt.Success && udiAttempt.Result != null) - { - var content = _publishedSnapshotAccessor.PublishedSnapshot.Content.GetById(udiAttempt.Result.Guid); - if (content != null) - { - relatedLink.Id = content.Id; - relatedLink = CreateLink(relatedLink); - relatedLink.Content = content; - } - } - } - - if (relatedLink.IsDeleted == false) - { - relatedLinks.Add(relatedLink); - } - else - { - _logger.Warn("Related Links value converter skipped a link as the node has been unpublished/deleted (Internal Link NodeId: {RelatedLinkNodeId}, Link Caption: '{RelatedLinkCaption}')", relatedLink.Link, relatedLink.Caption); - } - } - - return new RelatedLinks(relatedLinks, sourceString); - } - - private RelatedLink CreateLink(RelatedLink link) - { - var umbracoContext = _umbracoContextAccessor.UmbracoContext; - - if (link.IsInternal && link.Id != null) - { - if (umbracoContext == null) - return null; - - var urlProvider = umbracoContext.UrlProvider; - - link.Link = urlProvider.GetUrl((int)link.Id); - if (link.Link.Equals("#")) - { - link.IsDeleted = true; - link.Link = link.Id.ToString(); - } - else - { - link.IsDeleted = false; - } - } - - return link; - } - - public override object ConvertIntermediateToXPath(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview) - { - if (inter == null) return null; - var sourceString = inter.ToString(); - - if (sourceString.DetectIsJson()) - { - try - { - var obj = JsonConvert.DeserializeObject(sourceString); - - var d = new XmlDocument(); - var e = d.CreateElement("links"); - d.AppendChild(e); - - foreach (dynamic link in obj) - { - var ee = d.CreateElement("link"); - ee.SetAttribute("title", link.title); - ee.SetAttribute("link", link.link); - ee.SetAttribute("type", link.type); - ee.SetAttribute("newwindow", link.newWindow); - - e.AppendChild(ee); - } - - return d.CreateNavigator(); - } - catch (Exception ex) - { - _logger.Error(ex, "Could not parse the string {Json} to a json object", sourceString); - } - } - - //it's not json, just return the string - return sourceString; - } - } -} diff --git a/src/Umbraco.Web/RelatedLinksTypeConverter.cs b/src/Umbraco.Web/RelatedLinksTypeConverter.cs deleted file mode 100644 index 647959b920..0000000000 --- a/src/Umbraco.Web/RelatedLinksTypeConverter.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.ComponentModel; -using System.Globalization; -using System.Linq; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -using Umbraco.Core; -using Umbraco.Core.Logging; -using Umbraco.Core.Composing; -using Umbraco.Web.Models; - -namespace Umbraco.Web -{ - public class RelatedLinksTypeConverter : TypeConverter - { - private readonly UmbracoHelper _umbracoHelper; - - public RelatedLinksTypeConverter(UmbracoHelper umbracoHelper) - { - _umbracoHelper = umbracoHelper; - } - - public RelatedLinksTypeConverter() - { - - } - - private static readonly Type[] ConvertableTypes = new[] - { - typeof(JArray) - }; - - public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) - { - return ConvertableTypes.Any(x => TypeHelper.IsTypeAssignableFrom(x, destinationType)) - || base.CanConvertFrom(context, destinationType); - } - - public override object ConvertTo( - ITypeDescriptorContext context, - CultureInfo culture, - object value, - Type destinationType) - { - var relatedLinks = value as RelatedLinks; - if (relatedLinks == null) - return null; - - if (TypeHelper.IsTypeAssignableFrom(destinationType)) - { - // Conversion to JArray taken from old value converter - - var obj = JsonConvert.DeserializeObject(relatedLinks.PropertyData); - - var umbracoHelper = GetUmbracoHelper(); - - //update the internal links if we have a context - if (umbracoHelper != null) - { - foreach (var a in obj) - { - var type = a.Value("type"); - if (type.IsNullOrWhiteSpace() == false) - { - if (type == "internal") - { - var linkId = a.Value("link"); - var link = umbracoHelper.Url(linkId); - a["link"] = link; - } - } - } - } - return obj; - - } - - return base.ConvertTo(context, culture, value, destinationType); - } - - private UmbracoHelper GetUmbracoHelper() - { - if (_umbracoHelper != null) - return _umbracoHelper; - - if (UmbracoContext.Current == null) - { - Current.Logger.Warn("Cannot create an UmbracoHelper the UmbracoContext is null"); - return null; - } - - //DO NOT assign to _umbracoHelper variable, this is a singleton class and we cannot assign this based on an UmbracoHelper which is request based - return new UmbracoHelper(UmbracoContext.Current, Current.Services); - } - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 6736f7512b..64a60d824a 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -404,10 +404,6 @@ - - - - @@ -453,9 +449,6 @@ - - - @@ -471,7 +464,6 @@ - @@ -535,7 +527,6 @@ - @@ -860,7 +851,6 @@ - From de8516d2c7bdc1a94b2ab5b1836b93a219db3c85 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Mon, 21 Jan 2019 19:02:52 +0100 Subject: [PATCH 43/76] Make it possible to create folders for stylesheets --- src/Umbraco.Core/Services/IFileService.cs | 13 +++++++ .../Services/Implement/FileService.cs | 18 ++++++++++ .../views/stylesheets/create.controller.js | 35 ++++++++++++++++++- .../src/views/stylesheets/create.html | 30 ++++++++++++++-- src/Umbraco.Web/Editors/CodeFileController.cs | 11 +++++- 5 files changed, 103 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Services/IFileService.cs b/src/Umbraco.Core/Services/IFileService.cs index a895eff7e1..d32c984b5e 100644 --- a/src/Umbraco.Core/Services/IFileService.cs +++ b/src/Umbraco.Core/Services/IFileService.cs @@ -108,6 +108,19 @@ namespace Umbraco.Core.Services /// void DeleteScriptFolder(string folderPath); + /// + /// Creates a folder for style sheets + /// + /// + /// + void CreateStyleSheetFolder(string folderPath); + + /// + /// Deletes a folder for style sheets + /// + /// + void DeleteStyleSheetFolder(string folderPath); + /// /// Gets a list of all objects /// diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index da82d38e36..888407c0d0 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -140,6 +140,24 @@ namespace Umbraco.Core.Services.Implement } } + public void CreateStyleSheetFolder(string folderPath) + { + using (var scope = ScopeProvider.CreateScope()) + { + ((StylesheetRepository) _stylesheetRepository).AddFolder(folderPath); + scope.Complete(); + } + } + + public void DeleteStyleSheetFolder(string folderPath) + { + using (var scope = ScopeProvider.CreateScope()) + { + ((StylesheetRepository) _stylesheetRepository).DeleteFolder(folderPath); + scope.Complete(); + } + } + public Stream GetStylesheetFileContentStream(string filepath) { using (var scope = ScopeProvider.CreateScope(autoComplete: true)) diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.controller.js index b37b16d4d6..6033a6bdc7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function StyleSheetsCreateController($scope, $location, navigationService) { + function StyleSheetsCreateController($scope, $location, navigationService, formHelper, codefileResource) { var vm = this; var node = $scope.currentNode; @@ -9,6 +9,9 @@ vm.createFile = createFile; vm.createRichtextStyle = createRichtextStyle; vm.close = close; + vm.creatingFolder = false; + vm.showCreateFolder = showCreateFolder; + vm.createFolder = createFolder; function createFile() { $location.path("/settings/stylesheets/edit/" + node.id).search("create", "true"); @@ -19,6 +22,36 @@ $location.path("/settings/stylesheets/edit/" + node.id).search("create", "true").search("rtestyle", "true"); navigationService.hideMenu(); } + + function showCreateFolder() { + vm.creatingFolder = true; + } + + function createFolder(form) { + + if (formHelper.submitForm({scope: $scope, formCtrl: form })) { + + codefileResource.createContainer("stylesheets", node.id, vm.folderName).then(function (saved) { + + navigationService.hideMenu(); + + navigationService.syncTree({ + tree: "stylesheets", + path: saved.path, + forceReload: true, + activate: true + }); + + formHelper.resetForm({ scope: $scope }); + + }, function(err) { + + vm.createFolderError = err; + + }); + } + + } function close() { const showMenu = true; diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.html b/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.html index 71811d2b07..0554c430d1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.html +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/create.html @@ -2,7 +2,7 @@ \ No newline at end of file + diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index e995fa50a3..ec72ca3df4 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -68,7 +68,7 @@ namespace Umbraco.Web.Editors } /// - /// Used to create a container/folder in 'partialViews', 'partialViewMacros' or 'scripts' + /// Used to create a container/folder in 'partialViews', 'partialViewMacros', 'scripts' or 'stylesheets' /// /// 'partialViews', 'partialViewMacros' or 'scripts' /// The virtual path of the parent. @@ -111,6 +111,10 @@ namespace Umbraco.Web.Editors virtualPath = NormalizeVirtualPath(name, SystemDirectories.Scripts); Services.FileService.CreateScriptFolder(virtualPath); break; + case Core.Constants.Trees.Stylesheets: + virtualPath = NormalizeVirtualPath(name, SystemDirectories.Css); + Services.FileService.CreateStyleSheetFolder(virtualPath); + break; } @@ -328,6 +332,11 @@ namespace Umbraco.Web.Editors return Request.CreateErrorResponse(HttpStatusCode.NotFound, "No Script or folder found with the specified path"); case Core.Constants.Trees.Stylesheets: + if (IsDirectory(virtualPath, SystemDirectories.Css)) + { + Services.FileService.DeleteStyleSheetFolder(virtualPath); + return Request.CreateResponse(HttpStatusCode.OK); + } if (Services.FileService.GetStylesheetByName(virtualPath) != null) { Services.FileService.DeleteStylesheet(virtualPath, Security.CurrentUser.Id); From 43a97185b61e778139c7e67b7894ad9c94d0f999 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Mon, 21 Jan 2019 19:03:16 +0100 Subject: [PATCH 44/76] Clean up file system tree controller handling of no-op for nodes --- src/Umbraco.Web/Trees/FileSystemTreeController.cs | 5 ++++- src/Umbraco.Web/Trees/FilesTreeController.cs | 6 ------ src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs | 6 ------ src/Umbraco.Web/Trees/PartialViewsTreeController.cs | 7 ------- src/Umbraco.Web/Trees/ScriptsTreeController.cs | 6 ------ 5 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/Umbraco.Web/Trees/FileSystemTreeController.cs b/src/Umbraco.Web/Trees/FileSystemTreeController.cs index 528e57773c..11160ab282 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -28,7 +28,10 @@ namespace Umbraco.Web.Trees /// Inheritors can override this method to modify the folder node that is created. ///
/// - protected virtual void OnRenderFolderNode(ref TreeNode treeNode) { } + protected virtual void OnRenderFolderNode(ref TreeNode treeNode) { + //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. + treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; + } protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { diff --git a/src/Umbraco.Web/Trees/FilesTreeController.cs b/src/Umbraco.Web/Trees/FilesTreeController.cs index 598eb713eb..99c4ade09e 100644 --- a/src/Umbraco.Web/Trees/FilesTreeController.cs +++ b/src/Umbraco.Web/Trees/FilesTreeController.cs @@ -15,11 +15,5 @@ namespace Umbraco.Web.Trees protected override string[] Extensions => ExtensionsStatic; protected override string FileIcon => "icon-document"; - - protected override void OnRenderFolderNode(ref TreeNode treeNode) - { - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. - treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; - } } } diff --git a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs index c874b01244..f8c3fe3e9a 100644 --- a/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewMacrosTreeController.cs @@ -23,11 +23,5 @@ namespace Umbraco.Web.Trees protected override string[] Extensions => ExtensionsStatic; protected override string FileIcon => "icon-article"; - - protected override void OnRenderFolderNode(ref TreeNode treeNode) - { - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. - treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; - } } } diff --git a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs index a7aa8f134e..113f907e12 100644 --- a/src/Umbraco.Web/Trees/PartialViewsTreeController.cs +++ b/src/Umbraco.Web/Trees/PartialViewsTreeController.cs @@ -23,12 +23,5 @@ namespace Umbraco.Web.Trees protected override string[] Extensions => ExtensionsStatic; protected override string FileIcon => "icon-article"; - - protected override void OnRenderFolderNode(ref TreeNode treeNode) - { - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. - treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; - treeNode.Icon = "icon-folder"; - } } } diff --git a/src/Umbraco.Web/Trees/ScriptsTreeController.cs b/src/Umbraco.Web/Trees/ScriptsTreeController.cs index 191c9a7f8e..2fbeae4f6b 100644 --- a/src/Umbraco.Web/Trees/ScriptsTreeController.cs +++ b/src/Umbraco.Web/Trees/ScriptsTreeController.cs @@ -16,11 +16,5 @@ namespace Umbraco.Web.Trees protected override string[] Extensions => ExtensionsStatic; protected override string FileIcon => "icon-script"; - - protected override void OnRenderFolderNode(ref TreeNode treeNode) - { - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. - treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; - } } } From c9819b2d89fe9b17a726c5b0afc045c1e87ffa29 Mon Sep 17 00:00:00 2001 From: Paul Seal Date: Sat, 26 Jan 2019 14:01:03 +0000 Subject: [PATCH 45/76] - disabled the duplicated community health checks (#4175) --- src/Umbraco.Web.UI/config/HealthChecks.config | 30 +++++++++---------- .../HealthCheck/HealthCheckController.cs | 4 +-- .../Scheduling/HealthCheckNotifier.cs | 2 +- src/Umbraco.Web/WebBootManager.cs | 13 ++++++++ 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/Umbraco.Web.UI/config/HealthChecks.config b/src/Umbraco.Web.UI/config/HealthChecks.config index 4e927e8bb6..5cb99e195b 100644 --- a/src/Umbraco.Web.UI/config/HealthChecks.config +++ b/src/Umbraco.Web.UI/config/HealthChecks.config @@ -8,19 +8,19 @@ For details on the format of this configuration file see: https://our.umbraco.com/documentation/reference/config/healthchecks --> - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs index 34d201d5fe..dee62e936b 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckController.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckController.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.HealthCheck public object GetStatus(Guid id) { var check = GetCheckById(id); - + try { //Core.Logging.LogHelper.Debug("Running health check: " + check.Name); @@ -113,4 +113,4 @@ namespace Umbraco.Web.HealthCheck return check; } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs b/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs index d6e72f936b..7d42a90e58 100644 --- a/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs +++ b/src/Umbraco.Web/Scheduling/HealthCheckNotifier.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.Scheduling private readonly ApplicationContext _appContext; private readonly IHealthCheckResolver _healthCheckResolver; - public HealthCheckNotifier(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds, + public HealthCheckNotifier(IBackgroundTaskRunner runner, int delayMilliseconds, int periodMilliseconds, ApplicationContext appContext) : base(runner, delayMilliseconds, periodMilliseconds) { diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index dbab3d2346..faf1418b42 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -544,6 +544,19 @@ namespace Umbraco.Web () => PluginManager.ResolveTypes()); HealthCheckNotificationMethodResolver.Current = new HealthCheckNotificationMethodResolver(LoggerResolver.Current.Logger, () => PluginManager.ResolveTypes()); + + // Disable duplicate community health checks which appear in Our.Umbraco.HealtchChecks and Umbraco Core. + // See this issue to understand why https://github.com/umbraco/Umbraco-CMS/issues/4174 + var disabledHealthCheckTypes = new[] + { + "Our.Umbraco.HealthChecks.Checks.Security.HstsCheck", + "Our.Umbraco.HealthChecks.Checks.Security.TlsCheck" + }.Select(TypeFinder.GetTypeByName).WhereNotNull(); + + foreach (var type in disabledHealthCheckTypes) + { + HealthCheckResolver.Current.RemoveType(type); + } } /// From 7a2f09643abf4ba9db5e648c8a816e0e6c95d37f Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Wed, 23 Jan 2019 23:50:02 +0100 Subject: [PATCH 46/76] Changed health check to indicate HTTPS endpoint connectivity using TLS 1.2 --- .../Umbraco/config/lang/zh_tw.xml | 3 -- src/Umbraco.Web.UI/umbraco/config/lang/en.xml | 4 +- .../umbraco/config/lang/en_us.xml | 4 +- src/Umbraco.Web.UI/umbraco/config/lang/fr.xml | 3 -- src/Umbraco.Web.UI/umbraco/config/lang/nl.xml | 4 +- src/Umbraco.Web.UI/umbraco/config/lang/pl.xml | 3 -- src/Umbraco.Web.UI/umbraco/config/lang/ru.xml | 3 -- src/Umbraco.Web.UI/umbraco/config/lang/zh.xml | 3 -- .../HealthCheck/Checks/Security/TlsCheck.cs | 51 ------------------ .../HealthCheck/Checks/Services/Tls12Check.cs | 52 +++++++++++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 2 +- 11 files changed, 59 insertions(+), 73 deletions(-) delete mode 100644 src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs create mode 100644 src/Umbraco.Web/HealthCheck/Checks/Services/Tls12Check.cs diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml index ba30581267..d765b7cecf 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/zh_tw.xml @@ -1331,9 +1331,6 @@ SMTP伺服器 %0% : %1% 無法連接。請確認在Web.config 檔案中 system.net/mailsettings 設定正確。 %0%。]]> %0%。]]> - - 您的網站設置為使用TLS 1.2或更高版本進行傳出連接。 - 來自您網站的傳出連接通過舊協議提供。您應該考慮將其更新為使用TLS 1.2或更高版本。 停止網址追蹤器 diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 06a7fbb109..53a58bd7b1 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -2207,8 +2207,8 @@ To manage your website, simply open the Umbraco back office and start adding con

Results of the scheduled Umbraco Health Checks run on %0% at %1% are as follows:

%2%]]>
Umbraco Health Check Status: %0% - Your website is set up to use TLS 1.2 or greater for outgoing connections. - Outgoing connections from your website are being served over an old protocol. You should consider updating it to use TLS 1.2 or higher. + Your site can use the TLS 1.2 security protocol when making outbound connections to HTTPS endpoints. + Your site isn't configured to allow the TLS 1.2 security protocol when making outbound connections: some HTTPS endpoints might not be reachable using a less secure protocol. Disable URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 766d2eec9e..a2b7e6d040 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -2200,8 +2200,8 @@ To manage your website, simply open the Umbraco back office and start adding con

Results of the scheduled Umbraco Health Checks run on %0% at %1% are as follows:

%2%]]>
Umbraco Health Check Status: %0% - Your website is set up to use TLS 1.2 or greater for outgoing connections. - Outgoing connections from your website are being served over an old protocol. You should consider updating it to use TLS 1.2 or higher. + Your site can use the TLS 1.2 security protocol when making outbound connections to HTTPS endpoints. + Your site isn't configured to allow the TLS 1.2 security protocol when making outbound connections: some HTTPS endpoints might not be reachable using a less secure protocol. Disable URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml index dab9f49120..fd2b4c53a8 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml @@ -2170,9 +2170,6 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à %0%.]]>

Les résultats de l'exécution du Umbraco Health Checks planifiée le %0% à %1% sont les suivants :

%2%]]>
Statut du Umbraco Health Check: %0% - - Votre site Web est configuré pour utiliser TLS version 1.2 ou supérieure pour les connexions sortantes. - Les connexions sortantes de votre site Web sont servies via un ancien protocole. Vous devriez envisager de le mettre à jour pour utiliser TLS 1.2 ou supérieur. Désactiver URL tracker diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml index 4680d0dfc5..dc867823c2 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml @@ -1624,8 +1624,8 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de %0%.]]> %0%.]]> - Uw website is ingesteld om TLS 1.2 of hoger te gebruiken voor uitgaande verbindingen. - Uitgaande verbindingen van uw website worden via een oud protocol bediend. U zou moeten overwegen om het bij te werken om TLS 1.2 of hoger te gebruiken. + Uw website kan het TLS 1.2 beveiligingsprotocol gebruiken bij het maken van uitgaande verbindingen naar HTTPS-eindpunten. + Uw website is niet geconfigureerd om het TLS 1.2 beveiligingsprotocol te kunnen gebruiken bij het maken van uitgaande verbindingen: sommige HTTPS-eindpunten zijn mogelijk niet bereikbaar via een minder veilig protocol. URL tracker uitzetten diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml index bb36628757..9affa43727 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml @@ -1674,9 +1674,6 @@ Naciśnij przycisk instaluj, aby zainstalować bazę danych Umb %0%.]]> %0%.]]> - - Twoja strona internetowa jest skonfigurowana do używania protokołu TLS 1.2 lub nowszego dla połączeń wychodzących. - Połączenia wychodzące z Twojej witryny są obsługiwane przez stary protokół. Należy rozważyć zaktualizowanie go do korzystania z TLS w wersji 1.2 lub nowszej. Wyłącz śledzenie URL diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index 37a4613d43..fd33e647ad 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -870,9 +870,6 @@ %0%.]]>

Зафиксированы следующие результаты автоматической проверки состояния Umbraco по расписанию, запущенной на %0% в %1%:

%2%]]>
Результат проверки состояния Umbraco: %0% - - Ваш веб-сайт настроен на использование TLS 1.2 или выше для исходящих соединений. - Исходящие соединения с вашего сайта обслуживаются по старому протоколу. Вы должны рассмотреть возможность его обновления для использования TLS 1.2 или выше. перейти к diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml index 471925ccd5..a918b78f95 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml @@ -1598,9 +1598,6 @@ The SMTP server configured with host '%0%' and port '%1%' could not be reached. Please check to ensure the SMTP settings in the Web.config file system.net/mailsettings are correct. %0%.]]> %0%.]]> - - 您的网站设置为使用TLS 1.2或更高版本进行传出连接。 - 来自您网站的传出连接通过旧协议提供。您应该考虑将其更新为使用TLS 1.2或更高版本。 禁用 url 跟踪程序 diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs deleted file mode 100644 index 8d41965395..0000000000 --- a/src/Umbraco.Web/HealthCheck/Checks/Security/TlsCheck.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Net; -using Umbraco.Core.Services; - -namespace Umbraco.Web.HealthCheck.Checks.Security -{ - [HealthCheck("6D7D4E11-758E-4697-BA72-7E02A530CBD4", - "TLS Check", - Description = "Checks that your site is set up to use at least TLS 1.2 for outgoing connections.", - Group = "Security")] - public class TlsCheck : HealthCheck - { - private readonly ILocalizedTextService _textService; - - public TlsCheck(HealthCheckContext healthCheckContext) : base(healthCheckContext) - { - _textService = healthCheckContext.ApplicationContext.Services.TextService; - } - - public override IEnumerable GetStatus() - { - return new[] { CheckTls() }; - } - - public override HealthCheckStatus ExecuteAction(HealthCheckAction action) - { - throw new InvalidOperationException("TlsCheck has no executable actions"); - } - - public HealthCheckStatus CheckTls() - { - bool success = (int)ServicePointManager.SecurityProtocol >= (int)SecurityProtocolType.Tls12; - - string message = success - ? _textService.Localize("healthcheck/tlsHealthCheckSuccess") - : _textService.Localize("healthcheck/tlsHealthCheckWarn"); - - var actions = new List(); - - return - new HealthCheckStatus(message) - { - ResultType = success - ? StatusResultType.Success - : StatusResultType.Warning, - Actions = actions - }; - } - } -} diff --git a/src/Umbraco.Web/HealthCheck/Checks/Services/Tls12Check.cs b/src/Umbraco.Web/HealthCheck/Checks/Services/Tls12Check.cs new file mode 100644 index 0000000000..d93fa28b49 --- /dev/null +++ b/src/Umbraco.Web/HealthCheck/Checks/Services/Tls12Check.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.Net; +using Umbraco.Core.Services; + +namespace Umbraco.Web.HealthCheck.Checks.Services +{ + [HealthCheck("6D7D4E11-758E-4697-BA72-7E02A530CBD4", + "HTTPS endpoints (TLS 1.2)", + Description = "Checks whether the TLS 1.2 security protocol can be used when making outbound connections to HTTPS endpoints.", + Group = "Services")] + public class Tls12Check : HealthCheck + { + private readonly ILocalizedTextService _textService; + + public Tls12Check(HealthCheckContext healthCheckContext) : base(healthCheckContext) + { + _textService = healthCheckContext.ApplicationContext.Services.TextService; + } + + public override IEnumerable GetStatus() + { + return new[] { CheckTls() }; + } + + public override HealthCheckStatus ExecuteAction(HealthCheckAction action) + { + throw new InvalidOperationException("This check has no executable actions."); + } + + public HealthCheckStatus CheckTls() + { + // When set to 0 (SystemDefault), allows the operating system to choose the best protocol to use, and to block protocols that are not secure (this allows TLS 1.2 by default). + var success = ServicePointManager.SecurityProtocol == 0 || + ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12); + + var message = success + ? _textService.Localize("healthcheck/tls12HealthCheckSuccess") + : _textService.Localize("healthcheck/tls12HealthCheckWarn"); + + var actions = new List(); + + return new HealthCheckStatus(message) + { + ResultType = success + ? StatusResultType.Success + : StatusResultType.Warning, + Actions = actions + }; + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index a66e960e97..036cb96b50 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -338,7 +338,7 @@ - + From a13a38a482336440962e18aa607fa7c4f5b88ba9 Mon Sep 17 00:00:00 2001 From: Chris Houston Date: Sat, 26 Jan 2019 09:42:14 -0500 Subject: [PATCH 47/76] Updated all the TODO: comments in the Umbraco.Core project so they are all in the same format. ( // TODO: ) (#4220) Also moved some of the comments so they are will work better / are not within Code Documentation comments --- src/Umbraco.Core/Composing/Lifetime.cs | 2 +- .../Events/QueuingEventDispatcher.cs | 2 +- src/Umbraco.Core/IO/FileSystems.cs | 2 +- src/Umbraco.Core/IO/PhysicalFileSystem.cs | 2 +- .../Migrations/IMigrationExpression.cs | 2 +- .../Migrations/Install/DatabaseSchemaResult.cs | 2 +- src/Umbraco.Core/Models/ContentBase.cs | 4 ++-- src/Umbraco.Core/Models/ContentTypeBase.cs | 2 +- src/Umbraco.Core/Models/GridValue.cs | 4 ++-- src/Umbraco.Core/Models/IContent.cs | 2 +- .../Models/IContentTypeComposition.cs | 2 +- .../Models/Identity/BackOfficeIdentityUser.cs | 4 ++-- src/Umbraco.Core/Models/MediaExtensions.cs | 2 +- src/Umbraco.Core/Models/Membership/User.cs | 2 +- .../Models/Packaging/CompiledPackage.cs | 16 ++++++++-------- src/Umbraco.Core/Models/Property.cs | 4 ++-- src/Umbraco.Core/Models/PropertyCollection.cs | 2 +- .../Models/PropertyGroupCollection.cs | 2 +- .../Models/PropertyTagsExtensions.cs | 2 +- src/Umbraco.Core/Models/PropertyType.cs | 6 +++--- .../Models/PropertyTypeCollection.cs | 4 ++-- .../PublishedContent/IPublishedContent.cs | 2 +- .../PublishedContent/PublishedContentType.cs | 8 +++++--- .../PublishedContent/PublishedPropertyType.cs | 2 +- .../Persistence/Constants-DatabaseSchema.cs | 4 ++-- .../Dtos/ContentVersionCultureVariationDto.cs | 4 ++-- .../Persistence/Dtos/ContentVersionDto.cs | 6 +++--- .../Persistence/Dtos/DataTypeDto.cs | 2 +- src/Umbraco.Core/Persistence/Dtos/NodeDto.cs | 4 ++-- .../Persistence/Factories/ContentBaseFactory.cs | 10 +++++----- src/Umbraco.Core/Persistence/LocalDb.cs | 4 ++-- .../Persistence/NPocoDatabaseExtensions-Bulk.cs | 6 +++--- .../Persistence/NPocoDatabaseExtensions.cs | 4 ++-- .../Persistence/NPocoSqlExtensions.cs | 4 ++-- .../Querying/ExpressionVisitorBase.cs | 2 +- .../Implement/ContentRepositoryBase.cs | 12 ++++++------ .../Implement/ContentTypeRepositoryBase.cs | 3 +-- .../Implement/DocumentRepository.cs | 17 ++++++++--------- .../Repositories/Implement/EntityRepository.cs | 16 ++++++++-------- .../Repositories/Implement/MediaRepository.cs | 4 ++-- .../Implement/MemberGroupRepository.cs | 2 +- .../Repositories/Implement/MemberRepository.cs | 14 +++++++------- .../Implement/NPocoRepositoryBase.cs | 2 +- .../Implement/RepositoryBaseOfTIdTEntity.cs | 2 +- .../Implement/ServerRegistrationRepository.cs | 2 +- .../Repositories/Implement/UserRepository.cs | 4 ++-- .../Persistence/SqlSyntaxExtensions.cs | 2 +- src/Umbraco.Core/Persistence/UmbracoDatabase.cs | 4 ++-- .../Persistence/UmbracoDatabaseFactory.cs | 8 ++++---- src/Umbraco.Core/PropertyEditors/DataEditor.cs | 4 ++-- .../PropertyEditors/DataValueEditor.cs | 2 +- src/Umbraco.Core/PropertyEditors/IDataEditor.cs | 2 +- .../PropertyEditors/IDataValueEditor.cs | 4 ++-- .../ManifestValueValidatorCollection.cs | 2 +- .../TagsPropertyEditorAttribute.cs | 2 +- .../ValueConverters/SliderValueConverter.cs | 2 +- src/Umbraco.Core/Scoping/Scope.cs | 6 +++--- src/Umbraco.Core/Scoping/ScopeContext.cs | 5 +---- src/Umbraco.Core/Services/IContentService.cs | 2 +- src/Umbraco.Core/Services/IEntityService.cs | 3 ++- .../Services/IEntityXmlSerializer.cs | 2 +- .../Services/Implement/ContentService.cs | 10 +++++----- ...TypeServiceBaseOfTRepositoryTItemTService.cs | 2 +- .../Services/Implement/DataTypeService.cs | 8 ++++---- .../Services/Implement/EntityService.cs | 2 +- .../Services/Implement/EntityXmlSerializer.cs | 2 +- .../Services/Implement/FileService.cs | 2 +- .../Services/Implement/MediaService.cs | 4 ++-- .../Services/Implement/MemberService.cs | 2 +- .../Services/Implement/NotificationService.cs | 2 +- .../Services/Implement/RelationService.cs | 2 +- .../Implement/ScopeRepositoryService.cs | 2 +- .../Services/Implement/UserService.cs | 4 ++-- src/Umbraco.Core/Services/OperationResult.cs | 5 ++--- .../Services/OperationResultType.cs | 2 +- src/Umbraco.Core/Services/PublishResultType.cs | 2 +- .../Strings/Utf8ToAsciiConverter.cs | 3 +-- src/Umbraco.Core/Sync/ApplicationUrlHelper.cs | 2 +- .../Sync/DatabaseServerMessenger.cs | 2 +- 79 files changed, 157 insertions(+), 161 deletions(-) diff --git a/src/Umbraco.Core/Composing/Lifetime.cs b/src/Umbraco.Core/Composing/Lifetime.cs index a35d4d9ecf..1a2cc3119a 100644 --- a/src/Umbraco.Core/Composing/Lifetime.cs +++ b/src/Umbraco.Core/Composing/Lifetime.cs @@ -15,7 +15,7 @@ /// /// One unique instance per request. /// - // TODO - review lifetimes for LightInject vs other containers + // TODO: review lifetimes for LightInject vs other containers // currently, corresponds to 'Request' in LightInject which is 'Transient + disposed by Scope' // but NOT (in LightInject) a per-web-request lifetime, more a TransientScoped // diff --git a/src/Umbraco.Core/Events/QueuingEventDispatcher.cs b/src/Umbraco.Core/Events/QueuingEventDispatcher.cs index 164b452f2c..88b527e753 100644 --- a/src/Umbraco.Core/Events/QueuingEventDispatcher.cs +++ b/src/Umbraco.Core/Events/QueuingEventDispatcher.cs @@ -34,7 +34,7 @@ namespace Umbraco.Core.Events private IMediaFileSystem _mediaFileSystem; - // todo: inject + // TODO: inject private IMediaFileSystem MediaFileSystem => _mediaFileSystem ?? (_mediaFileSystem = Current.MediaFileSystem); } } diff --git a/src/Umbraco.Core/IO/FileSystems.cs b/src/Umbraco.Core/IO/FileSystems.cs index 38cb7df824..19d29e14ba 100644 --- a/src/Umbraco.Core/IO/FileSystems.cs +++ b/src/Umbraco.Core/IO/FileSystems.cs @@ -132,7 +132,7 @@ namespace Umbraco.Core.IO _scriptsFileSystem = new ShadowWrapper(scriptsFileSystem, "scripts", IsScoped); _mvcViewsFileSystem = new ShadowWrapper(mvcViewsFileSystem, "Views", IsScoped); - // todo - do we need a lock here? + // TODO: do we need a lock here? _shadowWrappers.Add(_macroPartialFileSystem); _shadowWrappers.Add(_partialViewsFileSystem); _shadowWrappers.Add(_stylesheetsFileSystem); diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index 80f4c57ee3..acf5e796e4 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -153,7 +153,7 @@ namespace Umbraco.Core.IO if (directory == null) throw new InvalidOperationException("Could not get directory."); Directory.CreateDirectory(directory); // ensure it exists - if (stream.CanSeek) // todo - what if we cannot? + if (stream.CanSeek) // TODO: what if we cannot? stream.Seek(0, 0); using (var destination = (Stream) File.Create(fullPath)) diff --git a/src/Umbraco.Core/Migrations/IMigrationExpression.cs b/src/Umbraco.Core/Migrations/IMigrationExpression.cs index 81063bd2da..c60126f63c 100644 --- a/src/Umbraco.Core/Migrations/IMigrationExpression.cs +++ b/src/Umbraco.Core/Migrations/IMigrationExpression.cs @@ -5,7 +5,7 @@ ///
public interface IMigrationExpression { - string Process(IMigrationContext context); // todo: remove that one? + string Process(IMigrationContext context); // TODO: remove that one? void Execute(); } } diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaResult.cs b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaResult.cs index d3f6937834..f21216fde3 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseSchemaResult.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseSchemaResult.cs @@ -27,7 +27,7 @@ namespace Umbraco.Core.Migrations.Install public List TableDefinitions { get; } - // todo what are these exactly? TableDefinitions are those that should be there, IndexDefinitions are those that... are in DB? + // TODO: what are these exactly? TableDefinitions are those that should be there, IndexDefinitions are those that... are in DB? internal List IndexDefinitions { get; } public List ValidTables { get; } diff --git a/src/Umbraco.Core/Models/ContentBase.cs b/src/Umbraco.Core/Models/ContentBase.cs index 0d4e9ce789..ca1152a9a4 100644 --- a/src/Umbraco.Core/Models/ContentBase.cs +++ b/src/Umbraco.Core/Models/ContentBase.cs @@ -128,14 +128,14 @@ namespace Umbraco.Core.Models /// /// Gets the enumeration of property groups for the entity. - /// todo - remove this proxy method + /// TODO: remove this proxy method /// [IgnoreDataMember] public IEnumerable PropertyGroups => ContentTypeBase.CompositionPropertyGroups; /// /// Gets the numeration of property types for the entity. - /// todo - remove this proxy method + /// TODO: remove this proxy method /// [IgnoreDataMember] public IEnumerable PropertyTypes => ContentTypeBase.CompositionPropertyTypes; diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs index dadc3870b0..064bdd3d4a 100644 --- a/src/Umbraco.Core/Models/ContentTypeBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeBase.cs @@ -431,7 +431,7 @@ namespace Umbraco.Core.Models /// PropertyTypes that are not part of a PropertyGroup ///
[IgnoreDataMember] - //todo should we mark this as EditorBrowsable hidden since it really isn't ever used? + // TODO: should we mark this as EditorBrowsable hidden since it really isn't ever used? internal PropertyTypeCollection PropertyTypeCollection => _noGroupPropertyTypes; /// diff --git a/src/Umbraco.Core/Models/GridValue.cs b/src/Umbraco.Core/Models/GridValue.cs index c4a8b85b00..4f19576f17 100644 --- a/src/Umbraco.Core/Models/GridValue.cs +++ b/src/Umbraco.Core/Models/GridValue.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Models public class GridSection { [JsonProperty("grid")] - public string Grid { get; set; } //todo: what is this? + public string Grid { get; set; } // TODO: what is this? [JsonProperty("rows")] public IEnumerable Rows { get; set; } @@ -48,7 +48,7 @@ namespace Umbraco.Core.Models public class GridArea { [JsonProperty("grid")] - public string Grid { get; set; } //todo: what is this? + public string Grid { get; set; } // TODO: what is this? [JsonProperty("controls")] public IEnumerable Controls { get; set; } diff --git a/src/Umbraco.Core/Models/IContent.cs b/src/Umbraco.Core/Models/IContent.cs index b3b4e03783..4363324c8d 100644 --- a/src/Umbraco.Core/Models/IContent.cs +++ b/src/Umbraco.Core/Models/IContent.cs @@ -137,7 +137,7 @@ namespace Umbraco.Core.Models /// IEnumerable EditedCultures { get; } - // todo - these two should move to some kind of service + // TODO: these two should move to some kind of service /// /// Changes the for the current content object diff --git a/src/Umbraco.Core/Models/IContentTypeComposition.cs b/src/Umbraco.Core/Models/IContentTypeComposition.cs index 84e436e46f..675d3cd268 100644 --- a/src/Umbraco.Core/Models/IContentTypeComposition.cs +++ b/src/Umbraco.Core/Models/IContentTypeComposition.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Models /// /// Gets or sets the content types that compose this content type. /// - //todo: we should be storing key references, not the object else we are caching way too much + // TODO: we should be storing key references, not the object else we are caching way too much IEnumerable ContentTypeComposition { get; set; } /// diff --git a/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs b/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs index d118cd526e..f5c21a3a74 100644 --- a/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs +++ b/src/Umbraco.Core/Models/Identity/BackOfficeIdentityUser.cs @@ -67,7 +67,7 @@ namespace Umbraco.Core.Models.Identity _startContentIds = new int[] { }; _groups = new IReadOnlyUserGroup[] { }; _allowedSections = new string[] { }; - _culture = Current.Configs.Global().DefaultUILanguage; //todo inject + _culture = Current.Configs.Global().DefaultUILanguage; // TODO: inject _groups = new IReadOnlyUserGroup[0]; _roles = new ObservableCollection>(); _roles.CollectionChanged += _roles_CollectionChanged; @@ -84,7 +84,7 @@ namespace Umbraco.Core.Models.Identity _startContentIds = new int[] { }; _groups = new IReadOnlyUserGroup[] { }; _allowedSections = new string[] { }; - _culture = Current.Configs.Global().DefaultUILanguage; //todo inject + _culture = Current.Configs.Global().DefaultUILanguage; // TODO: inject _groups = groups.ToArray(); _roles = new ObservableCollection>(_groups.Select(x => new IdentityUserRole { diff --git a/src/Umbraco.Core/Models/MediaExtensions.cs b/src/Umbraco.Core/Models/MediaExtensions.cs index 2945856817..e281aaf5ab 100644 --- a/src/Umbraco.Core/Models/MediaExtensions.cs +++ b/src/Umbraco.Core/Models/MediaExtensions.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Models var val = media.Properties[propertyType]; if (val == null) return string.Empty; - //todo would need to be adjusted to variations, when media become variants + // TODO: would need to be adjusted to variations, when media become variants var jsonString = val.GetValue() as string; if (jsonString == null) return string.Empty; diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs index 942c71f0c6..5e79967a94 100644 --- a/src/Umbraco.Core/Models/Membership/User.cs +++ b/src/Umbraco.Core/Models/Membership/User.cs @@ -27,7 +27,7 @@ namespace Umbraco.Core.Models.Membership { SessionTimeout = 60; _userGroups = new HashSet(); - _language = Current.Configs.Global().DefaultUILanguage; //todo inject + _language = Current.Configs.Global().DefaultUILanguage; // TODO: inject _isApproved = true; _isLockedOut = false; _startContentIds = new int[] { }; diff --git a/src/Umbraco.Core/Models/Packaging/CompiledPackage.cs b/src/Umbraco.Core/Models/Packaging/CompiledPackage.cs index ac460ca34c..f4ed11e09e 100644 --- a/src/Umbraco.Core/Models/Packaging/CompiledPackage.cs +++ b/src/Umbraco.Core/Models/Packaging/CompiledPackage.cs @@ -26,19 +26,19 @@ namespace Umbraco.Core.Models.Packaging public string PackageView { get; set; } public string IconUrl { get; set; } - public string Actions { get; set; } //todo: Should we make this strongly typed to IEnumerable ? + public string Actions { get; set; } // TODO: Should we make this strongly typed to IEnumerable ? public PreInstallWarnings Warnings { get; set; } = new PreInstallWarnings(); public List Files { get; set; } = new List(); - public IEnumerable Macros { get; set; } //todo: make strongly typed - public IEnumerable Templates { get; set; } //todo: make strongly typed - public IEnumerable Stylesheets { get; set; } //todo: make strongly typed - public IEnumerable DataTypes { get; set; } //todo: make strongly typed - public IEnumerable Languages { get; set; } //todo: make strongly typed - public IEnumerable DictionaryItems { get; set; } //todo: make strongly typed - public IEnumerable DocumentTypes { get; set; } //todo: make strongly typed + public IEnumerable Macros { get; set; } // TODO: make strongly typed + public IEnumerable Templates { get; set; } // TODO: make strongly typed + public IEnumerable Stylesheets { get; set; } // TODO: make strongly typed + public IEnumerable DataTypes { get; set; } // TODO: make strongly typed + public IEnumerable Languages { get; set; } // TODO: make strongly typed + public IEnumerable DictionaryItems { get; set; } // TODO: make strongly typed + public IEnumerable DocumentTypes { get; set; } // TODO: make strongly typed public IEnumerable Documents { get; set; } } } diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs index 5e45475dd2..f5c475908d 100644 --- a/src/Umbraco.Core/Models/Property.cs +++ b/src/Umbraco.Core/Models/Property.cs @@ -347,7 +347,7 @@ namespace Umbraco.Core.Models /// internal bool IsValid(string culture = "*", string segment = "*") { - //todo - validating values shouldn't be done here, this calls in to IsValidValue + // TODO: validating values shouldn't be done here, this calls in to IsValidValue culture = culture.NullOrWhiteSpaceAsNull(); segment = segment.NullOrWhiteSpaceAsNull(); @@ -388,7 +388,7 @@ namespace Umbraco.Core.Models /// True is property value is valid, otherwise false private bool IsValidValue(object value) { - //todo - this shouldn't exist here, the model itself shouldn't be responsible for it's own validation and this requires singleton access + // TODO: this shouldn't exist here, the model itself shouldn't be responsible for it's own validation and this requires singleton access return PropertyType.IsPropertyValueValid(value); } diff --git a/src/Umbraco.Core/Models/PropertyCollection.cs b/src/Umbraco.Core/Models/PropertyCollection.cs index ef56ce4a4c..5e71fe9f65 100644 --- a/src/Umbraco.Core/Models/PropertyCollection.cs +++ b/src/Umbraco.Core/Models/PropertyCollection.cs @@ -97,7 +97,7 @@ namespace Umbraco.Core.Models /// internal new void Add(Property property) { - lock (_addLocker) // todo - why are we locking here and not everywhere else?! + lock (_addLocker) // TODO: why are we locking here and not everywhere else?! { var key = GetKeyForItem(property); if (key != null) diff --git a/src/Umbraco.Core/Models/PropertyGroupCollection.cs b/src/Umbraco.Core/Models/PropertyGroupCollection.cs index 5fe47b52a4..2e9fb6520e 100644 --- a/src/Umbraco.Core/Models/PropertyGroupCollection.cs +++ b/src/Umbraco.Core/Models/PropertyGroupCollection.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Models { private readonly ReaderWriterLockSlim _addLocker = new ReaderWriterLockSlim(); - //todo: this doesn't seem to be used anywhere + // TODO: this doesn't seem to be used anywhere internal Action OnAdd; internal PropertyGroupCollection() diff --git a/src/Umbraco.Core/Models/PropertyTagsExtensions.cs b/src/Umbraco.Core/Models/PropertyTagsExtensions.cs index c0dcddc6ae..63cf870221 100644 --- a/src/Umbraco.Core/Models/PropertyTagsExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyTagsExtensions.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core.Models ///
public static class PropertyTagsExtensions { - // todo: inject + // TODO: inject private static PropertyEditorCollection PropertyEditors => Current.PropertyEditors; private static IDataTypeService DataTypeService => Current.Services.DataTypeService; diff --git a/src/Umbraco.Core/Models/PropertyType.cs b/src/Umbraco.Core/Models/PropertyType.cs index 377e86d2e5..107831ebdd 100644 --- a/src/Umbraco.Core/Models/PropertyType.cs +++ b/src/Umbraco.Core/Models/PropertyType.cs @@ -378,14 +378,14 @@ namespace Umbraco.Core.Models } - //todo - this and other value validation methods should be a service level (not a model) thing. Changing this to internal for now + // TODO: this and other value validation methods should be a service level (not a model) thing. Changing this to internal for now /// /// Determines whether a value is valid for this property type. /// internal bool IsPropertyValueValid(object value) { - var editor = Current.PropertyEditors[_propertyEditorAlias]; // todo inject - var configuration = Current.Services.DataTypeService.GetDataType(_dataTypeId).Configuration; // todo inject + var editor = Current.PropertyEditors[_propertyEditorAlias]; // TODO: inject + var configuration = Current.Services.DataTypeService.GetDataType(_dataTypeId).Configuration; // TODO: inject var valueEditor = editor.GetValueEditor(configuration); return !valueEditor.Validate(value, Mandatory, ValidationRegExp).Any(); } diff --git a/src/Umbraco.Core/Models/PropertyTypeCollection.cs b/src/Umbraco.Core/Models/PropertyTypeCollection.cs index 6753ee7532..f39918d5af 100644 --- a/src/Umbraco.Core/Models/PropertyTypeCollection.cs +++ b/src/Umbraco.Core/Models/PropertyTypeCollection.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Models [IgnoreDataMember] private readonly ReaderWriterLockSlim _addLocker = new ReaderWriterLockSlim(); - //todo: This doesn't seem to be used + // TODO: This doesn't seem to be used [IgnoreDataMember] internal Action OnAdd; @@ -81,7 +81,7 @@ namespace Umbraco.Core.Models { item.IsPublishing = IsPublishing; - // todo this is not pretty and should be refactored + // TODO: this is not pretty and should be refactored try { _addLocker.EnterWriteLock(); diff --git a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs index e50fb2c396..33efc48c95 100644 --- a/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs +++ b/src/Umbraco.Core/Models/PublishedContent/IPublishedContent.cs @@ -15,7 +15,7 @@ namespace Umbraco.Core.Models.PublishedContent { #region Content - // todo - IPublishedContent properties colliding with models + // TODO: IPublishedContent properties colliding with models // we need to find a way to remove as much clutter as possible from IPublishedContent, // since this is preventing someone from creating a property named 'Path' and have it // in a model, for instance. we could move them all under one unique property eg diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs index 083e8dcc6e..0798e9a4e0 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedContentType.cs @@ -86,7 +86,7 @@ namespace Umbraco.Core.Models.PublishedContent } } - // todo - this list somehow also exists in constants, see memberTypeRepository => remove duplicate! + // TODO: this list somehow also exists in constants, see memberTypeRepository => remove duplicate! private static readonly Dictionary BuiltinMemberProperties = new Dictionary { { "Email", (Constants.DataTypes.Textbox, Constants.PropertyEditors.Aliases.TextBox) }, @@ -148,7 +148,8 @@ namespace Umbraco.Core.Models.PublishedContent return -1; } - // virtual for unit tests - todo explain why + // virtual for unit tests + // TODO: explain why /// /// Gets a property type. /// @@ -158,7 +159,8 @@ namespace Umbraco.Core.Models.PublishedContent return GetPropertyType(index); } - // virtual for unit tests - todo explain why + // virtual for unit tests + // TODO: explain why /// /// Gets a property type. /// diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs index 0860fdb822..68892fd79a 100644 --- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs +++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyType.cs @@ -12,7 +12,7 @@ namespace Umbraco.Core.Models.PublishedContent /// if the property type changes, then a new class needs to be created. public class PublishedPropertyType { - //todo - API design review, should this be an interface? + // TODO: API design review, should this be an interface? private readonly IPublishedModelFactory _publishedModelFactory; private readonly PropertyValueConverterCollection _propertyValueConverters; diff --git a/src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs b/src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs index bfbde592b5..7898a9997a 100644 --- a/src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs +++ b/src/Umbraco.Core/Persistence/Constants-DatabaseSchema.cs @@ -14,8 +14,8 @@ namespace Umbraco.Core public const string Node = /*TableNamePrefix*/ "umbraco" + "Node"; public const string NodeData = /*TableNamePrefix*/ "cms" + "ContentNu"; - public const string NodeXml = /*TableNamePrefix*/ "cms" + "ContentXml"; // todo get rid of these with the xml cache - public const string NodePreviewXml = /*TableNamePrefix*/ "cms" + "PreviewXml"; // todo get rid of these with the xml cache + public const string NodeXml = /*TableNamePrefix*/ "cms" + "ContentXml"; // TODO: get rid of these with the xml cache + public const string NodePreviewXml = /*TableNamePrefix*/ "cms" + "PreviewXml"; // TODO: get rid of these with the xml cache public const string ContentType = /*TableNamePrefix*/ "cms" + "ContentType"; public const string ContentChildType = /*TableNamePrefix*/ "cms" + "ContentTypeAllowedContentType"; diff --git a/src/Umbraco.Core/Persistence/Dtos/ContentVersionCultureVariationDto.cs b/src/Umbraco.Core/Persistence/Dtos/ContentVersionCultureVariationDto.cs index ada26358dc..65d677d240 100644 --- a/src/Umbraco.Core/Persistence/Dtos/ContentVersionCultureVariationDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/ContentVersionCultureVariationDto.cs @@ -33,10 +33,10 @@ namespace Umbraco.Core.Persistence.Dtos [Column("name")] public string Name { get; set; } - [Column("date")] // todo: db rename to 'updateDate' + [Column("date")] // TODO: db rename to 'updateDate' public DateTime UpdateDate { get; set; } - [Column("availableUserId")] // todo: db rename to 'updateDate' + [Column("availableUserId")] // TODO: db rename to 'updateDate' [ForeignKey(typeof(UserDto))] [NullSetting(NullSetting = NullSettings.Null)] public int? UpdateUserId { get => _updateUserId == 0 ? null : _updateUserId; set => _updateUserId = value; } //return null if zero diff --git a/src/Umbraco.Core/Persistence/Dtos/ContentVersionDto.cs b/src/Umbraco.Core/Persistence/Dtos/ContentVersionDto.cs index 287e812211..3c2c3deda4 100644 --- a/src/Umbraco.Core/Persistence/Dtos/ContentVersionDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/ContentVersionDto.cs @@ -21,16 +21,16 @@ namespace Umbraco.Core.Persistence.Dtos [ForeignKey(typeof(ContentDto))] public int NodeId { get; set; } - [Column("versionDate")] // todo: db rename to 'updateDate' + [Column("versionDate")] // TODO: db rename to 'updateDate' [Constraint(Default = SystemMethods.CurrentDateTime)] public DateTime VersionDate { get; set; } - [Column("userId")] // todo: db rename to 'updateUserId' + [Column("userId")] // TODO: db rename to 'updateUserId' [ForeignKey(typeof(UserDto))] [NullSetting(NullSetting = NullSettings.Null)] public int? UserId { get => _userId == 0 ? null : _userId; set => _userId = value; } //return null if zero - //todo - we need an index on this it is used almost always in querying and sorting + // TODO: we need an index on this it is used almost always in querying and sorting [Column("current")] public bool Current { get; set; } diff --git a/src/Umbraco.Core/Persistence/Dtos/DataTypeDto.cs b/src/Umbraco.Core/Persistence/Dtos/DataTypeDto.cs index a0e526b62e..d270c7b732 100644 --- a/src/Umbraco.Core/Persistence/Dtos/DataTypeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/DataTypeDto.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core.Persistence.Dtos public int NodeId { get; set; } [Column("propertyEditorAlias")] - public string EditorAlias { get; set; } // todo should this have a length + public string EditorAlias { get; set; } // TODO: should this have a length [Column("dbType")] [Length(50)] diff --git a/src/Umbraco.Core/Persistence/Dtos/NodeDto.cs b/src/Umbraco.Core/Persistence/Dtos/NodeDto.cs index 8f50891b34..5800efb97a 100644 --- a/src/Umbraco.Core/Persistence/Dtos/NodeDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/NodeDto.cs @@ -45,7 +45,7 @@ namespace Umbraco.Core.Persistence.Dtos [Index(IndexTypes.NonClustered, Name = "IX_" + TableName + "_Trashed")] public bool Trashed { get; set; } - [Column("nodeUser")] // todo: db rename to 'createUserId' + [Column("nodeUser")] // TODO: db rename to 'createUserId' [ForeignKey(typeof(UserDto))] [NullSetting(NullSetting = NullSettings.Null)] public int? UserId { get => _userId == 0 ? null : _userId; set => _userId = value; } //return null if zero @@ -54,7 +54,7 @@ namespace Umbraco.Core.Persistence.Dtos [NullSetting(NullSetting = NullSettings.Null)] public string Text { get; set; } - [Column("nodeObjectType")] // todo: db rename to 'objectType' + [Column("nodeObjectType")] // TODO: db rename to 'objectType' [NullSetting(NullSetting = NullSettings.Null)] [Index(IndexTypes.NonClustered, Name = "IX_" + TableName + "_ObjectType")] public Guid? NodeObjectType { get; set; } diff --git a/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs b/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs index 97e172f98f..434e0393cd 100644 --- a/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/ContentBaseFactory.cs @@ -49,7 +49,7 @@ namespace Umbraco.Core.Persistence.Factories content.Published = dto.Published; content.Edited = dto.Edited; - // todo - shall we get published infos or not? + // TODO: shall we get published infos or not? //if (dto.Published) if (publishedVersionDto != null) { @@ -89,7 +89,7 @@ namespace Umbraco.Core.Persistence.Factories content.Key = nodeDto.UniqueId; content.VersionId = contentVersionDto.Id; - // todo missing names? + // TODO: missing names? content.Path = nodeDto.Path; content.Level = nodeDto.Level; @@ -130,7 +130,7 @@ namespace Umbraco.Core.Persistence.Factories content.Key = nodeDto.UniqueId; content.VersionId = contentVersionDto.Id; - // todo missing names? + // TODO: missing names? content.Path = nodeDto.Path; content.Level = nodeDto.Level; @@ -294,7 +294,7 @@ namespace Umbraco.Core.Persistence.Factories private static MediaVersionDto BuildMediaVersionDto(IMedia entity, ContentDto contentDto) { // try to get a path from the string being stored for media - // todo - only considering umbracoFile + // TODO: only considering umbracoFile TryMatch(entity.GetValue("umbracoFile"), out var path); @@ -309,7 +309,7 @@ namespace Umbraco.Core.Persistence.Factories return dto; } - // todo - this should NOT be here?! + // TODO: this should NOT be here?! // more dark magic ;-( internal static bool TryMatch(string text, out string path) { diff --git a/src/Umbraco.Core/Persistence/LocalDb.cs b/src/Umbraco.Core/Persistence/LocalDb.cs index 94e930abe9..55d6565344 100644 --- a/src/Umbraco.Core/Persistence/LocalDb.cs +++ b/src/Umbraco.Core/Persistence/LocalDb.cs @@ -317,8 +317,8 @@ namespace Umbraco.Core.Persistence if (dbname == "master" || dbname == "tempdb" || dbname == "model" || dbname == "msdb") continue; - // todo - shall we deal with stale databases? - // todo - is it always ok to assume file names? + // TODO: shall we deal with stale databases? + // TODO: is it always ok to assume file names? //var mdf = database.Value; //var ldf = mdf.Replace(".mdf", "_log.ldf"); //if (staleOnly && File.Exists(mdf) && File.Exists(ldf)) diff --git a/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs b/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs index b596ab60a3..09f754c47a 100644 --- a/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs +++ b/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.Persistence ///
public static partial class NPocoDatabaseExtensions { - // todo: review NPoco native InsertBulk to replace the code below + // TODO: review NPoco native InsertBulk to replace the code below /// /// Bulk-inserts records within a transaction. @@ -177,8 +177,8 @@ namespace Umbraco.Core.Persistence using (var command = database.CreateCommand(database.Connection, CommandType.TableDirect, string.Empty)) { command.CommandText = pocoData.TableInfo.TableName; - command.CommandType = CommandType.TableDirect; // todo - why repeat? - // todo - not supporting transactions? + command.CommandType = CommandType.TableDirect; // TODO: why repeat? + // TODO: not supporting transactions? //cmd.Transaction = GetTypedTransaction(db.Connection.); var count = 0; diff --git a/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions.cs b/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions.cs index b8417d743d..248f91284f 100644 --- a/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions.cs +++ b/src/Umbraco.Core/Persistence/NPocoDatabaseExtensions.cs @@ -32,7 +32,7 @@ namespace Umbraco.Core.Persistence // // works in READ COMMITED, TSQL & SQLCE lock the constraint even if it does not exist, so INSERT is OK // - // todo: use the proper database syntax, not this kludge + // TODO: use the proper database syntax, not this kludge /// /// Safely inserts a record, or updates if it exists, based on a unique constraint. @@ -81,7 +81,7 @@ namespace Umbraco.Core.Persistence if (poco == null) throw new ArgumentNullException(nameof(poco)); - // todo - NPoco has a Save method that works with the primary key + // TODO: NPoco has a Save method that works with the primary key // in any case, no point trying to update if there's no primary key! // try to update diff --git a/src/Umbraco.Core/Persistence/NPocoSqlExtensions.cs b/src/Umbraco.Core/Persistence/NPocoSqlExtensions.cs index 10735f865c..23d818f0b3 100644 --- a/src/Umbraco.Core/Persistence/NPocoSqlExtensions.cs +++ b/src/Umbraco.Core/Persistence/NPocoSqlExtensions.cs @@ -496,7 +496,7 @@ namespace Umbraco.Core.Persistence public static Sql On(this Sql.SqlJoinClause sqlJoin, Expression> leftField, Expression> rightField) { - // todo - ugly - should define on SqlContext! + // TODO: ugly - should define on SqlContext! var xLeft = new Sql(sqlJoin.SqlContext).Columns(leftField); var xRight = new Sql(sqlJoin.SqlContext).Columns(rightField); @@ -1180,7 +1180,7 @@ namespace Umbraco.Core.Persistence private static string GetTableName(this Type type) { - // todo: returning string.Empty for now + // TODO: returning string.Empty for now // BUT the code bits that calls this method cannot deal with string.Empty so we // should either throw, or fix these code bits... var attr = type.FirstAttribute(); diff --git a/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs b/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs index 64b3c91e50..b6f5401bec 100644 --- a/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs +++ b/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Composing; namespace Umbraco.Core.Persistence.Querying { - // todo - are we basically duplicating entire parts of NPoco just because of SqlSyntax ?! + // TODO: are we basically duplicating entire parts of NPoco just because of SqlSyntax ?! // try to use NPoco's version ! /// diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs index 8057c87578..821f0941fc 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentRepositoryBase.cs @@ -43,7 +43,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected ILanguageRepository LanguageRepository { get; } - protected PropertyEditorCollection PropertyEditors => Current.PropertyEditors; // todo inject + protected PropertyEditorCollection PropertyEditors => Current.PropertyEditors; // TODO: inject #region Versions @@ -73,7 +73,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement // deletes a specific version public virtual void DeleteVersion(int versionId) { - // todo test object node type? + // TODO: test object node type? // get the version we want to delete var template = SqlContext.Templates.Get("Umbraco.Core.VersionableRepository.GetVersion", tsql => @@ -95,7 +95,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement // deletes all versions of an entity, older than a date. public virtual void DeleteVersions(int nodeId, DateTime versionDate) { - // todo test object node type? + // TODO: test object node type? // get the versions we want to delete, excluding the current one var template = SqlContext.Templates.Get("Umbraco.Core.VersionableRepository.GetVersions", tsql => @@ -240,7 +240,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } } - // todo should we do it when un-publishing? or? + // TODO: should we do it when un-publishing? or? /// /// Clears tags for an item. /// @@ -374,7 +374,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return GetAliasedField(SqlSyntax.GetFieldName(x => x.Text), sql); // "variantName" alias is defined in DocumentRepository.GetBaseQuery - // todo - what if it is NOT a document but a ... media or whatever? + // TODO: what if it is NOT a document but a ... media or whatever? // previously, we inserted the join+select *here* so we were sure to have it, // but now that's not the case anymore! return "variantName"; @@ -620,7 +620,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region UnitOfWork Events - // todo: The reason these events are in the repository is for legacy, the events should exist at the service + // TODO: The reason these events are in the repository is for legacy, the events should exist at the service // level now since we can fire these events within the transaction... so move the events to service level public class ScopedEntityEventArgs : EventArgs diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index 3bc730d5d0..92ade18204 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -343,8 +343,7 @@ AND umbracoNode.id <> @id", List orphanPropertyTypeIds = null; if (entity.IsPropertyDirty("PropertyGroups")) { - // todo - // we used to try to propagate tabs renaming downstream, relying on ParentId, but + // TODO: we used to try to propagate tabs renaming downstream, relying on ParentId, but // 1) ParentId makes no sense (if a tab can be inherited from multiple composition // types) so we would need to figure things out differently, visiting downstream // content types and looking for tabs with the same name... diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs index 8bee55060b..dcac7f4ff4 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DocumentRepository.cs @@ -148,7 +148,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement .On((left, right) => left.Id == right.Id && right.Published, "pcv", "pdv"), "pcv") .On((left, right) => left.NodeId == right.NodeId, aliasRight: "pcv") - // todo - should we be joining this when the query type is not single/many? + // TODO: should we be joining this when the query type is not single/many? // left join on optional culture variation //the magic "[[[ISOCODE]]]" parameter value will be replaced in ContentRepositoryBase.GetPage() by the actual ISO code .LeftJoin(nested => @@ -277,7 +277,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement SanitizeNames(content, publishing); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // create the dto @@ -466,7 +466,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement SanitizeNames(content, publishing); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // if parent has changed, get path, level and sort order @@ -545,7 +545,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement edited = true; (editedCultures ?? (editedCultures = new HashSet(StringComparer.OrdinalIgnoreCase))).Add(culture); - // todo - change tracking + // TODO: change tracking // at the moment, we don't do any dirty tracking on property values, so we don't know whether the // culture has just been edited or not, so we don't update its update date - that date only changes // when the name is set, and it all works because the controller does it - but, if someone uses a @@ -561,7 +561,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var deleteDocumentVariations = Sql().Delete().Where(x => x.NodeId == content.Id); Database.Execute(deleteDocumentVariations); - // todo NPoco InsertBulk issue? + // TODO: NPoco InsertBulk issue? // we should use the native NPoco InsertBulk here but it causes problems (not sure exactly all scenarios) // but by using SQL Server and updating a variants name will cause: Unable to cast object of type // 'Umbraco.Core.Persistence.FaultHandling.RetryDbConnection' to type 'System.Data.SqlClient.SqlConnection'. @@ -622,8 +622,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement ClearEntityTags(entity, _tagRepository); } - // note re. tags: explicitly unpublished entities have cleared tags, - // but masked or trashed entities *still* have tags in the db todo so what? + // TODO: note re. tags: explicitly unpublished entities have cleared tags, but masked or trashed entities *still* have tags in the db - so what? entity.ResetDirtyProperties(); @@ -837,7 +836,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } // reading repository purely for looking up by GUID - // todo - ugly and to fix we need to decouple the IRepositoryQueryable -> IRepository -> IReadRepository which should all be separate things! + // TODO: ugly and to fix we need to decouple the IRepositoryQueryable -> IRepository -> IReadRepository which should all be separate things! private class ContentByGuidReadRepository : NPocoRepositoryBase { private readonly DocumentRepository _outerRepo; @@ -1124,7 +1123,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement // get properties - indexed by version id var versionId = dto.DocumentVersionDto.Id; - // todo - shall we get published properties or not? + // TODO: shall we get published properties or not? //var publishedVersionId = dto.Published ? dto.PublishedVersionDto.Id : 0; var publishedVersionId = dto.PublishedVersionDto != null ? dto.PublishedVersionDto.Id : 0; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs index c531b991a9..85912694f0 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/EntityRepository.cs @@ -62,7 +62,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement ApplyOrdering(ref sql, ordering); } - //todo - we should be able to do sql = sql.OrderBy(x => Alias(x.NodeId, "NodeId")); but we can't because the OrderBy extension don't support Alias currently + // TODO: we should be able to do sql = sql.OrderBy(x => Alias(x.NodeId, "NodeId")); but we can't because the OrderBy extension don't support Alias currently //no matter what we always must have node id ordered at the end sql = ordering.Direction == Direction.Ascending ? sql.OrderBy("NodeId") : sql.OrderByDescending("NodeId"); @@ -73,7 +73,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement if (isContent) BuildVariants(entities.Cast()); - //todo - see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media if (isMedia) BuildProperties(entities, dtos); @@ -166,7 +166,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var entities = dtos.Select(x => BuildEntity(false, isMedia, x)).ToArray(); - //todo- see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: See https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media if (isMedia && loadMediaProperties) BuildProperties(entities, dtos); @@ -227,7 +227,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return GetEntities(sql, isContent, isMedia, true); } - //todo- see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: See https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media internal IEnumerable GetMediaByQueryWithoutPropertyData(IQuery query) { var isContent = false; @@ -266,7 +266,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return Database.ExecuteScalar(sql) > 0; } - //todo - see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media private void BuildProperties(EntitySlim entity, BaseDto dto) { var pdtos = Database.Fetch(GetPropertyData(dto.VersionId)); @@ -274,7 +274,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement BuildProperty(entity, pdto); } - //todo - see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media private void BuildProperties(EntitySlim[] entities, List dtos) { var versionIds = dtos.Select(x => x.VersionId).Distinct().ToList(); @@ -290,7 +290,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } } - //todo - see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media private void BuildProperty(EntitySlim entity, PropertyDataDto pdto) { // explain ?! @@ -539,7 +539,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement if (sql == null) throw new ArgumentNullException(nameof(sql)); if (ordering == null) throw new ArgumentNullException(nameof(ordering)); - //todo - although this works for name, it probably doesn't work for others without an alias of some sort + // TODO: although this works for name, it probably doesn't work for others without an alias of some sort var orderBy = ordering.OrderBy; if (ordering.Direction == Direction.Ascending) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs index 94714d6ded..38558e1ca5 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MediaRepository.cs @@ -225,7 +225,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // create the dto @@ -304,7 +304,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement entity.Name = EnsureUniqueNodeName(entity.ParentId, entity.Name, entity.Id); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // if parent has changed, get path, level and sort order diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs index e6ee79470c..ff7a79f98e 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberGroupRepository.cs @@ -298,7 +298,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public int MemberGroupId { get; set; } } - // todo - understand why we need these two repository-level events, move them back to service + // TODO: understand why we need these two repository-level events, move them back to service /// /// Occurs before Save diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs index 9d7556f356..18dc16cbce 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs @@ -66,7 +66,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { var baseQuery = GetBaseQuery(false); - // todo why is this different from content/media?! + // TODO: why is this different from content/media?! // check if the query is based on properties or not var wheres = query.GetWhereClauses(); @@ -103,7 +103,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { var sql = SqlContext.Sql(); - switch (queryType) // todo pretend we still need these queries for now + switch (queryType) // TODO: pretend we still need these queries for now { case QueryType.Count: sql = sql.SelectCount(); @@ -143,18 +143,18 @@ namespace Umbraco.Core.Persistence.Repositories.Implement return sql; } - // todo - move that one up to Versionable! or better: kill it! + // TODO: move that one up to Versionable! or better: kill it! protected override Sql GetBaseQuery(bool isCount) { return GetBaseQuery(isCount ? QueryType.Count : QueryType.Single); } - protected override string GetBaseWhereClause() // todo - can we kill / refactor this? + protected override string GetBaseWhereClause() // TODO: can we kill / refactor this? { return "umbracoNode.id = @id"; } - // todo document/understand that one + // TODO: document/understand that one protected Sql GetNodeIdQueryWithPropertyData() { return Sql() @@ -237,7 +237,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement member.AddingEntity(); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // create the dto @@ -329,7 +329,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement member.UpdatingEntity(); // ensure that strings don't contain characters that are invalid in xml - // todo - do we really want to keep doing this here? + // TODO: do we really want to keep doing this here? entity.SanitizeEntityPropertiesForXmlStorage(); // if parent has changed, get path, level and sort order diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/NPocoRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/NPocoRepositoryBase.cs index a0ba2d5aa3..23236ec9f0 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/NPocoRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/NPocoRepositoryBase.cs @@ -42,7 +42,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement #region Abstract Methods - protected abstract Sql GetBaseQuery(bool isCount); // todo obsolete, use QueryType instead everywhere + protected abstract Sql GetBaseQuery(bool isCount); // TODO: obsolete, use QueryType instead everywhere protected abstract string GetBaseWhereClause(); protected abstract IEnumerable GetDeleteClauses(); protected abstract Guid NodeObjectTypeId { get; } diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs index 84e8ffc172..fb45a79e43 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs @@ -78,7 +78,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement } } - // todo - but now that we have 1 unique repository? + // TODO: but now that we have 1 unique repository? // this is a *bad* idea because PerformCount captures the current repository and its UOW // //private static RepositoryCachePolicyOptions _defaultOptions; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs index b4aa9c27f9..2bad7229f2 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ServerRegistrationRepository.cs @@ -20,7 +20,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement protected override IRepositoryCachePolicy CreateCachePolicy() { - // todo - wtf are we doing with cache here? + // TODO: wtf are we doing with cache here? // why are we using disabled cache helper up there? // // 7.6 says: diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs index 2242c65256..fdd5fb0d86 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs @@ -65,7 +65,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement if (_passwordConfigInitialized) return _passwordConfigJson; - // todo - this is bad + // TODO: this is bad // because the membership provider we're trying to get has a dependency on the user service // and we should not depend on services in repositories - need a way better way to do this @@ -238,7 +238,7 @@ ORDER BY colName"; public void ClearLoginSession(Guid sessionId) { - // todo why is that one updating and not deleting? + // TODO: why is that one updating and not deleting? Database.Execute(Sql() .Update(u => u.Set(x => x.LoggedOutUtc, DateTime.UtcNow)) .Where(x => x.SessionId == sessionId)); diff --git a/src/Umbraco.Core/Persistence/SqlSyntaxExtensions.cs b/src/Umbraco.Core/Persistence/SqlSyntaxExtensions.cs index 43ef03327b..2fba8e7d49 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntaxExtensions.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntaxExtensions.cs @@ -13,7 +13,7 @@ namespace Umbraco.Core.Persistence { private static string GetTableName(this Type type) { - // todo: returning string.Empty for now + // TODO: returning string.Empty for now // BUT the code bits that calls this method cannot deal with string.Empty so we // should either throw, or fix these code bits... var attr = type.FirstAttribute(); diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs index 4e795d3a78..51e0172f35 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabase.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabase.cs @@ -159,7 +159,7 @@ namespace Umbraco.Core.Persistence #region OnSomething - // todo - has new interceptors to replace OnSomething? + // TODO: has new interceptors to replace OnSomething? protected override DbConnection OnConnectionOpened(DbConnection connection) { @@ -218,7 +218,7 @@ namespace Umbraco.Core.Persistence cmd.CommandTimeout = cmd.Connection.ConnectionTimeout; if (EnableSqlTrace) - _logger.Debug("SQL Trace:\r\n{Sql}", CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // todo these escapes should be builtin + _logger.Debug("SQL Trace:\r\n{Sql}", CommandToString(cmd).Replace("{", "{{").Replace("}", "}}")); // TODO: these escapes should be builtin #if DEBUG_DATABASES // detects whether the command is already in use (eg still has an open reader...) diff --git a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs index aec49b8eb5..eab0ae5509 100644 --- a/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs +++ b/src/Umbraco.Core/Persistence/UmbracoDatabaseFactory.cs @@ -22,8 +22,8 @@ namespace Umbraco.Core.Persistence /// It wraps an NPoco UmbracoDatabaseFactory which is initializes with a proper IPocoDataFactory to ensure /// that NPoco's plumbing is cached appropriately for the whole application. /// - //todo these comments are not true anymore - //todo this class needs not be disposable! + // TODO: these comments are not true anymore + // TODO: this class needs not be disposable! internal class UmbracoDatabaseFactory : DisposableObject, IUmbracoDatabaseFactory { private readonly Lazy _mappers; @@ -288,7 +288,7 @@ namespace Umbraco.Core.Persistence // thread, so we don't really know what we are disposing here... // besides, we don't really want to dispose the factory, which is a singleton... - // todo - the class does not need be disposable + // TODO: the class does not need be disposable //var db = _umbracoDatabaseAccessor.UmbracoDatabase; //_umbracoDatabaseAccessor.UmbracoDatabase = null; //db?.Dispose(); @@ -299,7 +299,7 @@ namespace Umbraco.Core.Persistence // this method provides a way to force-reset the variable internal void ResetForTests() { - // todo remove all this eventually + // TODO: remove all this eventually //var db = _umbracoDatabaseAccessor.UmbracoDatabase; //_umbracoDatabaseAccessor.UmbracoDatabase = null; //db?.Dispose(); diff --git a/src/Umbraco.Core/PropertyEditors/DataEditor.cs b/src/Umbraco.Core/PropertyEditors/DataEditor.cs index 0db6dcb0dd..ae6ace996e 100644 --- a/src/Umbraco.Core/PropertyEditors/DataEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataEditor.cs @@ -89,7 +89,7 @@ namespace Umbraco.Core.PropertyEditors /// Technically, it could be cached by datatype but let's keep things /// simple enough for now. /// - // todo point of that one? shouldn't we always configure? + // TODO: point of that one? shouldn't we always configure? public IDataValueEditor GetValueEditor() => ExplicitValueEditor ?? CreateValueEditor(); /// @@ -113,7 +113,7 @@ namespace Umbraco.Core.PropertyEditors return ExplicitValueEditor; var editor = CreateValueEditor(); - ((DataValueEditor) editor).Configuration = configuration; // todo casting is bad + ((DataValueEditor) editor).Configuration = configuration; // TODO: casting is bad return editor; } diff --git a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs index 153039dedb..096b80de1f 100644 --- a/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataValueEditor.cs @@ -283,7 +283,7 @@ namespace Umbraco.Core.PropertyEditors } } - // todo - the methods below should be replaced by proper property value convert ToXPath usage! + // TODO: the methods below should be replaced by proper property value convert ToXPath usage! /// /// Converts a property to Xml fragments. diff --git a/src/Umbraco.Core/PropertyEditors/IDataEditor.cs b/src/Umbraco.Core/PropertyEditors/IDataEditor.cs index 16aa4d6d5c..e7aa68459e 100644 --- a/src/Umbraco.Core/PropertyEditors/IDataEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/IDataEditor.cs @@ -46,7 +46,7 @@ namespace Umbraco.Core.PropertyEditors /// /// Gets a value editor. /// - IDataValueEditor GetValueEditor(); // todo - should be configured?! + IDataValueEditor GetValueEditor(); // TODO: should be configured?! /// /// Gets a configured value editor. diff --git a/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs b/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs index c92b6fa0d3..cb68531cc7 100644 --- a/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/IDataValueEditor.cs @@ -47,7 +47,7 @@ namespace Umbraco.Core.PropertyEditors /// /// /// Use this property to add validators, not to validate. Use instead. - /// todo replace with AddValidator? WithValidator? + /// TODO: replace with AddValidator? WithValidator? /// List Validators { get; } @@ -61,7 +61,7 @@ namespace Umbraco.Core.PropertyEditors /// object ToEditor(Property property, IDataTypeService dataTypeService, string culture = null, string segment = null); - // todo / deal with this when unplugging the xml cache + // TODO: / deal with this when unplugging the xml cache // why property vs propertyType? services should be injected! etc... IEnumerable ConvertDbToXml(Property property, IDataTypeService dataTypeService, ILocalizationService localizationService, bool published); XNode ConvertDbToXml(PropertyType propertyType, object value, IDataTypeService dataTypeService); diff --git a/src/Umbraco.Core/PropertyEditors/ManifestValueValidatorCollection.cs b/src/Umbraco.Core/PropertyEditors/ManifestValueValidatorCollection.cs index 204dff6f19..62f2e0ca1d 100644 --- a/src/Umbraco.Core/PropertyEditors/ManifestValueValidatorCollection.cs +++ b/src/Umbraco.Core/PropertyEditors/ManifestValueValidatorCollection.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core.PropertyEditors if (v == null) throw new InvalidOperationException($"Could not find a validator named \"{name}\"."); - // todo - what is this exactly? + // TODO: what is this exactly? // we cannot return this instance, need to clone it? return (IManifestValueValidator) Activator.CreateInstance(v.GetType()); // ouch } diff --git a/src/Umbraco.Core/PropertyEditors/TagsPropertyEditorAttribute.cs b/src/Umbraco.Core/PropertyEditors/TagsPropertyEditorAttribute.cs index e1f99083e8..2439c7c02e 100644 --- a/src/Umbraco.Core/PropertyEditors/TagsPropertyEditorAttribute.cs +++ b/src/Umbraco.Core/PropertyEditors/TagsPropertyEditorAttribute.cs @@ -43,7 +43,7 @@ namespace Umbraco.Core.PropertyEditors /// /// Gets or sets a value indicating whether to replace the tags entirely. /// - // todo: what's the usage? + // TODO: what's the usage? public bool ReplaceTags { get; set; } /// diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/SliderValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/SliderValueConverter.cs index 12594eb842..31ab47223f 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/SliderValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/SliderValueConverter.cs @@ -67,7 +67,7 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters // GetPreValuesCollectionByDataTypeId is cached at repository level; // still, the collection is deep-cloned so this is kinda expensive, // better to cache here + trigger refresh in DataTypeCacheRefresher - // todo: this is cheap now, remove the caching + // TODO: this is cheap now, remove the caching return Storages.GetOrAdd(dataTypeId, id => { diff --git a/src/Umbraco.Core/Scoping/Scope.cs b/src/Umbraco.Core/Scoping/Scope.cs index 6aeee33c41..f9ea02b072 100644 --- a/src/Umbraco.Core/Scoping/Scope.cs +++ b/src/Umbraco.Core/Scoping/Scope.cs @@ -85,7 +85,7 @@ namespace Umbraco.Core.Scoping ParentScope = parent; // cannot specify a different mode! - // todo - means that it's OK to go from L2 to None for reading purposes, but writing would be BAD! + // TODO: means that it's OK to go from L2 to None for reading purposes, but writing would be BAD! // this is for XmlStore that wants to bypass caches when rebuilding XML (same for NuCache) if (repositoryCacheMode != RepositoryCacheMode.Unspecified && parent.RepositoryCacheMode > repositoryCacheMode) throw new ArgumentException($"Value '{repositoryCacheMode}' cannot be lower than parent value '{parent.RepositoryCacheMode}'.", nameof(repositoryCacheMode)); @@ -264,7 +264,7 @@ namespace Umbraco.Core.Scoping if (ParentScope != null) return ParentScope.Messages; return _messages ?? (_messages = new EventMessages()); - // todo - event messages? + // TODO: event messages? // this may be a problem: the messages collection will be cleared at the end of the scope // how shall we process it in controllers etc? if we don't want the global factory from v7? // it'd need to be captured by the controller @@ -323,7 +323,7 @@ namespace Umbraco.Core.Scoping if (_disposed) throw new ObjectDisposedException(GetType().FullName); - // todo - safer? + // TODO: safer? //if (Interlocked.CompareExchange(ref _disposed, 1, 0) != 0) // throw new ObjectDisposedException(GetType().FullName); } diff --git a/src/Umbraco.Core/Scoping/ScopeContext.cs b/src/Umbraco.Core/Scoping/ScopeContext.cs index 3f70f1791e..03a0da1a55 100644 --- a/src/Umbraco.Core/Scoping/ScopeContext.cs +++ b/src/Umbraco.Core/Scoping/ScopeContext.cs @@ -13,10 +13,7 @@ namespace Umbraco.Core.Scoping if (_enlisted == null) return; - // todo - // - can we create infinite loops? - // - what about nested events? will they just be plainly ignored = really bad? - + // TODO: - can we create infinite loops? - what about nested events? will they just be plainly ignored = really bad? List exceptions = null; List orderedEnlisted; while ((orderedEnlisted = _enlisted.Values.OrderBy(x => x.Priority).ToList()).Count > 0) diff --git a/src/Umbraco.Core/Services/IContentService.cs b/src/Umbraco.Core/Services/IContentService.cs index 3a3c43c6a0..7fb7450b46 100644 --- a/src/Umbraco.Core/Services/IContentService.cs +++ b/src/Umbraco.Core/Services/IContentService.cs @@ -242,7 +242,7 @@ namespace Umbraco.Core.Services /// /// Saves documents. /// - // todo why only 1 result not 1 per content?! + // TODO: why only 1 result not 1 per content?! OperationResult Save(IEnumerable contents, int userId = 0, bool raiseEvents = true); /// diff --git a/src/Umbraco.Core/Services/IEntityService.cs b/src/Umbraco.Core/Services/IEntityService.cs index 3f398cc1e9..9d0399f324 100644 --- a/src/Umbraco.Core/Services/IEntityService.cs +++ b/src/Umbraco.Core/Services/IEntityService.cs @@ -242,8 +242,9 @@ namespace Umbraco.Core.Services IEnumerable GetPagedDescendants(IEnumerable ids, UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery filter = null, Ordering ordering = null); + // TODO: Do we really need this? why not just pass in -1 /// - /// Gets descendants of root. todo: Do we really need this? why not just pass in -1 + /// Gets descendants of root. /// IEnumerable GetPagedDescendants(UmbracoObjectTypes objectType, long pageIndex, int pageSize, out long totalRecords, IQuery filter = null, Ordering ordering = null, bool includeTrashed = true); diff --git a/src/Umbraco.Core/Services/IEntityXmlSerializer.cs b/src/Umbraco.Core/Services/IEntityXmlSerializer.cs index 1c58fc56b8..6feb31115c 100644 --- a/src/Umbraco.Core/Services/IEntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/IEntityXmlSerializer.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core.Services /// XElement Serialize(IContent content, bool published, - bool withDescendants = false) //todo take care of usage! only used for the packager + bool withDescendants = false) // TODO: take care of usage! only used for the packager ; /// diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index e1304a324f..cbc2eeca7a 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -164,7 +164,7 @@ namespace Umbraco.Core.Services.Implement /// public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = 0) { - // todo - what about culture? + // TODO: what about culture? var parent = GetById(parentId); return Create(name, parent, contentTypeAlias, userId); @@ -184,7 +184,7 @@ namespace Umbraco.Core.Services.Implement /// The content object. public IContent Create(string name, int parentId, string contentTypeAlias, int userId = 0) { - // todo - what about culture? + // TODO: what about culture? var contentType = GetContentType(contentTypeAlias); if (contentType == null) @@ -217,7 +217,7 @@ namespace Umbraco.Core.Services.Implement /// The content object. public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = 0) { - // todo - what about culture? + // TODO: what about culture? if (parent == null) throw new ArgumentNullException(nameof(parent)); @@ -248,7 +248,7 @@ namespace Umbraco.Core.Services.Implement /// The content object. public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = 0) { - // todo - what about culture? + // TODO: what about culture? using (var scope = ScopeProvider.CreateScope()) { @@ -282,7 +282,7 @@ namespace Umbraco.Core.Services.Implement /// The content object. public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = 0) { - // todo - what about culture? + // TODO: what about culture? if (parent == null) throw new ArgumentNullException(nameof(parent)); diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs index a9e75e6f29..0cac249cdf 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs @@ -353,7 +353,7 @@ namespace Umbraco.Core.Services.Implement public IEnumerable GetComposedOf(int id) { // GetAll is cheap, repository has a full dataset cache policy - // todo - still, because it uses the cache, race conditions! + // TODO: still, because it uses the cache, race conditions! var allContentTypes = GetAll(Array.Empty()); return GetComposedOf(id, allContentTypes); } diff --git a/src/Umbraco.Core/Services/Implement/DataTypeService.cs b/src/Umbraco.Core/Services/Implement/DataTypeService.cs index b97c3a3ee7..4c588157d0 100644 --- a/src/Umbraco.Core/Services/Implement/DataTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/DataTypeService.cs @@ -204,7 +204,7 @@ namespace Umbraco.Core.Services.Implement _dataTypeContainerRepository.Save(container); scope.Complete(); - // todo - triggering SavedContainer with a different name?! + // TODO: triggering SavedContainer with a different name?! scope.Events.Dispatch(SavedContainer, this, new SaveEventArgs(container, evtMsgs), "RenamedContainer"); return OperationResult.Attempt.Succeed(OperationResultType.Success, evtMsgs, container); @@ -318,7 +318,7 @@ namespace Umbraco.Core.Services.Implement } catch (DataOperationException ex) { - scope.Complete(); // todo what are we doing here exactly? + scope.Complete(); // TODO: what are we doing here exactly? return OperationResult.Attempt.Fail(ex.Operation, evtMsgs); } } @@ -426,8 +426,8 @@ namespace Umbraco.Core.Services.Implement // find ContentTypes using this IDataTypeDefinition on a PropertyType, and delete - // todo - media and members?! - // todo - non-group properties?! + // TODO: media and members?! + // TODO: non-group properties?! var query = Query().Where(x => x.DataTypeId == dataType.Id); var contentTypes = _contentTypeRepository.GetByQuery(query); foreach (var contentType in contentTypes) diff --git a/src/Umbraco.Core/Services/Implement/EntityService.cs b/src/Umbraco.Core/Services/Implement/EntityService.cs index ee6bdeb46d..00edde48f3 100644 --- a/src/Umbraco.Core/Services/Implement/EntityService.cs +++ b/src/Umbraco.Core/Services/Implement/EntityService.cs @@ -388,7 +388,7 @@ namespace Umbraco.Core.Services.Implement { var query = Query().Where(x => x.ParentId == parentId); - //todo - see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media + // TODO: see https://github.com/umbraco/Umbraco-CMS/pull/3460#issuecomment-434903930 we need to not load any property data at all for media return ((EntityRepository)_entityRepository).GetMediaByQueryWithoutPropertyData(query); } } diff --git a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs index 6b52dd4ac1..6a8514f0a0 100644 --- a/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs +++ b/src/Umbraco.Core/Services/Implement/EntityXmlSerializer.cs @@ -47,7 +47,7 @@ namespace Umbraco.Core.Services.Implement /// public XElement Serialize(IContent content, bool published, - bool withDescendants = false) //todo take care of usage! only used for the packager + bool withDescendants = false) // TODO: take care of usage! only used for the packager { if (content == null) throw new ArgumentNullException(nameof(content)); diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 888407c0d0..36b4af6d5e 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -349,7 +349,7 @@ namespace Umbraco.Core.Services.Implement var evtMsgs = EventMessagesFactory.Get(); - //todo: This isn't pretty because we we're required to maintain backwards compatibility so we could not change + // TODO: This isn't pretty because we we're required to maintain backwards compatibility so we could not change // the event args here. The other option is to create a different event with different event // args specifically for this method... which also isn't pretty. So fix this in v8! var additionalData = new Dictionary diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs index 357352c182..9ca7892f62 100644 --- a/src/Umbraco.Core/Services/Implement/MediaService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaService.cs @@ -882,7 +882,7 @@ namespace Umbraco.Core.Services.Implement { scope.WriteLock(Constants.Locks.MediaTree); - // todo - missing 7.6 "ensure valid path" thing here? + // TODO: missing 7.6 "ensure valid path" thing here? // but then should be in PerformMoveLocked on every moved item? var originalPath = media.Path; @@ -1031,7 +1031,7 @@ namespace Umbraco.Core.Services.Implement { var nodeObjectType = Constants.ObjectTypes.Media; var deleted = new List(); - var evtMsgs = EventMessagesFactory.Get(); // todo - and then? + var evtMsgs = EventMessagesFactory.Get(); // TODO: and then? using (var scope = ScopeProvider.CreateScope()) { diff --git a/src/Umbraco.Core/Services/Implement/MemberService.cs b/src/Umbraco.Core/Services/Implement/MemberService.cs index 5726c43fc7..b7afaea1be 100644 --- a/src/Umbraco.Core/Services/Implement/MemberService.cs +++ b/src/Umbraco.Core/Services/Implement/MemberService.cs @@ -1304,7 +1304,7 @@ namespace Umbraco.Core.Services.Implement Id = property.Id, Alias = property.Alias, Name = property.PropertyType.Name, - Value = property.GetValue(), // todo ignoring variants + Value = property.GetValue(), // TODO: ignoring variants CreateDate = property.CreateDate, UpdateDate = property.UpdateDate }; diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index a4aedec438..95353715e1 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -307,7 +307,7 @@ namespace Umbraco.Core.Services.Implement summary.Append(""); foreach (var p in content.Properties) { - //todo doesn't take into account variants + // TODO: doesn't take into account variants var newText = p.GetValue() != null ? p.GetValue().ToString() : ""; var oldText = newText; diff --git a/src/Umbraco.Core/Services/Implement/RelationService.cs b/src/Umbraco.Core/Services/Implement/RelationService.cs index dc9693766f..a316d04f8e 100644 --- a/src/Umbraco.Core/Services/Implement/RelationService.cs +++ b/src/Umbraco.Core/Services/Implement/RelationService.cs @@ -393,7 +393,7 @@ namespace Umbraco.Core.Services.Implement if (scope.Events.DispatchCancelable(SavingRelation, this, saveEventArgs)) { scope.Complete(); - return relation; // todo - returning sth that does not exist here?! + return relation; // TODO: returning sth that does not exist here?! } _relationRepository.Save(relation); diff --git a/src/Umbraco.Core/Services/Implement/ScopeRepositoryService.cs b/src/Umbraco.Core/Services/Implement/ScopeRepositoryService.cs index 784d18da4e..d7303991b5 100644 --- a/src/Umbraco.Core/Services/Implement/ScopeRepositoryService.cs +++ b/src/Umbraco.Core/Services/Implement/ScopeRepositoryService.cs @@ -4,7 +4,7 @@ using Umbraco.Core.Scoping; namespace Umbraco.Core.Services.Implement { - // todo that one does not add anything = kill + // TODO: that one does not add anything = kill public abstract class ScopeRepositoryService : RepositoryService { protected ScopeRepositoryService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory) diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs index 1a88464231..e2c64d2f29 100644 --- a/src/Umbraco.Core/Services/Implement/UserService.cs +++ b/src/Umbraco.Core/Services/Implement/UserService.cs @@ -200,7 +200,7 @@ namespace Umbraco.Core.Services.Implement } catch (DbException) { - // todo - refactor users/upgrade + // TODO: refactor users/upgrade // currently kinda accepting anything on upgrade, but that won't deal with all cases // so we need to do it differently, see the custom UmbracoPocoDataBuilder which should // be better BUT requires that the app restarts after the upgrade! @@ -705,7 +705,7 @@ namespace Umbraco.Core.Services.Implement } catch (DbException) { - // todo - refactor users/upgrade + // TODO: refactor users/upgrade // currently kinda accepting anything on upgrade, but that won't deal with all cases // so we need to do it differently, see the custom UmbracoPocoDataBuilder which should // be better BUT requires that the app restarts after the upgrade! diff --git a/src/Umbraco.Core/Services/OperationResult.cs b/src/Umbraco.Core/Services/OperationResult.cs index f6349a985d..d5cdcd79fc 100644 --- a/src/Umbraco.Core/Services/OperationResult.cs +++ b/src/Umbraco.Core/Services/OperationResult.cs @@ -3,8 +3,7 @@ using Umbraco.Core.Events; namespace Umbraco.Core.Services { - // todo - // no need for Attempt - the operation result SHOULD KNOW if it's a success or a failure! + // TODO: no need for Attempt - the operation result SHOULD KNOW if it's a success or a failure! // but then each WhateverResultType must /// @@ -119,7 +118,7 @@ namespace Umbraco.Core.Services return new OperationResult(OperationResultType.FailedCancelledByEvent, eventMessages); } - // todo - this exists to support services that still return Attempt + // TODO: this exists to support services that still return Attempt // these services should directly return an OperationResult, and then this static class should be deleted internal static class Attempt { diff --git a/src/Umbraco.Core/Services/OperationResultType.cs b/src/Umbraco.Core/Services/OperationResultType.cs index 8ad24aafb8..2998692c13 100644 --- a/src/Umbraco.Core/Services/OperationResultType.cs +++ b/src/Umbraco.Core/Services/OperationResultType.cs @@ -38,7 +38,7 @@ /// /// No operation has been executed because it was not needed (eg deleting an item that doesn't exist). /// - NoOperation = Failed | 6, // todo shouldn't it be a success? + NoOperation = Failed | 6, // TODO: shouldn't it be a success? //TODO: In the future, we might need to add more operations statuses, potentially like 'FailedByPermissions', etc... } diff --git a/src/Umbraco.Core/Services/PublishResultType.cs b/src/Umbraco.Core/Services/PublishResultType.cs index 418e5c0896..1a2b52f9c9 100644 --- a/src/Umbraco.Core/Services/PublishResultType.cs +++ b/src/Umbraco.Core/Services/PublishResultType.cs @@ -115,7 +115,7 @@ /// /// The document could not be published because it has no publishing flags or values. /// - FailedPublishNothingToPublish = FailedPublish | 9, // in ContentService.StrategyCanPublish - todo weird + FailedPublishNothingToPublish = FailedPublish | 9, // TODO: in ContentService.StrategyCanPublish - weird /// /// The document could not be published because some mandatory cultures are missing. diff --git a/src/Umbraco.Core/Strings/Utf8ToAsciiConverter.cs b/src/Umbraco.Core/Strings/Utf8ToAsciiConverter.cs index f5b4a1cff3..91dd5a7597 100644 --- a/src/Umbraco.Core/Strings/Utf8ToAsciiConverter.cs +++ b/src/Umbraco.Core/Strings/Utf8ToAsciiConverter.cs @@ -3337,8 +3337,7 @@ namespace Umbraco.Core.Strings // time for a T4 template? // also we should support extensibility so ppl can register more cases in external code - // todo - // transliterates Анастасия as Anastasiya, and not Anastasia + // TODO: transliterates Анастасия as Anastasiya, and not Anastasia // Ольга --> Ol'ga, Татьяна --> Tat'yana -- that's bad (?) // Note: should ä (German umlaut) become a or ae ? diff --git a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs index d2b7903343..a10c967866 100644 --- a/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs +++ b/src/Umbraco.Core/Sync/ApplicationUrlHelper.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Sync /// in config files but is determined programmatically. /// Must be assigned before resolution is frozen. /// - // todo need another way to do it, eg an interface, injected! + // TODO: need another way to do it, eg an interface, injected! public static Func ApplicationUrlProvider { get; set; } internal static string GetApplicationUrl(ILogger logger, IGlobalSettings globalSettings, IUmbracoSettingsSection settings, IServerRegistrar serverRegistrar, HttpRequestBase request = null) diff --git a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs index a34644e6a1..741cc2bab1 100644 --- a/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DatabaseServerMessenger.cs @@ -302,7 +302,7 @@ namespace Umbraco.Core.Sync // (depending on what the cache refreshers are doing). I think it's best we do the one time check, process them and continue, if there are // pending requests after being processed, they'll just be processed on the next poll. // - // todo not true if we're running on a background thread, assuming we can? + // TODO: not true if we're running on a background thread, assuming we can? var sql = Sql().SelectAll() .From() From 0b6ba5aa52980537c42ede478842e0fe3ce804ec Mon Sep 17 00:00:00 2001 From: Chris Houston Date: Sat, 26 Jan 2019 10:52:19 -0500 Subject: [PATCH 48/76] Temp8 - Fixing spelling / typos etc in Umbraco.Web (#4148) --- src/Umbraco.Web.UI.Client/package-lock.json | 4 +- src/Umbraco.Web.UI/Views/Web.config | 6 +- .../Cache/ContentCacheRefresher.cs | 2 +- src/Umbraco.Web/Cache/DistributedCache.cs | 4 +- .../Cache/DistributedCacheBinder_Handlers.cs | 4 +- .../Cache/LanguageCacheRefresher.cs | 2 +- ...aseServerRegistrarAndMessengerComponent.cs | 2 +- .../Composers/ControllersComposer.cs | 3 +- .../Editors/AuthenticationController.cs | 52 ++++++------- .../Editors/BackOfficeController.cs | 4 +- .../Editors/BackOfficeServerVariables.cs | 2 +- .../Editors/Binders/MemberBinder.cs | 4 +- src/Umbraco.Web/Editors/CodeFileController.cs | 4 +- src/Umbraco.Web/Editors/ContentController.cs | 24 +++--- .../Editors/ContentControllerBase.cs | 4 +- .../Editors/ContentTypeController.cs | 8 +- .../Editors/ContentTypeControllerBase.cs | 2 +- src/Umbraco.Web/Editors/DataTypeController.cs | 6 +- .../Editors/DictionaryController.cs | 10 +-- src/Umbraco.Web/Editors/EntityController.cs | 6 +- .../Editors/ExamineManagementController.cs | 2 +- .../Filters/ContentItemValidationHelper.cs | 2 +- .../Filters/ContentSaveValidationAttribute.cs | 2 +- src/Umbraco.Web/Editors/LanguageController.cs | 4 +- src/Umbraco.Web/Editors/LegacyController.cs | 6 +- .../Editors/MacroRenderingController.cs | 12 +-- src/Umbraco.Web/Editors/MediaController.cs | 8 +- .../Editors/MediaTypeController.cs | 4 +- src/Umbraco.Web/Editors/MemberController.cs | 12 +-- .../Editors/MemberTypeController.cs | 4 +- .../Editors/PackageInstallController.cs | 2 +- src/Umbraco.Web/Editors/PasswordChanger.cs | 2 +- src/Umbraco.Web/Editors/TemplateController.cs | 2 +- .../Editors/TemplateQueryController.cs | 1 + .../Editors/UserGroupsController.cs | 2 +- src/Umbraco.Web/Editors/UsersController.cs | 2 +- .../FolderAndFilePermissionsCheck.cs | 2 +- .../HealthCheck/Checks/Security/HstsCheck.cs | 2 +- .../Checks/Security/XssProtectionCheck.cs | 2 +- .../HealthCheck/HealthCheckResults.cs | 4 +- .../HealthCheck/HealthCheckStatus.cs | 2 +- src/Umbraco.Web/HtmlHelperRenderExtensions.cs | 4 +- src/Umbraco.Web/HtmlStringUtilities.cs | 14 ++-- src/Umbraco.Web/HttpCookieExtensions.cs | 2 +- .../ImageCropperTemplateExtensions.cs | 10 +-- .../Controllers/InstallApiController.cs | 2 +- .../Install/FilePermissionHelper.cs | 6 +- .../Install/HttpInstallAuthorizeAttribute.cs | 4 +- .../Install/InstallAuthorizeAttribute.cs | 2 +- .../Install/InstallSteps/NewInstallStep.cs | 2 +- .../InstallSteps/SetUmbracoVersionStep.cs | 2 +- .../InstallSteps/StarterKitCleanupStep.cs | 2 +- .../InstallSteps/StarterKitInstallStep.cs | 2 +- src/Umbraco.Web/Macros/MacroRenderer.cs | 6 +- src/Umbraco.Web/Macros/MacroTagParser.cs | 10 +-- .../Media/EmbedProviders/OEmbedResponse.cs | 2 +- .../Media/Exif/ExifBitConverter.cs | 4 +- src/Umbraco.Web/Media/Exif/ExifProperty.cs | 2 +- .../Media/Exif/ExifPropertyFactory.cs | 2 +- src/Umbraco.Web/Media/Exif/ExifTag.cs | 4 +- src/Umbraco.Web/Media/Exif/JPEGFile.cs | 12 +-- src/Umbraco.Web/Media/Exif/MathEx.cs | 4 +- src/Umbraco.Web/ModelStateExtensions.cs | 2 +- .../Models/ContentEditing/ContentSortOrder.cs | 2 +- .../ContentEditing/ContentVariationDisplay.cs | 2 +- .../DictionaryTranslationSave.cs | 2 +- .../Models/ContentEditing/EntityBasic.cs | 2 +- .../ContentEditing/RelationTypeDisplay.cs | 2 +- .../ContentEditing/SimpleNotificationModel.cs | 2 +- .../ContentEditing/TabbedContentItem.cs | 4 +- .../Models/ContentEditing/TreeSearchResult.cs | 2 +- src/Umbraco.Web/Models/ImageCropMode.cs | 2 +- .../ContentItemDisplayVariationResolver.cs | 6 +- .../Mapping/ContentTypeProfileExtensions.cs | 6 +- .../Models/Mapping/DictionaryMapperProfile.cs | 4 +- .../Models/Mapping/LanguageMapperProfile.cs | 4 +- .../Models/Mapping/MacroMapperProfile.cs | 2 +- .../MemberTabsAndPropertiesResolver.cs | 38 +++++----- .../Mapping/TabsAndPropertiesResolver.cs | 4 +- src/Umbraco.Web/Models/PackageInstallModel.cs | 2 +- .../Models/PublishedContentBase.cs | 2 +- src/Umbraco.Web/Models/RegisterModel.cs | 2 +- .../Models/Trees/TreeNodeExtensions.cs | 2 +- src/Umbraco.Web/Mvc/ControllerExtensions.cs | 2 +- .../Mvc/DisableBrowserCacheAttribute.cs | 2 +- .../EnsurePublishedContentRequestAttribute.cs | 4 +- .../Mvc/MasterControllerFactory.cs | 2 +- src/Umbraco.Web/Mvc/PluginController.cs | 2 +- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 4 +- src/Umbraco.Web/Mvc/Strings.Designer.cs | 10 +-- src/Umbraco.Web/Mvc/Strings.resx | 4 +- .../Mvc/UmbracoAuthorizeAttribute.cs | 2 +- src/Umbraco.Web/Mvc/UmbracoPageResult.cs | 2 +- .../Mvc/UmbracoVirtualNodeRouteHandler.cs | 15 ++-- .../Mvc/ViewDataContainerExtensions.cs | 2 +- src/Umbraco.Web/OwinExtensions.cs | 2 +- .../FileUploadPropertyEditor.cs | 4 +- .../PropertyEditors/GridConfiguration.cs | 2 +- .../GridConfigurationEditor.cs | 4 +- .../ImageCropperPropertyEditor.cs | 6 +- .../ImageCropperPropertyValueEditor.cs | 2 +- .../MultiNodePickerConfigurationEditor.cs | 2 +- .../MultipleTextStringConfigurationEditor.cs | 4 +- .../PropertyEditors/RichTextPropertyEditor.cs | 2 +- .../PropertyEditors/RteEmbedController.cs | 2 +- .../PropertyEditors/TagConfigurationEditor.cs | 2 +- .../PropertyEditors/TagsDataController.cs | 2 +- .../MarkdownEditorValueConverter.cs | 2 +- .../ValueListUniqueValueValidator.cs | 4 +- .../IPublishedSnapshotService.cs | 4 +- .../PublishedCache/NuCache/ContentCache.cs | 2 +- .../NuCache/DataSource/SerializerBase.cs | 2 +- .../NuCache/Navigable/NavigableContentType.cs | 2 +- .../PublishedCache/NuCache/NuCacheComposer.cs | 2 +- .../NuCache/PublishedContent.cs | 2 +- .../NuCache/PublishedSnapshotService.cs | 16 ++-- .../PublishedCache/NuCache/SnapDictionary.cs | 2 +- .../PublishedElementPropertyBase.cs | 2 +- .../DictionaryPublishedContent.cs | 2 +- .../XmlPublishedCache/PublishedMediaCache.cs | 12 +-- .../XmlPublishedCache/XmlStore.cs | 14 ++-- .../XmlStoreFilePersister.cs | 2 +- src/Umbraco.Web/PublishedElementExtensions.cs | 2 +- src/Umbraco.Web/RouteCollectionExtensions.cs | 4 +- .../Routing/ContentFinderByRedirectUrl.cs | 2 +- .../Routing/ContentFinderByUrlAlias.cs | 3 +- .../Routing/IContentLastChanceFinder.cs | 2 +- src/Umbraco.Web/Routing/PublishedRequest.cs | 11 +-- src/Umbraco.Web/Routing/PublishedRouter.cs | 4 +- .../Routing/RedirectTrackingComponent.cs | 2 +- .../Runtime/WebRuntimeComponent.cs | 2 +- .../Scheduling/BackgroundTaskRunner.cs | 12 +-- .../Scheduling/RecurringTaskBase.cs | 4 +- src/Umbraco.Web/Scheduling/ScheduledTasks.cs | 2 +- .../Scheduling/SchedulerComponent.cs | 2 +- src/Umbraco.Web/Search/ExamineComponent.cs | 10 +-- src/Umbraco.Web/Search/ExamineComposer.cs | 2 +- .../Security/AuthenticationExtensions.cs | 44 +++++------ .../Security/BackOfficeSignInManager.cs | 4 +- .../Security/BackOfficeUserManager.cs | 14 ++-- .../Security/GetUserSecondsMiddleWare.cs | 2 +- .../Security/IdentityAuditEventArgs.cs | 4 +- src/Umbraco.Web/Security/MembershipHelper.cs | 6 +- .../Providers/UmbracoMembershipProvider.cs | 6 +- .../Security/SessionIdValidator.cs | 2 +- .../UmbracoAuthTicketDataProtector.cs | 2 +- .../Security/UmbracoSecureDataFormat.cs | 2 +- src/Umbraco.Web/Security/WebAuthExtensions.cs | 4 +- src/Umbraco.Web/Security/WebSecurity.cs | 2 +- src/Umbraco.Web/Templates/TemplateRenderer.cs | 2 +- .../Trees/ApplicationTreeController.cs | 2 +- .../Trees/ContentBlueprintTreeController.cs | 2 +- .../Trees/ContentTreeController.cs | 2 +- .../Trees/ContentTreeControllerBase.cs | 2 +- .../Trees/ContentTypeTreeController.cs | 4 +- .../Trees/DataTypeTreeController.cs | 4 +- .../Trees/DictionaryTreeController.cs | 2 +- .../Trees/MediaTypeTreeController.cs | 16 ++-- src/Umbraco.Web/Trees/TreeControllerBase.cs | 6 +- src/Umbraco.Web/Trees/UrlHelperExtensions.cs | 2 +- .../UI/JavaScript/AssetInitialization.cs | 2 +- .../ClientDependencyConfiguration.cs | 4 +- .../UI/JavaScript/Resources.Designer.cs | 73 ++++++++++++------- src/Umbraco.Web/UI/JavaScript/Resources.resx | 4 +- src/Umbraco.Web/UI/Pages/BasePage.cs | 4 +- src/Umbraco.Web/UI/Pages/ClientTools.cs | 6 +- src/Umbraco.Web/UmbracoApplicationBase.cs | 2 +- src/Umbraco.Web/UmbracoComponentRenderer.cs | 2 +- src/Umbraco.Web/UmbracoContext.cs | 2 +- src/Umbraco.Web/UmbracoHelper.cs | 28 +++---- src/Umbraco.Web/UmbracoInjectedModule.cs | 10 +-- src/Umbraco.Web/UriUtility.cs | 2 +- src/Umbraco.Web/UrlHelperExtensions.cs | 2 +- src/Umbraco.Web/UrlHelperRenderExtensions.cs | 12 +-- .../Filters/DisableBrowserCacheAttribute.cs | 2 +- .../FileUploadCleanupFilterAttribute.cs | 4 +- .../OverridableAuthorizationAttribute.cs | 2 +- .../UmbracoApplicationAuthorizeAttribute.cs | 2 +- .../WebApi/HttpActionContextExtensions.cs | 2 +- .../WebApi/HttpRequestMessageExtensions.cs | 4 +- .../SessionHttpControllerRouteHandler.cs | 2 +- src/Umbraco.Web/_Legacy/Controls/TabPage.cs | 2 +- .../PackageActions/publishRootDocument.cs | 2 +- .../_Legacy/UI/LegacyDialogHandler.cs | 2 +- .../umbraco.presentation/default.aspx.cs | 2 +- src/Umbraco.Web/umbraco.presentation/item.cs | 6 +- src/Umbraco.Web/umbraco.presentation/page.cs | 2 +- .../umbraco/dashboard/FeedProxy.aspx.cs | 2 +- .../umbraco/masterpages/umbracoPage.Master.cs | 2 +- .../DisableEventValidation.cs | 2 +- .../umbraco/templateControls/Item.cs | 2 +- .../umbraco/templateControls/ItemRenderer.cs | 2 +- .../umbraco/templateControls/Macro.cs | 2 +- 193 files changed, 498 insertions(+), 480 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/package-lock.json b/src/Umbraco.Web.UI.Client/package-lock.json index fe657ae470..8afb0a17e3 100644 --- a/src/Umbraco.Web.UI.Client/package-lock.json +++ b/src/Umbraco.Web.UI.Client/package-lock.json @@ -13278,7 +13278,7 @@ }, "pretty-hrtime": { "version": "1.0.3", - "resolved": "http://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, @@ -15838,7 +15838,7 @@ "dependencies": { "lru-cache": { "version": "2.2.4", - "resolved": "http://registry.npmjs.org/lru-cache/-/lru-cache-2.2.4.tgz", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.2.4.tgz", "integrity": "sha1-bGWGGb7PFAMdDQtZSxYELOTcBj0=", "dev": true } diff --git a/src/Umbraco.Web.UI/Views/Web.config b/src/Umbraco.Web.UI/Views/Web.config index c9a74eebb0..c137c3705e 100644 --- a/src/Umbraco.Web.UI/Views/Web.config +++ b/src/Umbraco.Web.UI/Views/Web.config @@ -54,16 +54,16 @@ Somehow, transitive dependencies are not working correctly, and either (a) NuGet fails to properly register this dependency, or (b) when reference assemblies are gathered before compiling views, this dependency is missed. In any case, the result is that the ICodeProvider is passed a list of referenced - assemblies that is missing netstandard. + assemblies that is missing .NET Standard. It may be a mix of both. NuGet registers the dependency well enough, that we can actually build the - whole application - but it is not doing something that is required in order to have netstandard + whole application - but it is not doing something that is required in order to have .NET Standard being a dependency when building views. See also: https://stackoverflow.com/questions/50165910 Funny enough, the CSharpCompiler already explicitly adds System.Runtime as a referenced assembly, - with a comment mentioning an issue. But it's not adding netstandard. So, for the time being, to be sure, + with a comment mentioning an issue. But it's not adding .NET Standard. So, for the time being, to be sure, we are adding both here. --> diff --git a/src/Umbraco.Web/Cache/ContentCacheRefresher.cs b/src/Umbraco.Web/Cache/ContentCacheRefresher.cs index a1942ed141..944157db9d 100644 --- a/src/Umbraco.Web/Cache/ContentCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/ContentCacheRefresher.cs @@ -75,7 +75,7 @@ namespace Umbraco.Web.Cache if (assignedDomains.Count > 0) { - // todo - this is duplicating the logic in DomainCacheRefresher BUT we cannot inject that into this because it it not registered explicitly in the container, + // TODO: this is duplicating the logic in DomainCacheRefresher BUT we cannot inject that into this because it it not registered explicitly in the container, // and we cannot inject the CacheRefresherCollection since that would be a circular reference, so what is the best way to call directly in to the // DomainCacheRefresher? diff --git a/src/Umbraco.Web/Cache/DistributedCache.cs b/src/Umbraco.Web/Cache/DistributedCache.cs index c445f66621..1e0e33ebd7 100644 --- a/src/Umbraco.Web/Cache/DistributedCache.cs +++ b/src/Umbraco.Web/Cache/DistributedCache.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.Cache #region Core notification methods /// - /// Notifies the distributed cache of specifieds item invalidation, for a specified . + /// Notifies the distributed cache of specified item invalidation, for a specified . /// /// The type of the invalidated items. /// The unique identifier of the ICacheRefresher. @@ -148,7 +148,7 @@ namespace Umbraco.Web.Cache } /// - /// Notifies the distributed cache of specifieds item removal, for a specified . + /// Notifies the distributed cache of specified item removal, for a specified . /// /// The type of the removed items. /// The unique identifier of the ICacheRefresher. diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs b/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs index f75d8ead87..4f05abc9ee 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs @@ -267,7 +267,7 @@ namespace Umbraco.Web.Cache #region LocalizationService / Language /// - /// Fires when a langauge is deleted + /// Fires when a language is deleted /// /// /// @@ -278,7 +278,7 @@ namespace Umbraco.Web.Cache } /// - /// Fires when a langauge is saved + /// Fires when a language is saved /// /// /// diff --git a/src/Umbraco.Web/Cache/LanguageCacheRefresher.cs b/src/Umbraco.Web/Cache/LanguageCacheRefresher.cs index c5dfcfd1e7..9093124609 100644 --- a/src/Umbraco.Web/Cache/LanguageCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/LanguageCacheRefresher.cs @@ -57,7 +57,7 @@ namespace Umbraco.Web.Cache if (assignedDomains.Count > 0) { - // todo - this is duplicating the logic in DomainCacheRefresher BUT we cannot inject that into this because it it not registered explicitly in the container, + // TODO: this is duplicating the logic in DomainCacheRefresher BUT we cannot inject that into this because it it not registered explicitly in the container, // and we cannot inject the CacheRefresherCollection since that would be a circular reference, so what is the best way to call directly in to the // DomainCacheRefresher? diff --git a/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs b/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs index 589502e6a2..4ae371502f 100644 --- a/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs +++ b/src/Umbraco.Web/Components/DatabaseServerRegistrarAndMessengerComponent.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.Components [RuntimeLevel(MinLevel = RuntimeLevel.Run)] // during Initialize / Startup, we end up checking Examine, which needs to be initialized beforehand - // todo - should not be a strong dependency on "examine" but on an "indexing component" + // TODO: should not be a strong dependency on "examine" but on an "indexing component" [ComposeAfter(typeof(ExamineComposer))] public sealed class DatabaseServerRegistrarAndMessengerComposer : ComponentComposer, ICoreComposer diff --git a/src/Umbraco.Web/Composing/Composers/ControllersComposer.cs b/src/Umbraco.Web/Composing/Composers/ControllersComposer.cs index 377a6bdb86..0aa3c7f8a1 100644 --- a/src/Umbraco.Web/Composing/Composers/ControllersComposer.cs +++ b/src/Umbraco.Web/Composing/Composers/ControllersComposer.cs @@ -32,8 +32,7 @@ namespace Umbraco.Web.Composing.Composers // UmbracoApiController is fast-ish because they both are IDiscoverable. Scanning for IController or IHttpController // is a full, non-cached scan = expensive, we do it only for 1 assembly. // - // TODO - // find a way to scan for IController *and* IHttpController in one single pass + // TODO: find a way to scan for IController *and* IHttpController in one single pass // or, actually register them manually so don't require a full scan for these // 5 are IController but not PluginController // Umbraco.Web.Mvc.RenderMvcController diff --git a/src/Umbraco.Web/Editors/AuthenticationController.cs b/src/Umbraco.Web/Editors/AuthenticationController.cs index c11b64882a..5804a00a79 100644 --- a/src/Umbraco.Web/Editors/AuthenticationController.cs +++ b/src/Umbraco.Web/Editors/AuthenticationController.cs @@ -69,8 +69,8 @@ namespace Umbraco.Web.Editors [WebApi.UmbracoAuthorize(requireApproval: false)] public IDictionary GetMembershipProviderConfig() { - //TODO: Check if the current PasswordValidator is an IMembershipProviderPasswordValidator, if - //it's not than we should return some generic defaults + // TODO: Check if the current PasswordValidator is an IMembershipProviderPasswordValidator, if + // it's not than we should return some generic defaults var provider = Core.Security.MembershipProviderExtensions.GetUsersMembershipProvider(); return provider.GetConfiguration(Services.UserService); } @@ -194,7 +194,7 @@ namespace Umbraco.Web.Editors if (user.IsApproved) { - //if they are approved, than they are no longer invited and we can return an error + // if they are approved, than they are no longer invited and we can return an error throw new HttpResponseException(Request.CreateUserNoAccessResponse()); } @@ -202,14 +202,14 @@ namespace Umbraco.Web.Editors var httpContextAttempt = TryGetHttpContext(); if (httpContextAttempt.Success) { - //set their remaining seconds + // set their remaining seconds result.SecondsUntilTimeout = httpContextAttempt.Result.GetRemainingAuthSeconds(); } return result; } - //TODO: This should be on the CurrentUserController? + // TODO: This should be on the CurrentUserController? [WebApi.UmbracoAuthorize] [ValidateAngularAntiForgeryToken] public async Task> GetCurrentUserLinkedLogins() @@ -228,8 +228,8 @@ namespace Umbraco.Web.Editors var http = EnsureHttpContext(); var owinContext = TryGetOwinContext().Result; - //Sign the user in with username/password, this also gives a chance for developers to - //custom verify the credentials and auto-link user accounts with a custom IBackOfficePasswordChecker + // Sign the user in with username/password, this also gives a chance for developers to + // custom verify the credentials and auto-link user accounts with a custom IBackOfficePasswordChecker var result = await SignInManager.PasswordSignInAsync( loginModel.Username, loginModel.Password, isPersistent: true, shouldLockout: true); @@ -237,7 +237,7 @@ namespace Umbraco.Web.Editors { case SignInStatus.Success: - //get the user + // get the user var user = Services.UserService.GetByUsername(loginModel.Username); UserManager.RaiseLoginSuccessEvent(user.Id); @@ -268,7 +268,7 @@ namespace Umbraco.Web.Editors var attemptedUser = Services.UserService.GetByUsername(loginModel.Username); - //create a with information to display a custom two factor send code view + // create a with information to display a custom two factor send code view var verifyResponse = Request.CreateResponse(HttpStatusCode.PaymentRequired, new { twoFactorView = twofactorView, @@ -282,10 +282,10 @@ namespace Umbraco.Web.Editors case SignInStatus.LockedOut: case SignInStatus.Failure: default: - //return BadRequest (400), we don't want to return a 401 because that get's intercepted + // return BadRequest (400), we don't want to return a 401 because that get's intercepted // by our angular helper because it thinks that we need to re-perform the request once we are - // authorized and we don't want to return a 403 because angular will show a warning msg indicating - // that the user doesn't have access to perform this function, we just want to return a normal invalid msg. + // authorized and we don't want to return a 403 because angular will show a warning message indicating + // that the user doesn't have access to perform this function, we just want to return a normal invalid message. throw new HttpResponseException(HttpStatusCode.BadRequest); } } @@ -314,13 +314,13 @@ namespace Umbraco.Web.Editors var callbackUrl = ConstructCallbackUrl(identityUser.Id, code); var message = Services.TextService.Localize("resetPasswordEmailCopyFormat", - //Ensure the culture of the found user is used for the email! + // Ensure the culture of the found user is used for the email! UserExtensions.GetUserCulture(identityUser.Culture, Services.TextService, GlobalSettings), new[] { identityUser.UserName, callbackUrl }); await UserManager.SendEmailAsync(identityUser.Id, Services.TextService.Localize("login/resetPasswordEmailCopySubject", - //Ensure the culture of the found user is used for the email! + // Ensure the culture of the found user is used for the email! UserExtensions.GetUserCulture(identityUser.Culture, Services.TextService, GlobalSettings)), message); @@ -332,7 +332,7 @@ namespace Umbraco.Web.Editors } /// - /// Used to retrived the 2FA providers for code submission + /// Used to retrieve the 2FA providers for code submission /// /// [SetAngularAntiForgeryTokens] @@ -417,7 +417,7 @@ namespace Umbraco.Web.Editors { Logger.Info("User {UserId} is currently locked out, unlocking and resetting AccessFailedCount", model.UserId); - //var user = await UserManager.FindByIdAsync(model.UserId); + //// var user = await UserManager.FindByIdAsync(model.UserId); var unlockResult = await UserManager.SetLockoutEndDateAsync(model.UserId, DateTimeOffset.Now); if (unlockResult.Succeeded == false) { @@ -431,18 +431,18 @@ namespace Umbraco.Web.Editors } } - //They've successfully set their password, we can now update their user account to be confirmed - //if user was only invited, then they have not been approved - //but a successful forgot password flow (e.g. if their token had expired and they did a forgot password instead of request new invite) - //means we have verified their email + // They've successfully set their password, we can now update their user account to be confirmed + // if user was only invited, then they have not been approved + // but a successful forgot password flow (e.g. if their token had expired and they did a forgot password instead of request new invite) + // means we have verified their email if (!UserManager.IsEmailConfirmed(model.UserId)) { await UserManager.ConfirmEmailAsync(model.UserId, model.ResetCode); } - //if the user is invited, enable their account on forgot password + // if the user is invited, enable their account on forgot password var identityUser = await UserManager.FindByIdAsync(model.UserId); - //invited is not approved, never logged in, invited date present + // invited is not approved, never logged in, invited date present /* if (LastLoginDate == default && IsApproved == false && InvitedDate != null) return UserState.Invited; @@ -450,7 +450,7 @@ namespace Umbraco.Web.Editors if (identityUser != null && !identityUser.IsApproved) { var user = Services.UserService.GetByUsername(identityUser.UserName); - //also check InvitedDate and never logged in, otherwise this would allow a disabled user to reactivate their account with a forgot password + // also check InvitedDate and never logged in, otherwise this would allow a disabled user to reactivate their account with a forgot password if (user.LastLoginDate == default && user.InvitedDate != null) { user.IsApproved = true; @@ -505,13 +505,13 @@ namespace Umbraco.Web.Editors if (principal == null) throw new ArgumentNullException(nameof(principal)); var userDetail = Mapper.Map(user); - //update the userDetail and set their remaining seconds + // update the userDetail and set their remaining seconds userDetail.SecondsUntilTimeout = TimeSpan.FromMinutes(GlobalSettings.TimeOutInMinutes).TotalSeconds; - //create a response with the userDetail object + // create a response with the userDetail object var response = Request.CreateResponse(HttpStatusCode.OK, userDetail); - //ensure the user is set for the current request + // ensure the user is set for the current request Request.SetPrincipalForRequest(principal); return response; diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 6dd5efecb1..7e45797107 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -176,7 +176,7 @@ namespace Umbraco.Web.Editors var textForCulture = Services.TextService.GetAllStoredValues(cultureInfo) //the dictionary returned is fine but the delimiter between an 'area' and a 'value' is a '/' but the javascript - // in the back office requres the delimiter to be a '_' so we'll just replace it + // in the back office requires the delimiter to be a '_' so we'll just replace it .ToDictionary(key => key.Key.Replace("/", "_"), val => val.Value); return new JsonNetResult { Data = textForCulture, Formatting = Formatting.Indented }; @@ -416,7 +416,7 @@ namespace Umbraco.Web.Editors { if (await AutoLinkAndSignInExternalAccount(loginInfo, autoLinkOptions) == false) { - ViewData[TokenExternalSignInError] = new[] { "The requested provider (" + loginInfo.Login.LoginProvider + ") has not been linked to to an account" }; + ViewData[TokenExternalSignInError] = new[] { "The requested provider (" + loginInfo.Login.LoginProvider + ") has not been linked to an account" }; } //Remove the cookie otherwise this message will keep appearing diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index d6a6947eba..1d4113bb7d 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -426,7 +426,7 @@ namespace Umbraco.Web.Editors /// /// /// We are doing this because if we constantly resolve the tree controller types from the PluginManager it will re-scan and also re-log that - /// it's resolving which is unecessary and annoying. + /// it's resolving which is unnecessary and annoying. /// private static readonly Lazy> TreeControllerTypes = new Lazy>(() => Current.TypeLoader.GetAttributedTreeControllers().ToArray()); // todo inject diff --git a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs index f50122bc9b..f54fd12c30 100644 --- a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs +++ b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs @@ -140,7 +140,7 @@ namespace Umbraco.Web.Editors.Binders var contentType = _services.MemberTypeService.Get(model.ContentTypeAlias); if (contentType == null) { - throw new InvalidOperationException("No member type found wth alias " + model.ContentTypeAlias); + throw new InvalidOperationException("No member type found with alias " + model.ContentTypeAlias); } //remove all membership properties, these values are set with the membership provider. @@ -176,7 +176,7 @@ namespace Umbraco.Web.Editors.Binders /// /// This will remove all of the special membership provider properties which were required to display the property editors - /// for editing - but the values have been mapped back ot the MemberSave object directly - we don't want to keep these properties + /// for editing - but the values have been mapped back to the MemberSave object directly - we don't want to keep these properties /// on the IMember because they will attempt to be persisted which we don't want since they might not even exist. /// /// diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index ec72ca3df4..6db0c6a8f9 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Editors if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name"); // if the parentId is root (-1) then we just need an empty string as we are - // creating the path below and we don't wan't -1 in the path + // creating the path below and we don't want -1 in the path if (parentId == Core.Constants.System.Root.ToInvariantString()) { parentId = string.Empty; @@ -193,7 +193,7 @@ namespace Umbraco.Web.Editors } /// - /// Used to get a list of available templates/snippets to base a new Partial View og Partial View Macro from + /// Used to get a list of available templates/snippets to base a new Partial View or Partial View Macro from /// /// This is a string but will be 'partialViews', 'partialViewMacros' /// Returns a list of if a correct type is sent diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index b574dc8f29..841c60938a 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -104,14 +104,14 @@ namespace Umbraco.Web.Editors /// /// /// - /// Permission check is done for letter 'R' which is for which the user must have access to to update + /// Permission check is done for letter 'R' which is for which the user must have access to update /// [EnsureUserPermissionForContent("saveModel.ContentId", 'R')] public IEnumerable PostSaveUserGroupPermissions(UserGroupPermissionsSave saveModel) { if (saveModel.ContentId <= 0) throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); - //TODO: Should non-admins be alowed to set granular permissions? + // TODO: Should non-admins be allowed to set granular permissions? var content = Services.ContentService.GetById(saveModel.ContentId); if (content == null) throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); @@ -166,7 +166,7 @@ namespace Umbraco.Web.Editors /// /// /// - /// Permission check is done for letter 'R' which is for which the user must have access to to view + /// Permission check is done for letter 'R' which is for which the user must have access to view /// [EnsureUserPermissionForContent("contentId", 'R')] public IEnumerable GetDetailedPermissions(int contentId) @@ -457,7 +457,7 @@ namespace Umbraco.Web.Editors Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "", - string cultureName = "") // TODO it's not a NAME it's the ISO CODE + string cultureName = "") // TODO: it's not a NAME it's the ISO CODE { long totalChildren; List children; @@ -583,7 +583,7 @@ namespace Umbraco.Web.Editors private ContentItemDisplay PostSaveInternal(ContentItemSave contentItem, Func saveMethod) { - //Recent versions of IE/Edge may send in the full clientside file path instead of just the file name. + //Recent versions of IE/Edge may send in the full client side file path instead of just the file name. //To ensure similar behavior across all browsers no matter what they do - we strip the FileName property of all //uploaded files to being *only* the actual file name (as it should be). if (contentItem.UploadedFiles != null && contentItem.UploadedFiles.Any()) @@ -647,7 +647,7 @@ namespace Umbraco.Web.Editors .Any(x => x == false)) { //ok, so the absolute mandatory data is invalid and it's new, we cannot actually continue! - // add the modelstate to the outgoing object and throw a validation message + // add the model state to the outgoing object and throw a validation message var forDisplay = MapToDisplay(contentItem.PersistedContent); forDisplay.Errors = ModelState.ToErrorDictionary(); throw new HttpResponseException(Request.CreateValidationErrorResponse(forDisplay)); @@ -797,7 +797,7 @@ namespace Umbraco.Web.Editors v.Notifications.AddRange(n.Notifications); } - //lasty, if it is not valid, add the modelstate to the outgoing object and throw a 403 + //lastly, if it is not valid, add the model state to the outgoing object and throw a 403 HandleInvalidModelState(display); if (wasCancelled) @@ -1040,7 +1040,7 @@ namespace Umbraco.Web.Editors /// /// /// global notifications will be shown if all variant processing is successful and the save/publish dialog is closed, otherwise - /// variant specific notifications are used to show success messagse in the save/publish dialog. + /// variant specific notifications are used to show success messages in the save/publish dialog. /// private static void AddSuccessNotification(IDictionary notifications, string culture, string header, string msg) { @@ -1091,7 +1091,7 @@ namespace Umbraco.Web.Editors { //its invariant, proceed normally var publishStatus = Services.ContentService.SaveAndPublishBranch(contentItem.PersistedContent, force, userId: Security.CurrentUser.Id); - //TODO: Deal with multiple cancelations + //TODO: Deal with multiple cancellations wasCancelled = publishStatus.Any(x => x.Result == PublishResultType.FailedPublishCancelledByEvent); successfulCultures = Array.Empty(); return publishStatus; @@ -1124,7 +1124,7 @@ namespace Umbraco.Web.Editors { //proceed to publish if all validation still succeeds var publishStatus = Services.ContentService.SaveAndPublishBranch(contentItem.PersistedContent, force, culturesToPublish, Security.CurrentUser.Id); - //TODO: Deal with multiple cancelations + //TODO: Deal with multiple cancellations wasCancelled = publishStatus.Any(x => x.Result == PublishResultType.FailedPublishCancelledByEvent); successfulCultures = contentItem.Variants.Where(x => x.Publish).Select(x => x.Culture).ToArray(); return publishStatus; @@ -1732,7 +1732,7 @@ namespace Umbraco.Web.Editors /// private void MapValuesForPersistence(ContentItemSave contentSave) { - //inline method to determine if a property type varies + // inline method to determine if a property type varies bool Varies(Property property) => property.PropertyType.VariesByCulture(); var variantIndex = 0; @@ -1865,7 +1865,7 @@ namespace Umbraco.Web.Editors /// /// /// - /// This is null when dealing with invariant content, else it's the cultures that were succesfully published + /// This is null when dealing with invariant content, else it's the cultures that were successfully published /// private void AddMessageForPublishStatus(IEnumerable statuses, INotificationModel display, string[] successfulCultures = null) { diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index 1a8820c4a0..904e6911c9 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -101,7 +101,7 @@ namespace Umbraco.Web.Editors protected virtual void HandleInvalidModelState(IErrorModel display) { - //lastly, if it is not valid, add the modelstate to the outgoing object and throw a 403 + //lastly, if it is not valid, add the model state to the outgoing object and throw a 403 if (!ModelState.IsValid) { display.Errors = ModelState.ToErrorDictionary(); @@ -117,7 +117,7 @@ namespace Umbraco.Web.Editors /// /// /// - /// This is useful for when filters have alraedy looked up a persisted entity and we don't want to have + /// This is useful for when filters have already looked up a persisted entity and we don't want to have /// to look it up again. /// protected TPersisted GetObjectFromRequest(Func getFromService) diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 9811c48801..b59e17d9e1 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a document type wth a given ID + /// Deletes a document type with a given ID /// /// /// @@ -128,7 +128,7 @@ namespace Umbraco.Web.Editors } /// - /// Returns the avilable compositions for this content type + /// Returns the available compositions for this content type /// This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body /// /// @@ -187,7 +187,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a document type container wth a given ID + /// Deletes a document type container with a given ID /// /// /// @@ -293,7 +293,7 @@ namespace Umbraco.Web.Editors saveContentType: type => Services.ContentTypeService.Save(type), beforeCreateNew: ctSave => { - //create a default template if it doesnt exist -but only if default template is == to the content type + //create a default template if it doesn't exist -but only if default template is == to the content type if (ctSave.DefaultTemplate.IsNullOrWhiteSpace() == false && ctSave.DefaultTemplate == ctSave.Alias) { var template = CreateTemplateForContentType(ctSave.Alias, ctSave.Name); diff --git a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs index 9cfde94a3a..fe91f9fff6 100644 --- a/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentTypeControllerBase.cs @@ -259,7 +259,7 @@ namespace Umbraco.Web.Editors ModelState.AddModelError("Alias", Services.TextService.Localize("editcontenttype/aliasAlreadyExists")); } - // execute the externam validators + // execute the external validators EditorValidator.Validate(ModelState, contentTypeSave); if (ModelState.IsValid == false) diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs index 335b609b0a..0af3a1cfe7 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -68,7 +68,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a data type wth a given ID + /// Deletes a data type with a given ID /// /// /// @@ -120,7 +120,7 @@ namespace Umbraco.Web.Editors { var dt = Services.DataTypeService.GetDataType(Constants.Conventions.DataTypes.ListViewPrefix + contentTypeAlias); - //if it doesnt exist yet, we will create it. + //if it doesn't exist yet, we will create it. if (dt == null) { var editor = _propertyEditors[Constants.PropertyEditors.Aliases.ListView]; @@ -172,7 +172,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a data type container wth a given ID + /// Deletes a data type container with a given ID /// /// /// diff --git a/src/Umbraco.Web/Editors/DictionaryController.cs b/src/Umbraco.Web/Editors/DictionaryController.cs index 9d01cc9d64..616317f7ba 100644 --- a/src/Umbraco.Web/Editors/DictionaryController.cs +++ b/src/Umbraco.Web/Editors/DictionaryController.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.Editors /// /// /// The security for this controller is defined to allow full CRUD access to dictionary if the user has access to either: - /// Dictionar + /// Dictionary /// [PluginController("UmbracoApi")] [UmbracoTreeAuthorize(Constants.Trees.Dictionary)] @@ -30,7 +30,7 @@ namespace Umbraco.Web.Editors public class DictionaryController : BackOfficeNotificationsController { /// - /// Deletes a data type wth a given ID + /// Deletes a data type with a given ID /// /// /// @@ -49,7 +49,7 @@ namespace Umbraco.Web.Editors } /// - /// Creates a new dictoinairy item + /// Creates a new dictionary item /// /// /// The parent id. @@ -65,7 +65,7 @@ namespace Umbraco.Web.Editors { if (string.IsNullOrEmpty(key)) return Request - .CreateNotificationValidationErrorResponse("Key can not be empty;"); // TODO translate + .CreateNotificationValidationErrorResponse("Key can not be empty;"); // TODO: translate if (Services.LocalizationService.DictionaryItemExists(key)) { @@ -108,7 +108,7 @@ namespace Umbraco.Web.Editors /// The . /// /// - /// Returrns a not found response when dictionary item does not exist + /// Returns a not found response when dictionary item does not exist /// public DictionaryDisplay GetById(int id) { diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index b25f3f5af1..6fcf5b0e2d 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -207,7 +207,7 @@ namespace Umbraco.Web.Editors /// Gets the url of an entity /// /// Int id of the entity to fetch URL for - /// The tpye of entity such as Document, Media, Member + /// The type of entity such as Document, Media, Member /// The URL or path to the item public HttpResponseMessage GetUrl(int id, UmbracoEntityTypes type) { @@ -256,7 +256,7 @@ namespace Umbraco.Web.Editors if (type != UmbracoEntityTypes.Document) - throw new ArgumentException("Get by query is only compatible with enitities of type Document"); + throw new ArgumentException("Get by query is only compatible with entities of type Document"); var q = ParseXPathQuery(query, nodeContextId); @@ -268,7 +268,7 @@ namespace Umbraco.Web.Editors return GetById(node.Id, type); } - //PP: wip in progress on the query parser + // PP: Work in progress on the query parser private string ParseXPathQuery(string query, int id) { return UmbracoXPathPathSyntaxParser.ParseXPathQuery( diff --git a/src/Umbraco.Web/Editors/ExamineManagementController.cs b/src/Umbraco.Web/Editors/ExamineManagementController.cs index b7392a1fa4..5f969cdd80 100644 --- a/src/Umbraco.Web/Editors/ExamineManagementController.cs +++ b/src/Umbraco.Web/Editors/ExamineManagementController.cs @@ -133,7 +133,7 @@ namespace Umbraco.Web.Editors _logger.Info("Rebuilding index '{IndexName}'", indexName); - //remove it in case there's a handler there alraedy + //remove it in case there's a handler there already index.IndexOperationComplete -= Indexer_IndexOperationComplete; //now add a single handler diff --git a/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs b/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs index 264dd049f5..e54bb3ef71 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs @@ -117,7 +117,7 @@ namespace Umbraco.Web.Editors.Filters /// /// /// - /// All property data validation goes into the modelstate with a prefix of "Properties" + /// All property data validation goes into the model state with a prefix of "Properties" /// public virtual bool ValidatePropertyData( TModelSave model, diff --git a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs index 789dd1fdf2..64e1c76417 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs @@ -152,7 +152,7 @@ namespace Umbraco.Web.Editors.Filters case ContentSaveAction.PublishWithDescendantsNew: case ContentSaveAction.PublishWithDescendantsForceNew: //Publish new requires both ActionNew AND ActionPublish - //TODO: Shoudn't publish also require ActionUpdate since it will definitely perform an update to publish but maybe that's just implied + //TODO: Shouldn't publish also require ActionUpdate since it will definitely perform an update to publish but maybe that's just implied permissionToCheck.Add(ActionNew.ActionLetter); permissionToCheck.Add(ActionPublish.ActionLetter); diff --git a/src/Umbraco.Web/Editors/LanguageController.cs b/src/Umbraco.Web/Editors/LanguageController.cs index 8b6d8ec6ac..64132d3d8e 100644 --- a/src/Umbraco.Web/Editors/LanguageController.cs +++ b/src/Umbraco.Web/Editors/LanguageController.cs @@ -100,7 +100,7 @@ namespace Umbraco.Web.Editors if (!ModelState.IsValid) throw new HttpResponseException(Request.CreateValidationErrorResponse(ModelState)); - // this is prone to race conds but the service will not let us proceed anyways + // this is prone to race conditions but the service will not let us proceed anyways var existing = Services.LocalizationService.GetLanguageByIsoCode(language.IsoCode); if (existing != null && language.Id != existing.Id) @@ -150,7 +150,7 @@ namespace Umbraco.Web.Editors existing.FallbackLanguageId = language.FallbackLanguageId; // modifying an existing language can create a fallback, verify - // note that the service will check again, dealing with race conds + // note that the service will check again, dealing with race conditions if (existing.FallbackLanguageId.HasValue) { var languages = Services.LocalizationService.GetAllLanguages().ToDictionary(x => x.Id, x => x); diff --git a/src/Umbraco.Web/Editors/LegacyController.cs b/src/Umbraco.Web/Editors/LegacyController.cs index e2e22457c1..bc5b3b1a7a 100644 --- a/src/Umbraco.Web/Editors/LegacyController.cs +++ b/src/Umbraco.Web/Editors/LegacyController.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.Editors [HttpPost] public HttpResponseMessage DeleteLegacyItem(string nodeId, string alias, string nodeType) { - //U4-2686 - alias is html encoded, make sure to decode + //U4-2686 - alias is HTML encoded, make sure to decode alias = HttpUtility.HtmlDecode(alias); //In order to process this request we MUST have an HttpContext available @@ -45,8 +45,8 @@ namespace Umbraco.Web.Editors return Request.CreateResponse(HttpStatusCode.OK); } - //the way this legacy stuff used to work is that if the node id didn't parse, we would - //pass the node id as the alias with an id of zero = sure whatevs. + // the way this legacy stuff used to work is that if the node id didn't parse, we would + // pass the node id as the alias with an id of zero = sure whatevs. LegacyDialogHandler.Delete(httpContextAttempt.Result, Security.CurrentUser, nodeType, 0, nodeId); return Request.CreateResponse(HttpStatusCode.OK); } diff --git a/src/Umbraco.Web/Editors/MacroRenderingController.cs b/src/Umbraco.Web/Editors/MacroRenderingController.cs index 0b4a78e603..3ec25b1632 100644 --- a/src/Umbraco.Web/Editors/MacroRenderingController.cs +++ b/src/Umbraco.Web/Editors/MacroRenderingController.cs @@ -60,7 +60,7 @@ namespace Umbraco.Web.Editors } /// - /// Gets a rendered macro as html for rendering in the rich text editor + /// Gets a rendered macro as HTML for rendering in the rich text editor /// /// /// @@ -78,8 +78,8 @@ namespace Umbraco.Web.Editors } /// - /// Gets a rendered macro as html for rendering in the rich text editor. - /// Using HTTP POST instead of GET allows for more parameters to be passed as it's not dependant on URL-length limitations like GET. + /// Gets a rendered macro as HTML for rendering in the rich text editor. + /// Using HTTP POST instead of GET allows for more parameters to be passed as it's not dependent on URL-length limitations like GET. /// The method using GET is kept to maintain backwards compatibility /// /// @@ -116,14 +116,14 @@ namespace Umbraco.Web.Editors if (macro.RenderInEditor == false) { var response = Request.CreateResponse(); - //need to create a specific content result formatted as html since this controller has been configured + //need to create a specific content result formatted as HTML since this controller has been configured //with only json formatters. response.Content = new StringContent(string.Empty, Encoding.UTF8, "text/html"); return response; } - //because macro's are filled with insane legacy bits and pieces we need all sorts of wierdness to make them render. + //because macro's are filled with insane legacy bits and pieces we need all sorts of weirdness to make them render. //the 'easiest' way might be to create an IPublishedContent manually and populate the legacy 'page' object with that //and then set the legacy parameters. @@ -145,7 +145,7 @@ namespace Umbraco.Web.Editors var renderer = new UmbracoComponentRenderer(UmbracoContext); var result = Request.CreateResponse(); - //need to create a specific content result formatted as html since this controller has been configured + //need to create a specific content result formatted as HTML since this controller has been configured //with only json formatters. result.Content = new StringContent( renderer.RenderMacro(macro, macroParams, legacyPage).ToString(), diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index ce088e0caa..fe081c1cb4 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -457,7 +457,7 @@ namespace Umbraco.Web.Editors [ModelBinder(typeof(MediaItemBinder))] MediaItemSave contentItem) { - //Recent versions of IE/Edge may send in the full clientside file path instead of just the file name. + //Recent versions of IE/Edge may send in the full client side file path instead of just the file name. //To ensure similar behavior across all browsers no matter what they do - we strip the FileName property of all //uploaded files to being *only* the actual file name (as it should be). if (contentItem.UploadedFiles != null && contentItem.UploadedFiles.Any()) @@ -500,7 +500,7 @@ namespace Umbraco.Web.Editors && (contentItem.Action == ContentSaveAction.SaveNew)) { //ok, so the absolute mandatory data is invalid and it's new, we cannot actually continue! - // add the modelstate to the outgoing object and throw validation response + // add the model state to the outgoing object and throw validation response var forDisplay = Mapper.Map(contentItem.PersistedContent); forDisplay.Errors = ModelState.ToErrorDictionary(); throw new HttpResponseException(Request.CreateValidationErrorResponse(forDisplay)); @@ -513,7 +513,7 @@ namespace Umbraco.Web.Editors //return the updated model var display = Mapper.Map(contentItem.PersistedContent); - //lasty, if it is not valid, add the modelstate to the outgoing object and throw a 403 + //lastly, if it is not valid, add the model state to the outgoing object and throw a 403 HandleInvalidModelState(display); //put the correct msgs in @@ -928,7 +928,7 @@ namespace Umbraco.Web.Editors if (media == null && nodeId != Constants.System.Root && nodeId != Constants.System.RecycleBinMedia) { media = mediaService.GetById(nodeId); - //put the content item into storage so it can be retreived + //put the content item into storage so it can be retrieved // in the controller (saves a lookup) storage[typeof(IMedia).ToString()] = media; } diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs index d6acc9331e..dd1f53f8af 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -92,7 +92,7 @@ namespace Umbraco.Web.Editors } /// - /// Returns the avilable compositions for this content type + /// Returns the available compositions for this content type /// This has been wrapped in a dto instead of simple parameters to support having multiple parameters in post request body /// /// @@ -154,7 +154,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a media type container wth a given ID + /// Deletes a media type container with a given ID /// /// /// diff --git a/src/Umbraco.Web/Editors/MemberController.cs b/src/Umbraco.Web/Editors/MemberController.cs index 92ca648c3f..2211bea76b 100644 --- a/src/Umbraco.Web/Editors/MemberController.cs +++ b/src/Umbraco.Web/Editors/MemberController.cs @@ -307,7 +307,7 @@ namespace Umbraco.Web.Editors string generatedPassword = null; //Depending on the action we need to first do a create or update using the membership provider - // this ensures that passwords are formatted correclty and also performs the validation on the provider itself. + // this ensures that passwords are formatted correctly and also performs the validation on the provider itself. switch (contentItem.Action) { case ContentSaveAction.Save: @@ -360,7 +360,7 @@ namespace Umbraco.Web.Editors Roles.AddUserToRoles(contentItem.PersistedContent.Username, toAdd); } - //set the generated password (if there was one) - in order to do this we'll chuck the gen'd password into the + //set the generated password (if there was one) - in order to do this we'll chuck the generated password into the // additional data of the IUmbracoEntity of the persisted item - then we can retrieve this in the model mapper and set // the value to be given to the UI. Hooray for AdditionalData :) contentItem.PersistedContent.AdditionalData["GeneratedPassword"] = generatedPassword; @@ -368,11 +368,11 @@ namespace Umbraco.Web.Editors //return the updated model var display = Mapper.Map(contentItem.PersistedContent); - //lasty, if it is not valid, add the modelstate to the outgoing object and throw a 403 + //lastly, if it is not valid, add the model state to the outgoing object and throw a 403 HandleInvalidModelState(display); var localizedTextService = Services.TextService; - //put the correct msgs in + //put the correct messages in switch (contentItem.Action) { case ContentSaveAction.Save: @@ -603,7 +603,7 @@ namespace Umbraco.Web.Editors /// /// Following a refresh of member data called during an update if the membership provider has changed some underlying data, - /// we don't want to lose the provided, and potentiallly changed, username + /// we don't want to lose the provided, and potentially changed, username /// /// /// @@ -637,7 +637,7 @@ namespace Umbraco.Web.Editors /// we create an empty IMember instance first (of type 'Member'), this gives us a unique ID (GUID) /// that we then use to create the member in the custom membership provider. This acts as the link between Umbraco data and /// the custom membership provider data. This gives us the ability to eventually have custom membership properties but still use - /// a custom memberhip provider. If there is no 'Member' member type, then we will simply just create the membership provider member + /// a custom membership provider. If there is no 'Member' member type, then we will simply just create the membership provider member /// with no link to our data. /// /// If this is successful, it will go and re-fetch the IMember from the db because it will now have an ID because the Umbraco provider diff --git a/src/Umbraco.Web/Editors/MemberTypeController.cs b/src/Umbraco.Web/Editors/MemberTypeController.cs index f6bcbb727f..b200f17372 100644 --- a/src/Umbraco.Web/Editors/MemberTypeController.cs +++ b/src/Umbraco.Web/Editors/MemberTypeController.cs @@ -51,7 +51,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a document type wth a given ID + /// Deletes a document type with a given ID /// /// /// @@ -71,7 +71,7 @@ namespace Umbraco.Web.Editors } /// - /// Returns the avilable compositions for this content type + /// Returns the available compositions for this content type /// /// /// diff --git a/src/Umbraco.Web/Editors/PackageInstallController.cs b/src/Umbraco.Web/Editors/PackageInstallController.cs index e38a2fdd26..658a28a79e 100644 --- a/src/Umbraco.Web/Editors/PackageInstallController.cs +++ b/src/Umbraco.Web/Editors/PackageInstallController.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Editors } /// - /// This checks if this package & version is alraedy installed + /// This checks if this package & version is already installed /// /// /// diff --git a/src/Umbraco.Web/Editors/PasswordChanger.cs b/src/Umbraco.Web/Editors/PasswordChanger.cs index 6777ae1f56..e124f3a9a4 100644 --- a/src/Umbraco.Web/Editors/PasswordChanger.cs +++ b/src/Umbraco.Web/Editors/PasswordChanger.cs @@ -254,7 +254,7 @@ namespace Umbraco.Web.Editors if (passwordModel.OldPassword.IsNullOrWhiteSpace() == false) { - //if an old password is suplied try to change it + //if an old password is supplied try to change it try { diff --git a/src/Umbraco.Web/Editors/TemplateController.cs b/src/Umbraco.Web/Editors/TemplateController.cs index 5c0a746ee7..ac9341a095 100644 --- a/src/Umbraco.Web/Editors/TemplateController.cs +++ b/src/Umbraco.Web/Editors/TemplateController.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Editors } /// - /// Deletes a template wth a given ID + /// Deletes a template with a given ID /// /// /// diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs index 73ebdf3bc5..41f38679a9 100644 --- a/src/Umbraco.Web/Editors/TemplateQueryController.cs +++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs @@ -120,6 +120,7 @@ namespace Umbraco.Web.Editors //x is passed in as the parameter alias for the linq where statement clause var operation = condition.BuildCondition("x", contents, Properties); + //for review - this uses a tonized query rather then the normal linq query. contents = contents.Where(operation.Compile()); queryExpression.Append(indent); queryExpression.AppendFormat(".Where({0})", operation); diff --git a/src/Umbraco.Web/Editors/UserGroupsController.cs b/src/Umbraco.Web/Editors/UserGroupsController.cs index 5069d99cfe..c8f7d2b0df 100644 --- a/src/Umbraco.Web/Editors/UserGroupsController.cs +++ b/src/Umbraco.Web/Editors/UserGroupsController.cs @@ -112,7 +112,7 @@ namespace Umbraco.Web.Editors if (onlyCurrentUserGroups == false) { - //this user is not an admin so in that case we need to exlude all admin users + //this user is not an admin so in that case we need to exclude all admin users allGroups.RemoveAt(allGroups.IndexOf(allGroups.Find(basic => basic.Alias == Constants.Security.AdminGroupAlias))); return allGroups; } diff --git a/src/Umbraco.Web/Editors/UsersController.cs b/src/Umbraco.Web/Editors/UsersController.cs index e7432c4828..c31d005ea6 100644 --- a/src/Umbraco.Web/Editors/UsersController.cs +++ b/src/Umbraco.Web/Editors/UsersController.cs @@ -200,7 +200,7 @@ namespace Umbraco.Web.Editors var isAdmin = Security.CurrentUser.IsAdmin(); if (isAdmin == false) { - //this user is not an admin so in that case we need to exlude all admin users + //this user is not an admin so in that case we need to exclude all admin users excludeUserGroups = new[] {Constants.Security.AdminGroupAlias}; } diff --git a/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs index 13e99fa886..273d19bae0 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Permissions/FolderAndFilePermissionsCheck.cs @@ -134,7 +134,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Permissions bool optionalPathCheckResult, IEnumerable optionalFailedPaths, PermissionCheckFor checkingFor) { - // Return error if any required parths fail the check, or warning if any optional ones do + // Return error if any required paths fail the check, or warning if any optional ones do var resultType = StatusResultType.Success; var messageKey = string.Format("healthcheck/{0}PermissionsCheckMessage", checkingFor == PermissionCheckFor.Folder ? "folder" : "file"); diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/HstsCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/HstsCheck.cs index 61f56ec9d8..18827b0c81 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Security/HstsCheck.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Security/HstsCheck.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security { // The check is mostly based on the instructions in the OWASP CheatSheet // (https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet) - // and the blogpost of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/) + // and the blog post of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/) // If you want do to it perfectly, you have to submit it https://hstspreload.appspot.com/, // but then you should include subdomains and I wouldn't suggest to do that for Umbraco-sites. public HstsCheck(IRuntimeState runtime, ILocalizedTextService textService) diff --git a/src/Umbraco.Web/HealthCheck/Checks/Security/XssProtectionCheck.cs b/src/Umbraco.Web/HealthCheck/Checks/Security/XssProtectionCheck.cs index 75595db992..dc25aa6a65 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Security/XssProtectionCheck.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Security/XssProtectionCheck.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.HealthCheck.Checks.Security { // The check is mostly based on the instructions in the OWASP CheatSheet // (https://www.owasp.org/index.php/HTTP_Strict_Transport_Security_Cheat_Sheet) - // and the blogpost of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/) + // and the blog post of Troy Hunt (https://www.troyhunt.com/understanding-http-strict-transport/) // If you want do to it perfectly, you have to submit it https://hstspreload.appspot.com/, // but then you should include subdomains and I wouldn't suggest to do that for Umbraco-sites. public XssProtectionCheck(IRuntimeState runtime, ILocalizedTextService textService) diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs index f8c3708e2e..da906c30f9 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.HealthCheck var checkIsSuccess = result.Value.All(x => x.ResultType == StatusResultType.Success); if (checkIsSuccess) { - Logger.Info("Checks for '{HealthCheckName}' all completed succesfully.", checkName); + Logger.Info("Checks for '{HealthCheckName}' all completed successfully.", checkName); } else { @@ -96,7 +96,7 @@ namespace Umbraco.Web.HealthCheck if (checkIsSuccess) { - sb.AppendFormat("{0}Checks for '{1}' all completed succesfully.{2}", newItem, checkName, Environment.NewLine); + sb.AppendFormat("{0}Checks for '{1}' all completed successfully.{2}", newItem, checkName, Environment.NewLine); } else { diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs b/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs index 445582788a..2db0b1f2e7 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web.HealthCheck public string Description { get; set; } /// - /// This is optional but would allow a developer to specify a path to an angular html view + /// This is optional but would allow a developer to specify a path to an angular HTML view /// in order to either show more advanced information and/or to provide input for the admin /// to configure how an action is executed /// diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs index 626a19a369..e18397dea2 100644 --- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs @@ -140,7 +140,7 @@ namespace Umbraco.Web return htmlHelper.ValidationSummary(excludePropertyErrors, message, htmlAttributes); } - //if there's a prefix applied, we need to create a new html helper with a filtered ModelState collection so that it only looks for + //if there's a prefix applied, we need to create a new HTML helper with a filtered ModelState collection so that it only looks for //specific model state with the prefix. var filteredHtmlHelper = new HtmlHelper(htmlHelper.ViewContext, htmlHelper.ViewDataContainer.FilterContainer(prefix)); return filteredHtmlHelper.ValidationSummary(excludePropertyErrors, message, htmlAttributes); @@ -736,7 +736,7 @@ namespace Umbraco.Web object additionalRouteVals = null) { - //ensure that the multipart/form-data is added to the html attributes + //ensure that the multipart/form-data is added to the HTML attributes if (htmlAttributes.ContainsKey("enctype") == false) { htmlAttributes.Add("enctype", "multipart/form-data"); diff --git a/src/Umbraco.Web/HtmlStringUtilities.cs b/src/Umbraco.Web/HtmlStringUtilities.cs index be14df8e5a..6cf5092bb0 100644 --- a/src/Umbraco.Web/HtmlStringUtilities.cs +++ b/src/Umbraco.Web/HtmlStringUtilities.cs @@ -11,15 +11,15 @@ using Umbraco.Web.WebApi.Filters; namespace Umbraco.Web { /// - /// Provides utility methods for UmbracoHelper for working with strings and html in views. + /// Provides utility methods for UmbracoHelper for working with strings and HTML in views. /// public sealed class HtmlStringUtilities { /// - /// Replaces text line breaks with html line breaks + /// Replaces text line breaks with HTML line breaks /// /// The text. - /// The text with text line breaks replaced with html linebreaks (
)
+ /// The text with text line breaks replaced with HTML line breaks (
)
public HtmlString ReplaceLineBreaksForHtml(string text) { return new HtmlString(text.Replace("\r\n", @"
").Replace("\n", @"
").Replace("\r", @"
")); @@ -257,8 +257,8 @@ namespace Umbraco.Web string firstTrim = outputtr.ReadToEnd().Replace(" ", " ").Trim(); - //Check to see if there is an empty char between the hellip and the output string - //if there is, remove it + // Check to see if there is an empty char between the hellip and the output string + // if there is, remove it if (addElipsis && lengthReached && string.IsNullOrWhiteSpace(firstTrim) == false) { result = firstTrim[firstTrim.Length - hellip.Length - 1] == ' ' ? firstTrim.Remove(firstTrim.Length - hellip.Length - 1, 1) : firstTrim; @@ -275,9 +275,9 @@ namespace Umbraco.Web } /// - /// Returns the length of the words from a html block + /// Returns the length of the words from a HTML block /// - /// Html text + /// HTML text /// Amount of words you would like to measure /// /// diff --git a/src/Umbraco.Web/HttpCookieExtensions.cs b/src/Umbraco.Web/HttpCookieExtensions.cs index 0006227f58..5f520653f5 100644 --- a/src/Umbraco.Web/HttpCookieExtensions.cs +++ b/src/Umbraco.Web/HttpCookieExtensions.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web /// Extension methods used to check/set cookie values /// /// - /// This should 100% supercede the StateManager.Cookies + /// This should 100% supersede the StateManager.Cookies /// internal static class HttpCookieExtensions { diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs index 83e4b727b2..ed9903e07a 100644 --- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs +++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs @@ -88,7 +88,7 @@ namespace Umbraco.Web /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters. /// /// - /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated + /// Add a serialized date of the last edit of the item to ensure client cache refresh when updated /// /// /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example: @@ -196,7 +196,7 @@ namespace Umbraco.Web /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters /// /// - /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated + /// Add a serialized date of the last edit of the item to ensure client cache refresh when updated /// /// /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example: @@ -275,7 +275,7 @@ namespace Umbraco.Web /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters /// /// - /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated + /// Add a serialized date of the last edit of the item to ensure client cache refresh when updated /// /// /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example: @@ -383,7 +383,7 @@ namespace Umbraco.Web if (ratioMode == ImageCropRatioMode.Width && height != null) { - // if only height specified then assume a sqaure + // if only height specified then assume a square if (width == null) { width = height; @@ -395,7 +395,7 @@ namespace Umbraco.Web if (ratioMode == ImageCropRatioMode.Height && width != null) { - // if only width specified then assume a sqaure + // if only width specified then assume a square if (height == null) { height = width; diff --git a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs index c8e862abcb..bf371bacf0 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Install.Controllers var installSteps = _installSteps.GetStepsForCurrentInstallType().ToArray(); - //only get the steps that are targetting the current install type + //only get the steps that are targeting the current install type steps.AddRange(installSteps); setup.Steps = steps; diff --git a/src/Umbraco.Web/Install/FilePermissionHelper.cs b/src/Umbraco.Web/Install/FilePermissionHelper.cs index 26e24bd966..6c166e734b 100644 --- a/src/Umbraco.Web/Install/FilePermissionHelper.cs +++ b/src/Umbraco.Web/Install/FilePermissionHelper.cs @@ -211,9 +211,9 @@ namespace Umbraco.Web.Install } catch (Exception) { - //This is not 100% accurate btw because it could turn out that the current user doesn't - //have access to read the current permissions but does have write access. - //I think this is an edge case however + // This is not 100% accurate because it could turn out that the current user doesn't + // have access to read the current permissions but does have write access. + // I think this is an edge case however return false; } diff --git a/src/Umbraco.Web/Install/HttpInstallAuthorizeAttribute.cs b/src/Umbraco.Web/Install/HttpInstallAuthorizeAttribute.cs index 83aa037097..e135a83e81 100644 --- a/src/Umbraco.Web/Install/HttpInstallAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Install/HttpInstallAuthorizeAttribute.cs @@ -9,11 +9,11 @@ namespace Umbraco.Web.Install { /// /// Ensures authorization occurs for the installer if it has already completed. - /// If install has not yet occured then the authorization is successful. + /// If install has not yet occurred then the authorization is successful. /// internal class HttpInstallAuthorizeAttribute : AuthorizeAttribute { - // todo - cannot inject UmbracoContext nor RuntimeState in the attribute, read: + // TODO: cannot inject UmbracoContext nor RuntimeState in the attribute, read: // http://stackoverflow.com/questions/30096903/dependency-injection-inside-a-filterattribute-in-asp-net-mvc-6 // https://www.cuttingedge.it/blogs/steven/pivot/entry.php?id=98 - don't do it! // http://blog.ploeh.dk/2014/06/13/passive-attributes/ - passive attributes diff --git a/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs b/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs index 238bb7c6eb..2041228a3e 100644 --- a/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Install/InstallAuthorizeAttribute.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Install { /// /// Ensures authorization occurs for the installer if it has already completed. - /// If install has not yet occured then the authorization is successful + /// If install has not yet occurred then the authorization is successful /// internal class InstallAuthorizeAttribute : AuthorizeAttribute { diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index 9132f5cd49..7b53ecb966 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Install.InstallSteps /// This is the first UI step for a brand new install /// /// - /// By default this will show the user view which is the most basic information to configure a new install, but if an install get's interupted because of an + /// By default this will show the user view which is the most basic information to configure a new install, but if an install get's interrupted because of an /// error, etc... and the end-user refreshes the installer then we cannot show the user screen because they've already entered that information so instead we'll /// display a simple continue installation view. /// diff --git a/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs b/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs index 3e836397fd..55d7d49ba9 100644 --- a/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/SetUmbracoVersionStep.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.Install.InstallSteps public override Task ExecuteAsync(object model) { //During a new install we'll log the default user in (which is id = 0). - // During an upgrade, the user will already need to be logged in in order to run the installer. + // During an upgrade, the user will already need to be logged in order to run the installer. var security = new WebSecurity(_httpContext, _userService, _globalSettings); //we do this check here because for upgrades the user will already be logged in, for brand new installs, diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs index 80fda66661..3ddc675405 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs @@ -32,7 +32,7 @@ namespace Umbraco.Web.Install.InstallSteps public override bool RequiresExecution(object model) { var installSteps = InstallStatusTracker.GetStatus().ToArray(); - //this step relies on the preious one completed - because it has stored some information we need + //this step relies on the previous one completed - because it has stored some information we need if (installSteps.Any(x => x.Name == "StarterKitDownload" && x.AdditionalData.ContainsKey("packageId")) == false) { return false; diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs index 8bd699f293..8a61f9230c 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitInstallStep.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Install.InstallSteps public override bool RequiresExecution(object model) { var installSteps = InstallStatusTracker.GetStatus().ToArray(); - //this step relies on the preious one completed - because it has stored some information we need + //this step relies on the previous one completed - because it has stored some information we need if (installSteps.Any(x => x.Name == "StarterKitDownload" && x.AdditionalData.ContainsKey("packageId")) == false) { return false; diff --git a/src/Umbraco.Web/Macros/MacroRenderer.cs b/src/Umbraco.Web/Macros/MacroRenderer.cs index b7187da743..17c5859e91 100755 --- a/src/Umbraco.Web/Macros/MacroRenderer.cs +++ b/src/Umbraco.Web/Macros/MacroRenderer.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Macros { private readonly IProfilingLogger _plogger; - // todo: there are many more things that would need to be injected in here + // TODO: there are many more things that would need to be injected in here public MacroRenderer(IProfilingLogger plogger) { @@ -226,7 +226,7 @@ namespace Umbraco.Web.Macros // still, this is ugly. The macro should have a Content property // referring to IPublishedContent we're rendering the macro against, - // this is all soooo convoluted ;-( + // this is all so convoluted ;-( public MacroContent Render(MacroModel macro, Hashtable pageElements, int pageId, Hashtable attributes) { @@ -547,7 +547,7 @@ namespace Umbraco.Web.Macros private static string EncodeMacroAttribute(string attributeContents) { - // replace linebreaks + // replace line breaks attributeContents = attributeContents.Replace("\n", "\\n").Replace("\r", "\\r"); // replace quotes diff --git a/src/Umbraco.Web/Macros/MacroTagParser.cs b/src/Umbraco.Web/Macros/MacroTagParser.cs index cbfc1ce0f7..8e3f116614 100644 --- a/src/Umbraco.Web/Macros/MacroTagParser.cs +++ b/src/Umbraco.Web/Macros/MacroTagParser.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.Macros /// persist all macro formats like {?UMBRACO_MACRO macroAlias=\"myMacro\" /} /// /// - /// The html attributes to be added to the div + /// The HTML attributes to be added to the div /// /// /// This converts the persisted macro format to this: @@ -77,11 +77,11 @@ namespace Umbraco.Web.Macros /// /// /// - /// This is required because when editors are using the rte, the html that is contained in the editor might actually be displaying + /// This is required because when editors are using the rte, the HTML that is contained in the editor might actually be displaying /// the entire macro content, when the data is submitted the editor will clear most of this data out but we'll still need to parse it properly - /// and ensure the correct sytnax is persisted to the db. + /// and ensure the correct syntax is persisted to the db. /// - /// When a macro is inserted into the rte editor, the html will be: + /// When a macro is inserted into the rte editor, the HTML will be: /// /// {div class='umb-macro-holder'} /// @@ -134,7 +134,7 @@ namespace Umbraco.Web.Macros } /// - /// This will accept a text block and seach/parse it for macro markup. + /// This will accept a text block and search/parse it for macro markup. /// When either a text block or a a macro is found, it will call the callback method. /// /// diff --git a/src/Umbraco.Web/Media/EmbedProviders/OEmbedResponse.cs b/src/Umbraco.Web/Media/EmbedProviders/OEmbedResponse.cs index 84164bc47f..e6577dea1f 100644 --- a/src/Umbraco.Web/Media/EmbedProviders/OEmbedResponse.cs +++ b/src/Umbraco.Web/Media/EmbedProviders/OEmbedResponse.cs @@ -47,7 +47,7 @@ namespace Umbraco.Web.Media.EmbedProviders /// /// Gets the HTML. /// - /// The response html + /// The response HTML public string GetHtml() { if (Type == "photo") diff --git a/src/Umbraco.Web/Media/Exif/ExifBitConverter.cs b/src/Umbraco.Web/Media/Exif/ExifBitConverter.cs index e116e1994f..86bd12c15e 100644 --- a/src/Umbraco.Web/Media/Exif/ExifBitConverter.cs +++ b/src/Umbraco.Web/Media/Exif/ExifBitConverter.cs @@ -99,7 +99,7 @@ namespace Umbraco.Web.Media.Exif /// Returns an unsigned rational number converted from the first /// eight bytes of the given byte array. The first four bytes are /// assumed to be the numerator and the next four bytes are the - /// denumerator. + /// denominator. /// Numbers are converted from the given byte-order to platform byte-order. /// public static MathEx.UFraction32 ToURational(byte[] data, ByteOrder frombyteorder) @@ -115,7 +115,7 @@ namespace Umbraco.Web.Media.Exif /// Returns a signed rational number converted from the first /// eight bytes of the given byte array. The first four bytes are /// assumed to be the numerator and the next four bytes are the - /// denumerator. + /// denominator. /// Numbers are converted from the given byte-order to platform byte-order. /// public static MathEx.Fraction32 ToSRational(byte[] data, ByteOrder frombyteorder) diff --git a/src/Umbraco.Web/Media/Exif/ExifProperty.cs b/src/Umbraco.Web/Media/Exif/ExifProperty.cs index 3a6efcab0b..588d3d9f92 100644 --- a/src/Umbraco.Web/Media/Exif/ExifProperty.cs +++ b/src/Umbraco.Web/Media/Exif/ExifProperty.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.Media.Exif /// public ExifTag Tag { get { return mTag; } } /// - /// Gets the IFD section contaning this property. + /// Gets the IFD section containing this property. /// public IFD IFD { get { return mIFD; } } /// diff --git a/src/Umbraco.Web/Media/Exif/ExifPropertyFactory.cs b/src/Umbraco.Web/Media/Exif/ExifPropertyFactory.cs index 08d1f40afd..68769eb1f3 100644 --- a/src/Umbraco.Web/Media/Exif/ExifPropertyFactory.cs +++ b/src/Umbraco.Web/Media/Exif/ExifPropertyFactory.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.Media.Exif /// Byte or component count. /// Field data as an array of bytes. /// Byte order of value. - /// IFD section containing this propery. + /// IFD section containing this property. /// The encoding to be used for text metadata when the source encoding is unknown. /// an ExifProperty initialized from the interoperability parameters. public static ExifProperty Get(ushort tag, ushort type, uint count, byte[] value, BitConverterEx.ByteOrder byteOrder, IFD ifd, Encoding encoding) diff --git a/src/Umbraco.Web/Media/Exif/ExifTag.cs b/src/Umbraco.Web/Media/Exif/ExifTag.cs index a65d75d7c7..5c85b9558d 100644 --- a/src/Umbraco.Web/Media/Exif/ExifTag.cs +++ b/src/Umbraco.Web/Media/Exif/ExifTag.cs @@ -95,7 +95,7 @@ namespace Umbraco.Web.Media.Exif // Rating Rating = IFD.Zeroth + 0x4746, RatingPercent = IFD.Zeroth + 0x4749, - // Microsoft specifing padding and offset tags + // Microsoft specifying padding and offset tags ZerothIFDPadding = IFD.Zeroth + 0xea1c, // **************************** // EXIF Tags @@ -157,7 +157,7 @@ namespace Umbraco.Web.Media.Exif SubjectDistanceRange = IFD.EXIF + 41996, ImageUniqueID = IFD.EXIF + 42016, InteroperabilityIFDPointer = IFD.EXIF + 40965, - // Microsoft specifing padding and offset tags + // Microsoft specifying padding and offset tags ExifIFDPadding = IFD.EXIF + 0xea1c, OffsetSchema = IFD.EXIF + 0xea1d, // **************************** diff --git a/src/Umbraco.Web/Media/Exif/JPEGFile.cs b/src/Umbraco.Web/Media/Exif/JPEGFile.cs index d7a5d322dc..35c3788abd 100644 --- a/src/Umbraco.Web/Media/Exif/JPEGFile.cs +++ b/src/Umbraco.Web/Media/Exif/JPEGFile.cs @@ -338,7 +338,7 @@ namespace Umbraco.Web.Media.Exif // Create a memory stream to write the APP0 section to MemoryStream ms = new MemoryStream(); - // JFIF identifer + // JFIF identifier ms.Write(Encoding.ASCII.GetBytes("JFIF\0"), 0, 5); // Write tags @@ -431,7 +431,7 @@ namespace Umbraco.Web.Media.Exif // Create a memory stream to write the APP0 section to MemoryStream ms = new MemoryStream(); - // JFIF identifer + // JFIF identifier ms.Write(Encoding.ASCII.GetBytes("JFXX\0"), 0, 5); // Write tags @@ -704,13 +704,13 @@ namespace Umbraco.Web.Media.Exif return false; } - // We will need these bitconverter to write byte-ordered data + // We will need these BitConverters to write byte-ordered data BitConverterEx bceExif = new BitConverterEx(BitConverterEx.SystemByteOrder, ByteOrder); // Create a memory stream to write the APP1 section to MemoryStream ms = new MemoryStream(); - // Exif identifer + // Exif identifier ms.Write(Encoding.ASCII.GetBytes("Exif\0\0"), 0, 6); // TIFF header @@ -812,7 +812,7 @@ namespace Umbraco.Web.Media.Exif currentdataoffset + interop.Data.Length > makerNoteOffset && ifd.ContainsKey(ExifTag.MakerNote)) { - // Delay writing this field until we write makernote data + // Delay writing this field until we write the creator's note data fieldqueue.Enqueue(field); continue; } @@ -847,7 +847,7 @@ namespace Umbraco.Web.Media.Exif } // Fields containing offsets to other IFDs - // Just store their offets, we will write the values later on when we know the lengths of IFDs + // Just store their offsets, we will write the values later on when we know the lengths of IFDs if (ifdtype == IFD.Zeroth && interop.TagID == 0x8769) exifIFDFieldOffset = stream.Position; else if (ifdtype == IFD.Zeroth && interop.TagID == 0x8825) diff --git a/src/Umbraco.Web/Media/Exif/MathEx.cs b/src/Umbraco.Web/Media/Exif/MathEx.cs index 508c5025f7..735358c40a 100644 --- a/src/Umbraco.Web/Media/Exif/MathEx.cs +++ b/src/Umbraco.Web/Media/Exif/MathEx.cs @@ -251,7 +251,7 @@ namespace Umbraco.Web.Media.Exif { return new Fraction32(f1.Numerator * f2.Numerator, f1.Denominator * f2.Denominator); } - // Divison + // Division public static Fraction32 operator /(Fraction32 f, int n) { return new Fraction32(f.Numerator / n, f.Denominator / System.Math.Abs(n)); @@ -893,7 +893,7 @@ namespace Umbraco.Web.Media.Exif { return new UFraction32(f1.Numerator * f2.Numerator, f1.Denominator * f2.Denominator); } - // Divison + // Division public static UFraction32 operator /(UFraction32 f, uint n) { return new UFraction32(f.Numerator / n, f.Denominator / n); diff --git a/src/Umbraco.Web/ModelStateExtensions.cs b/src/Umbraco.Web/ModelStateExtensions.cs index 48eb06c88a..a01958be01 100644 --- a/src/Umbraco.Web/ModelStateExtensions.cs +++ b/src/Umbraco.Web/ModelStateExtensions.cs @@ -87,7 +87,7 @@ namespace Umbraco.Web // if there are assigned member names, we combine the member name with the owner name // so that we can try to match it up to a real field. otherwise, we assume that the // validation message is for the overall owner. - // Owner = the component being validated, like a content property but could be just an html field on another editor + // Owner = the component being validated, like a content property but could be just an HTML field on another editor var withNames = false; var delimitedParts = string.Join(".", parts); diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentSortOrder.cs b/src/Umbraco.Web/Models/ContentEditing/ContentSortOrder.cs index 51352a5412..86b30652bb 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentSortOrder.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentSortOrder.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.Models.ContentEditing /// An array of integer Ids representing the sort order /// /// - /// Of course all of these Ids should be at the same level in the heirarchy!! + /// Of course all of these Ids should be at the same level in the hierarchy!! /// [DataMember(Name = "idSortOrder", IsRequired = true)] [Required] diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs index 5b986a0679..aff79d7b9d 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentVariationDisplay.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.Models.ContentEditing /// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes. /// /// - /// The notifications assigned to a variant are currently only used to show custom messagse in the save/publish dialogs. + /// The notifications assigned to a variant are currently only used to show custom messages in the save/publish dialogs. /// [DataMember(Name = "notifications")] [ReadOnly(true)] diff --git a/src/Umbraco.Web/Models/ContentEditing/DictionaryTranslationSave.cs b/src/Umbraco.Web/Models/ContentEditing/DictionaryTranslationSave.cs index a0ab02768c..72a28f633f 100644 --- a/src/Umbraco.Web/Models/ContentEditing/DictionaryTranslationSave.cs +++ b/src/Umbraco.Web/Models/ContentEditing/DictionaryTranslationSave.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Models.ContentEditing public class DictionaryTranslationSave { /// - /// Gets or sets the iso code. + /// Gets or sets the ISO code. /// [DataMember(Name = "isoCode")] public string IsoCode { get; set; } diff --git a/src/Umbraco.Web/Models/ContentEditing/EntityBasic.cs b/src/Umbraco.Web/Models/ContentEditing/EntityBasic.cs index 0c633d0319..6cb2ccffaf 100644 --- a/src/Umbraco.Web/Models/ContentEditing/EntityBasic.cs +++ b/src/Umbraco.Web/Models/ContentEditing/EntityBasic.cs @@ -54,7 +54,7 @@ namespace Umbraco.Web.Models.ContentEditing /// This will only be populated for some entities like macros /// /// - /// This is overrideable to specify different validation attributes if required + /// It is possible to override this to specify different validation attributes if required /// [DataMember(Name = "alias")] public virtual string Alias { get; set; } diff --git a/src/Umbraco.Web/Models/ContentEditing/RelationTypeDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/RelationTypeDisplay.cs index c443175260..55e140d6f3 100644 --- a/src/Umbraco.Web/Models/ContentEditing/RelationTypeDisplay.cs +++ b/src/Umbraco.Web/Models/ContentEditing/RelationTypeDisplay.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.Models.ContentEditing public string ParentObjectTypeName { get; set; } /// - /// Gets or sets the Childs object type id + /// Gets or sets the Child's object type id /// /// Corresponds to the NodeObjectType in the umbracoNode table [DataMember(Name = "childObjectType", IsRequired = true)] diff --git a/src/Umbraco.Web/Models/ContentEditing/SimpleNotificationModel.cs b/src/Umbraco.Web/Models/ContentEditing/SimpleNotificationModel.cs index 5394636bbf..af35412a49 100644 --- a/src/Umbraco.Web/Models/ContentEditing/SimpleNotificationModel.cs +++ b/src/Umbraco.Web/Models/ContentEditing/SimpleNotificationModel.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Models.ContentEditing public List Notifications { get; private set; } /// - /// A default msg + /// A default message /// [DataMember(Name = "message")] public string Message { get; set; } diff --git a/src/Umbraco.Web/Models/ContentEditing/TabbedContentItem.cs b/src/Umbraco.Web/Models/ContentEditing/TabbedContentItem.cs index 604e726e6f..4c958656ef 100644 --- a/src/Umbraco.Web/Models/ContentEditing/TabbedContentItem.cs +++ b/src/Umbraco.Web/Models/ContentEditing/TabbedContentItem.cs @@ -22,13 +22,13 @@ namespace Umbraco.Web.Models.ContentEditing // note // once a [DataContract] has been defined on a class, with a [DataMember] property, - // one simply cannot ignore that property anymore - [IgnoreDataMember] on an overriden + // one simply cannot ignore that property anymore - [IgnoreDataMember] on an overridden // property is ignored, and 'newing' the property means that it's the base property // which is used // // OTOH, Json.NET is happy having [JsonIgnore] on overrides, even though the base // property is [JsonProperty]. so, forcing [JsonIgnore] here, but really, we should - // rething the whole thing. + // rethink the whole thing. /// /// Override the properties property to ensure we don't serialize this diff --git a/src/Umbraco.Web/Models/ContentEditing/TreeSearchResult.cs b/src/Umbraco.Web/Models/ContentEditing/TreeSearchResult.cs index 22c177190d..ce4c053099 100644 --- a/src/Umbraco.Web/Models/ContentEditing/TreeSearchResult.cs +++ b/src/Umbraco.Web/Models/ContentEditing/TreeSearchResult.cs @@ -24,7 +24,7 @@ namespace Umbraco.Web.Models.ContentEditing /// /// This is optional but if specified should be the name of a method on the jsSvc angular service to use, if not - /// specfied than it will expect the method to be called `format(searchResult, appAlias, treeAlias)` + /// specified than it will expect the method to be called `format(searchResult, appAlias, treeAlias)` /// [DataMember(Name = "jsMethod")] public string JsFormatterMethod { get; set; } diff --git a/src/Umbraco.Web/Models/ImageCropMode.cs b/src/Umbraco.Web/Models/ImageCropMode.cs index 03fe6676cb..1e168d03e0 100644 --- a/src/Umbraco.Web/Models/ImageCropMode.cs +++ b/src/Umbraco.Web/Models/ImageCropMode.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Models Crop, /// - /// Resizes the image to the given dimensions. If the set dimensions do not match the aspect ratio of the original image then the output is resized to the maximum possible value in each direction while aintaining the original aspect ratio. + /// Resizes the image to the given dimensions. If the set dimensions do not match the aspect ratio of the original image then the output is resized to the maximum possible value in each direction while maintaining the original aspect ratio. /// Max, diff --git a/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs index 7db491ad2e..01e57bd872 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentItemDisplayVariationResolver.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.Models.Mapping var langs = context.Mapper.Map, IEnumerable>(allLanguages, null, context).ToList(); - //create a variant for each lang, then we'll populate the values + //create a variant for each language, then we'll populate the values var variants = langs.Select(x => { //We need to set the culture in the mapping context since this is needed to ensure that the correct property values @@ -55,13 +55,13 @@ namespace Umbraco.Web.Models.Mapping //Put the default language first in the list & then sort rest by a-z var defaultLang = variants.SingleOrDefault(x => x.Language.IsDefault); - //Remove the default lang from the list for now + //Remove the default language from the list for now variants.Remove(defaultLang); //Sort the remaining languages a-z variants = variants.OrderBy(x => x.Name).ToList(); - //Insert the default lang as the first item + //Insert the default language as the first item variants.Insert(0, defaultLang); return variants; diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs index ba8076b457..257a53cf1a 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs @@ -195,7 +195,7 @@ namespace Umbraco.Web.Models.Mapping { // handle property groups and property types // note that ContentTypeSave has - // - all groups, inherited and local; only *one* occurence per group *name* + // - all groups, inherited and local; only *one* occurrence per group *name* // - potentially including the generic properties group // - all properties, inherited and local // @@ -296,7 +296,7 @@ namespace Umbraco.Web.Models.Mapping PropertyType destProperty; if (sourceProperty.Id > 0) { - // updateg an existing property + // updating an existing property // ensure it is still there, then map/update destProperty = destOrigProperties.FirstOrDefault(x => x.Id == sourceProperty.Id); if (destProperty != null) @@ -310,7 +310,7 @@ namespace Umbraco.Web.Models.Mapping } // insert a new property, or update an existing property that has - // been deletedin the meantime and we need to re-create + // been deleted in the meantime and we need to re-create // map/create destProperty = Mapper.Map(sourceProperty); return destProperty; diff --git a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs index b3af04603c..01fcfa6f13 100644 --- a/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/DictionaryMapperProfile.cs @@ -47,7 +47,7 @@ namespace Umbraco.Web.Models.Mapping (src, dest) => { // build up the path to make it possible to set active item in tree - // TODO check if there is a better way + // TODO: check if there is a better way if (src.ParentId.HasValue) { var ids = new List { -1 }; @@ -112,7 +112,7 @@ namespace Umbraco.Web.Models.Mapping } /// - /// Goes up the dictoinary tree to get all parent ids + /// Goes up the dictionary tree to get all parent ids /// /// /// The parent id. diff --git a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs index ea29b671a6..13c6af2fda 100644 --- a/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/LanguageMapperProfile.cs @@ -45,13 +45,13 @@ namespace Umbraco.Web.Models.Mapping //Put the default language first in the list & then sort rest by a-z var defaultLang = langs.SingleOrDefault(x => x.IsDefault); - //Remove the default lang from the list for now + //Remove the default language from the list for now langs.Remove(defaultLang); //Sort the remaining languages a-z langs = langs.OrderBy(x => x.Name).ToList(); - //Insert the default lang as the first item + //Insert the default language as the first item langs.Insert(0, defaultLang); return langs; diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs index a50a4f190e..1be74ce583 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.Models.Mapping .AfterMap((property, parameter) => { //map the view and the config - // we need to show the depracated ones for backwards compatibility + // we need to show the deprecated ones for backwards compatibility var paramEditor = Current.ParameterEditors[property.EditorAlias]; // todo - include/filter deprecated?! if (paramEditor == null) { diff --git a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs index e32531e61a..c8391abdb4 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs @@ -14,7 +14,7 @@ using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.Models.Mapping { /// - /// A custom tab/property resolver for members which will ensure that the built-in membership properties are or arent' displayed + /// A custom tab/property resolver for members which will ensure that the built-in membership properties are or aren't displayed /// depending on if the member type has these properties /// /// @@ -38,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping } /// - /// Overriden to deal with custom member properties and permissions. + /// Overridden to deal with custom member properties and permissions. public override IEnumerable> Resolve(IMember source, MemberDisplay destination, IEnumerable> destMember, ResolutionContext context) { var provider = Core.Security.MembershipProviderExtensions.GetMembersMembershipProvider(); @@ -52,7 +52,7 @@ namespace Umbraco.Web.Models.Mapping if (provider.IsUmbracoMembershipProvider() == false) { - //it's a generic provider so update the locked out property based on our known constant alias + // it's a generic provider so update the locked out property based on our known constant alias var isLockedOutProperty = resolved.SelectMany(x => x.Properties).FirstOrDefault(x => x.Alias == Constants.Conventions.Member.IsLockedOut); if (isLockedOutProperty?.Value != null && isLockedOutProperty.Value.ToString() != "1") { @@ -64,8 +64,8 @@ namespace Umbraco.Web.Models.Mapping { var umbracoProvider = (IUmbracoMemberTypeMembershipProvider)provider; - //This is kind of a hack because a developer is supposed to be allowed to set their property editor - would have been much easier - // if we just had all of the membeship provider fields on the member table :( + // This is kind of a hack because a developer is supposed to be allowed to set their property editor - would have been much easier + // if we just had all of the membership provider fields on the member table :( // TODO: But is there a way to map the IMember.IsLockedOut to the property ? i dunno. var isLockedOutProperty = resolved.SelectMany(x => x.Properties).FirstOrDefault(x => x.Alias == umbracoProvider.LockPropertyTypeAlias); if (isLockedOutProperty?.Value != null && isLockedOutProperty.Value.ToString() != "1") @@ -82,7 +82,7 @@ namespace Umbraco.Web.Models.Mapping { var memberTypeLink = string.Format("#/member/memberTypes/edit/{0}", source.ContentTypeId); - //Replace the doctype property + // Replace the doctype property var docTypeProperty = resolved.SelectMany(x => x.Properties) .First(x => x.Alias == string.Format("{0}doctype", Constants.PropertyEditors.InternalGenericPropertiesPrefix)); docTypeProperty.Value = new List @@ -135,7 +135,7 @@ namespace Umbraco.Web.Models.Mapping { Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}password", Label = _localizedTextService.Localize("password"), - //NOTE: The value here is a json value - but the only property we care about is the generatedPassword one if it exists, the newPassword exists + // NOTE: The value here is a json value - but the only property we care about is the generatedPassword one if it exists, the newPassword exists // only when creating a new member and we want to have a generated password pre-filled. Value = new Dictionary { @@ -143,12 +143,12 @@ namespace Umbraco.Web.Models.Mapping {"generatedPassword", member.GetAdditionalDataValueIgnoreCase("GeneratedPassword", null)}, {"newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null)}, }, - //TODO: Hard coding this because the changepassword doesn't necessarily need to be a resolvable (real) property editor + // TODO: Hard coding this because the changepassword doesn't necessarily need to be a resolvable (real) property editor View = "changepassword", - //initialize the dictionary with the configuration from the default membership provider + // initialize the dictionary with the configuration from the default membership provider Config = new Dictionary(membersProvider.GetConfiguration(_userService)) { - //the password change toggle will only be displayed if there is already a password assigned. + // the password change toggle will only be displayed if there is already a password assigned. {"hasPassword", member.RawPasswordValue.IsNullOrWhiteSpace() == false} } }, @@ -180,21 +180,21 @@ namespace Umbraco.Web.Models.Mapping var umbracoContext = _umbracoContextAccessor.UmbracoContext; - //now update the IsSensitive value + // now update the IsSensitive value foreach (var prop in result) { - //check if this property is flagged as sensitive + // check if this property is flagged as sensitive var isSensitiveProperty = memberType.IsSensitiveProperty(prop.Alias); - //check permissions for viewing sensitive data + // check permissions for viewing sensitive data if (isSensitiveProperty && (umbracoContext == null || umbracoContext.Security.CurrentUser.HasAccessToSensitiveData() == false)) { - //mark this property as sensitive + // mark this property as sensitive prop.IsSensitive = true; - //mark this property as readonly so that it does not post any data + // mark this property as readonly so that it does not post any data prop.Readonly = true; - //replace this editor with a sensitivevalue + // replace this editor with a sensitive value prop.View = "sensitivevalue"; - //clear the value + // clear the value prop.Value = null; } } @@ -211,7 +211,7 @@ namespace Umbraco.Web.Models.Mapping /// /// /// If the membership provider installed is the umbraco membership provider, then we will allow changing the username, however if - /// the membership provider is a custom one, we cannot allow chaning the username because MembershipProvider's do not actually natively + /// the membership provider is a custom one, we cannot allow changing the username because MembershipProvider's do not actually natively /// allow that. /// internal static ContentPropertyDisplay GetLoginProperty(IMemberService memberService, IMember member, ILocalizedTextService localizedText) @@ -225,7 +225,7 @@ namespace Umbraco.Web.Models.Mapping var scenario = memberService.GetMembershipScenario(); - //only allow editing if this is a new member, or if the membership provider is the umbraco one + // only allow editing if this is a new member, or if the membership provider is the Umbraco one if (member.HasIdentity == false || scenario == MembershipScenario.NativeUmbraco) { prop.View = "textbox"; diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index ab33c3886b..2f2af047f7 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -98,10 +98,10 @@ namespace Umbraco.Web.Models.Mapping //re-assign genericProps.Properties = contentProps; - //Show or hide properties tab based on wether it has or not any properties + //Show or hide properties tab based on whether it has or not any properties if (genericProps.Properties.Any() == false) { - //loop throug the tabs, remove the one with the id of zero and exit the loop + //loop through the tabs, remove the one with the id of zero and exit the loop for (var i = 0; i < tabs.Count; i++) { if (tabs[i].Id != 0) continue; diff --git a/src/Umbraco.Web/Models/PackageInstallModel.cs b/src/Umbraco.Web/Models/PackageInstallModel.cs index c4dbbfde2a..b489604261 100644 --- a/src/Umbraco.Web/Models/PackageInstallModel.cs +++ b/src/Umbraco.Web/Models/PackageInstallModel.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.Models public string ZipFileName { get; set; } /// - /// During installation this can be used to track any pending appdomain restarts + /// During installation this can be used to track any pending AppDomain restarts /// [DataMember(Name = "isRestarting")] public bool IsRestarting { get; set; } diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs index 12acb6b0c8..c7e38ab7f0 100644 --- a/src/Umbraco.Web/Models/PublishedContentBase.cs +++ b/src/Umbraco.Web/Models/PublishedContentBase.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.Models /// /// Provide an abstract base class for IPublishedContent implementations. /// - /// This base class does which (a) consitently resolves and caches the Url, (b) provides an implementation + /// This base class does which (a) consistently resolves and caches the Url, (b) provides an implementation /// for this[alias], and (c) provides basic content set management. [DebuggerDisplay("Content Id: {Id}, Name: {Name}")] public abstract class PublishedContentBase : IPublishedContent diff --git a/src/Umbraco.Web/Models/RegisterModel.cs b/src/Umbraco.Web/Models/RegisterModel.cs index 44845bfd43..86a5459a74 100644 --- a/src/Umbraco.Web/Models/RegisterModel.cs +++ b/src/Umbraco.Web/Models/RegisterModel.cs @@ -77,7 +77,7 @@ namespace Umbraco.Web.Models public bool UsernameIsEmail { get; set; } /// - /// Specifies if the member should be logged in if they are succesfully created + /// Specifies if the member should be logged in if they are successfully created /// public bool LoginOnSuccess { get; set; } diff --git a/src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs b/src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs index 819d74f8e7..e25c317716 100644 --- a/src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs +++ b/src/Umbraco.Web/Models/Trees/TreeNodeExtensions.cs @@ -63,7 +63,7 @@ } /// - /// Sets the node style to show that it is is not published + /// Sets the node style to show that it is not published /// /// public static void SetNotPublishedStyle(this TreeNode treeNode) diff --git a/src/Umbraco.Web/Mvc/ControllerExtensions.cs b/src/Umbraco.Web/Mvc/ControllerExtensions.cs index 1906e6ba81..d7a693be2d 100644 --- a/src/Umbraco.Web/Mvc/ControllerExtensions.cs +++ b/src/Umbraco.Web/Mvc/ControllerExtensions.cs @@ -165,7 +165,7 @@ namespace Umbraco.Web.Mvc /// Normally in MVC the way that the View object gets assigned to the result is to Execute the ViewResult, this however /// will write to the Response output stream which isn't what we want. Instead, this method will use the same logic inside /// of MVC to assign the View object to the result but without executing it. - /// This is only relavent for view results of PartialViewResult or ViewResult. + /// This is only relevant for view results of PartialViewResult or ViewResult. /// /// /// diff --git a/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs b/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs index 380ec4cd4e..567e9ca145 100644 --- a/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs +++ b/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Mvc { base.OnResultExecuting(filterContext); - // could happens if exception (but afaik this wouldn't happen in MVC) + // could happens if exception (but AFAIK this wouldn't happen in MVC) if (filterContext.HttpContext == null || filterContext.HttpContext.Response == null || filterContext.HttpContext.Response.Cache == null) { diff --git a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs index a28afe1713..62a7c48d2b 100644 --- a/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs +++ b/src/Umbraco.Web/Mvc/EnsurePublishedContentRequestAttribute.cs @@ -73,7 +73,7 @@ namespace Umbraco.Web.Mvc /// protected UmbracoContext UmbracoContext => _umbracoContext ?? (_umbracoContext = UmbracoContext.Current); - // todo - try lazy property injection? + // TODO: try lazy property injection? private PublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance(); /// @@ -86,7 +86,7 @@ namespace Umbraco.Web.Mvc { base.OnActionExecuted(filterContext); - //First we need to check if the pcr has been set, if it has we're going to ignore this and not actually do anything + // First we need to check if the published content request has been set, if it has we're going to ignore this and not actually do anything if (UmbracoContext.Current.PublishedRequest != null) { return; diff --git a/src/Umbraco.Web/Mvc/MasterControllerFactory.cs b/src/Umbraco.Web/Mvc/MasterControllerFactory.cs index 6bc799baa5..6d2f1ce501 100644 --- a/src/Umbraco.Web/Mvc/MasterControllerFactory.cs +++ b/src/Umbraco.Web/Mvc/MasterControllerFactory.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Mvc // ControllerBuilder.Current when setting up Mvc and WebApi, it cannot be ctored by // the IoC container - and yet we don't want that ctor to resolve the factories // as that happen before everything is configured - so, passing a factories - // accessor func. + // accessor function. _factoriesAccessor = factoriesAccessor; } diff --git a/src/Umbraco.Web/Mvc/PluginController.cs b/src/Umbraco.Web/Mvc/PluginController.cs index 03d6e2905c..e3f4b45ce6 100644 --- a/src/Umbraco.Web/Mvc/PluginController.cs +++ b/src/Umbraco.Web/Mvc/PluginController.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Mvc // note // properties marked as [Inject] below will be property-injected (vs constructor-injected) in - // order to keep the constuctor as light as possible, so that ppl implementing eg a SurfaceController + // order to keep the constructor as light as possible, so that ppl implementing eg a SurfaceController // don't need to implement complex constructors + need to refactor them each time we change ours. // this means that these properties have a setter. // what can go wrong? diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index c9123175b1..10efb54552 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -49,7 +49,7 @@ namespace Umbraco.Web.Mvc #region IRouteHandler Members /// - /// Assigns the correct controller based on the Umbraco request and returns a standard MvcHandler to prcess the response, + /// Assigns the correct controller based on the Umbraco request and returns a standard MvcHandler to process the response, /// this also stores the render model into the data tokens for the current RouteData. /// /// @@ -428,7 +428,7 @@ namespace Umbraco.Web.Mvc // Set the session state requirements requestContext.HttpContext.SetSessionStateBehavior(GetSessionStateBehavior(requestContext, routeDef.ControllerName)); - // reset the friendly path so in the controllers and anything occuring after this point in time, + // reset the friendly path so in the controllers and anything occurring after this point in time, //the URL is reset back to the original request. requestContext.HttpContext.RewritePath(UmbracoContext.OriginalRequestUrl.PathAndQuery); diff --git a/src/Umbraco.Web/Mvc/Strings.Designer.cs b/src/Umbraco.Web/Mvc/Strings.Designer.cs index a897e5349c..40269241a5 100644 --- a/src/Umbraco.Web/Mvc/Strings.Designer.cs +++ b/src/Umbraco.Web/Mvc/Strings.Designer.cs @@ -62,12 +62,12 @@ namespace Umbraco.Web.Mvc { /// /// Looks up a localized string similar to <?xml version="1.0"?> - ///<configuration> /// - /// <configSections> - /// <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> - /// <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> - /// <section name="page [rest of string was truncated]";. + ///<configuration> + /// <configSections> + /// <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> + /// <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> + /// < [rest of string was truncated]";. /// internal static string WebConfigTemplate { get { diff --git a/src/Umbraco.Web/Mvc/Strings.resx b/src/Umbraco.Web/Mvc/Strings.resx index fd82fa3865..1d4028f594 100644 --- a/src/Umbraco.Web/Mvc/Strings.resx +++ b/src/Umbraco.Web/Mvc/Strings.resx @@ -37,7 +37,7 @@ mimetype set. The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not + ResXResourceReader how to stop persisting the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format @@ -121,4 +121,4 @@ ..\..\umbraco.web.ui\views\web.config;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - \ No newline at end of file + diff --git a/src/Umbraco.Web/Mvc/UmbracoAuthorizeAttribute.cs b/src/Umbraco.Web/Mvc/UmbracoAuthorizeAttribute.cs index 8b76a2069d..fa0b1c5458 100644 --- a/src/Umbraco.Web/Mvc/UmbracoAuthorizeAttribute.cs +++ b/src/Umbraco.Web/Mvc/UmbracoAuthorizeAttribute.cs @@ -85,7 +85,7 @@ namespace Umbraco.Web.Mvc } /// - /// Override to to ensure no redirect occurs + /// Override to ensure no redirect occurs /// /// protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) diff --git a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs index 9769945f37..36ec76b3d9 100644 --- a/src/Umbraco.Web/Mvc/UmbracoPageResult.cs +++ b/src/Umbraco.Web/Mvc/UmbracoPageResult.cs @@ -94,7 +94,7 @@ namespace Umbraco.Web.Mvc /// /// When POSTing to MVC but rendering in WebForms we need to do some trickery, we'll create a dummy viewcontext with all of the - /// current modelstate, tempdata, viewdata so that if we're rendering partial view macros within the webforms view, they will + /// current model state, tempdata, viewdata so that if we're rendering partial view macros within the webforms view, they will /// get all of this merged into them. /// /// diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs index 164fb7acf7..0c95e1d446 100644 --- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.Mvc { public abstract class UmbracoVirtualNodeRouteHandler : IRouteHandler { - // todo - try lazy property injection? + // TODO: - try lazy property injection? private PublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance(); /// @@ -54,20 +54,21 @@ namespace Umbraco.Web.Mvc request.PublishedContent = found; umbracoContext.PublishedRequest = request; - //allows inheritors to change the pcr + // allows inheritors to change the published content request PreparePublishedContentRequest(umbracoContext.PublishedRequest); - //create the render model + // create the render model var renderModel = new ContentModel(umbracoContext.PublishedRequest.PublishedContent); - //assigns the required tokens to the request + // assigns the required tokens to the request requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoDataToken, renderModel); requestContext.RouteData.DataTokens.Add(Core.Constants.Web.PublishedDocumentRequestDataToken, umbracoContext.PublishedRequest); requestContext.RouteData.DataTokens.Add(Core.Constants.Web.UmbracoContextDataToken, umbracoContext); - //this is used just for a flag that this is an umbraco custom route + + // this is used just for a flag that this is an umbraco custom route requestContext.RouteData.DataTokens.Add(Core.Constants.Web.CustomRouteDataToken, true); - //Here we need to detect if a SurfaceController has posted + // Here we need to detect if a SurfaceController has posted var formInfo = RenderRouteHandler.GetFormInfo(requestContext); if (formInfo != null) { @@ -78,7 +79,7 @@ namespace Umbraco.Web.Mvc PublishedRequest = umbracoContext.PublishedRequest }; - //set the special data token to the current route definition + // set the special data token to the current route definition requestContext.RouteData.DataTokens[Core.Constants.Web.UmbracoRouteDefinitionDataToken] = def; return RenderRouteHandler.HandlePostedValues(requestContext, formInfo); diff --git a/src/Umbraco.Web/Mvc/ViewDataContainerExtensions.cs b/src/Umbraco.Web/Mvc/ViewDataContainerExtensions.cs index c1b6fee8eb..2852e80619 100644 --- a/src/Umbraco.Web/Mvc/ViewDataContainerExtensions.cs +++ b/src/Umbraco.Web/Mvc/ViewDataContainerExtensions.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Mvc { var newContainer = new ViewDataContainer(); newContainer.ViewData.ModelState.Merge(container.ViewData.ModelState, prefix); - //change the html field name too + //change the HTML field name too newContainer.ViewData.TemplateInfo.HtmlFieldPrefix = prefix; return newContainer; } diff --git a/src/Umbraco.Web/OwinExtensions.cs b/src/Umbraco.Web/OwinExtensions.cs index e7e1e85b50..6961f5c915 100644 --- a/src/Umbraco.Web/OwinExtensions.cs +++ b/src/Umbraco.Web/OwinExtensions.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web } /// - /// Nasty little hack to get httpcontextbase from an owin context + /// Nasty little hack to get HttpContextBase from an owin context /// /// /// diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index 2b32e9d774..6d87bfe495 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.PropertyEditors /// Gets a value indicating whether a property is an upload field. /// /// The property. - /// A value indicating whether a property is an upload field, and (optionaly) has a non-empty value. + /// A value indicating whether a property is an upload field, and (optionally) has a non-empty value. private static bool IsUploadField(Property property) { return property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.Aliases.UploadField; @@ -61,7 +61,7 @@ namespace Umbraco.Web.PropertyEditors } /// - /// Look through all propery values stored against the property and resolve any file paths stored + /// Look through all property values stored against the property and resolve any file paths stored /// /// /// diff --git a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs index c238f93467..8c2f7ac488 100644 --- a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs @@ -4,7 +4,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { /// - /// Represents the configuration for the gid value editor. + /// Represents the configuration for the grid value editor. /// public class GridConfiguration { diff --git a/src/Umbraco.Web/PropertyEditors/GridConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/GridConfigurationEditor.cs index 4a74925816..fe86bb9a6e 100644 --- a/src/Umbraco.Web/PropertyEditors/GridConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/GridConfigurationEditor.cs @@ -3,8 +3,8 @@ namespace Umbraco.Web.PropertyEditors { /// - /// Represents the configuration for the gid value editor. + /// Represents the configuration for the grid value editor. /// public class GridConfigurationEditor : ConfigurationEditor { } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs index 2ca58b06e2..fff11a28a5 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs @@ -57,7 +57,7 @@ namespace Umbraco.Web.PropertyEditors /// Gets a value indicating whether a property is an image cropper field. /// /// The property. - /// A value indicating whether a property is an image cropper field, and (optionaly) has a non-empty value. + /// A value indicating whether a property is an image cropper field, and (optionally) has a non-empty value. private static bool IsCropperField(Property property) { return property.PropertyType.PropertyEditorAlias == Constants.PropertyEditors.Aliases.ImageCropper; @@ -69,7 +69,7 @@ namespace Umbraco.Web.PropertyEditors /// The property value. /// A value indicating whether to log the error. /// The json object corresponding to the property value. - /// In case of an error, optionaly logs the error and returns null. + /// In case of an error, optionally logs the error and returns null. private JObject GetJObject(string value, bool writeLog) { if (string.IsNullOrWhiteSpace(value)) @@ -100,7 +100,7 @@ namespace Umbraco.Web.PropertyEditors } /// - /// Look through all propery values stored against the property and resolve any file paths stored + /// Look through all property values stored against the property and resolve any file paths stored /// /// /// diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs index 6ee0d23d95..78f2189829 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs @@ -166,7 +166,7 @@ namespace Umbraco.Web.PropertyEditors if (value == null || string.IsNullOrEmpty(value.ToString())) return null; - // if we dont have a json structure, we will get it from the property type + // if we don't have a json structure, we will get it from the property type var val = value.ToString(); if (val.DetectIsJson()) return val; diff --git a/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfigurationEditor.cs index a52ee2138e..75fe581d5b 100644 --- a/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultiNodePickerConfigurationEditor.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.PropertyEditors /// public override Dictionary ToConfigurationEditor(MultiNodePickerConfiguration configuration) { - // sanitize configuraiton + // sanitize configuration var output = base.ToConfigurationEditor(configuration); output["multiPicker"] = configuration.MaxNumber > 1 ? true : false; diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs index 59a96a0e41..a7d05799d9 100644 --- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs @@ -6,7 +6,7 @@ using Umbraco.Core.PropertyEditors.Validators; namespace Umbraco.Web.PropertyEditors { /// - /// Represents the configuration editor for a multiple testring value editor. + /// Represents the configuration editor for a multiple textstring value editor. /// internal class MultipleTextStringConfigurationEditor : ConfigurationEditor { @@ -35,7 +35,7 @@ namespace Umbraco.Web.PropertyEditors public override MultipleTextStringConfiguration FromConfigurationEditor(IDictionary editorValues, MultipleTextStringConfiguration configuration) { // todo this isn't pretty - //the values from the editor will be min/max fieds and we need to format to json in one field + //the values from the editor will be min/max fields and we need to format to json in one field // is the editor sending strings or ints or?! var min = (editorValues.ContainsKey("min") ? editorValues["min"].ToString() : "0").TryConvertTo(); var max = (editorValues.ContainsKey("max") ? editorValues["max"].ToString() : "0").TryConvertTo(); diff --git a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs index 31b65c6357..207e914061 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextPropertyEditor.cs @@ -101,7 +101,7 @@ namespace Umbraco.Web.PropertyEditors if (!(val is string strVal)) yield break; - //index the stripped html values + //index the stripped HTML values yield return new KeyValuePair>(property.Alias, new object[] { strVal.StripHtml() }); //store the raw value yield return new KeyValuePair>($"{UmbracoExamineIndex.RawFieldPrefix}{property.Alias}", new object[] { strVal }); diff --git a/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs b/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs index 9199707d10..4cebc5c829 100644 --- a/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs +++ b/src/Umbraco.Web/PropertyEditors/RteEmbedController.cs @@ -22,7 +22,7 @@ namespace Umbraco.Web.PropertyEditors { var result = new Result(); - //todo cache embed doc + // TODO: cache embed doc var xmlConfig = new XmlDocument(); xmlConfig.Load(IOHelper.GetRootDirectorySafe() + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar + "EmbeddedMedia.config"); diff --git a/src/Umbraco.Web/PropertyEditors/TagConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/TagConfigurationEditor.cs index 1e671ba044..5d396980e3 100644 --- a/src/Umbraco.Web/PropertyEditors/TagConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/TagConfigurationEditor.cs @@ -33,7 +33,7 @@ namespace Umbraco.Web.PropertyEditors public override TagConfiguration FromConfigurationEditor(IDictionary editorValues, TagConfiguration configuration) { - // the front-end editor retuns the string value of the storage type + // the front-end editor returns the string value of the storage type // pure Json could do with // [JsonConverter(typeof(StringEnumConverter))] // but here we're only deserializing to object and it's too late diff --git a/src/Umbraco.Web/PropertyEditors/TagsDataController.cs b/src/Umbraco.Web/PropertyEditors/TagsDataController.cs index bc0c281f98..15c39bf994 100644 --- a/src/Umbraco.Web/PropertyEditors/TagsDataController.cs +++ b/src/Umbraco.Web/PropertyEditors/TagsDataController.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.PropertyEditors /// /// /// DO NOT inherit from UmbracoAuthorizedJsonController since we don't want to use the angularized - /// json formatter as it causes probs. + /// json formatter as it causes problems. /// [PluginController("UmbracoApi")] public class TagsDataController : UmbracoAuthorizedApiController diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/MarkdownEditorValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/MarkdownEditorValueConverter.cs index 0612c85020..c96e9ff9a3 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/MarkdownEditorValueConverter.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/MarkdownEditorValueConverter.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters public override object ConvertIntermediateToObject(IPublishedElement owner, PublishedPropertyType propertyType, PropertyCacheLevel referenceCacheLevel, object inter, bool preview) { - // convert markup to html for frontend rendering. + // convert markup to HTML for frontend rendering. // source should come from ConvertSource and be a string (or null) already var mark = new Markdown(); return new HtmlString(inter == null ? string.Empty : mark.Transform((string)inter)); diff --git a/src/Umbraco.Web/PropertyEditors/ValueListUniqueValueValidator.cs b/src/Umbraco.Web/PropertyEditors/ValueListUniqueValueValidator.cs index 88dd20c516..38dc6fb3ae 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueListUniqueValueValidator.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueListUniqueValueValidator.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.PropertyEditors if (!(value is JArray json)) yield break; // we ensure that values are unique - // (those are are not empty - empty values are removed when persisting anyways) + // (those are not empty - empty values are removed when persisting anyways) var groupedValues = json.OfType() .Where(x => x["value"] != null) @@ -38,4 +38,4 @@ namespace Umbraco.Web.PropertyEditors } } } -} \ No newline at end of file +} diff --git a/src/Umbraco.Web/PublishedCache/IPublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/IPublishedSnapshotService.cs index cf10ed5f3a..ccdac5664d 100644 --- a/src/Umbraco.Web/PublishedCache/IPublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/IPublishedSnapshotService.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.PublishedCache * to find out how to get that navigator. * * Because a cache such as NuCache is contextual i.e. it has a "snapshot" thing and remains - * consistent over the snapshot, the navigator has to come come from the "current" snapshot. + * consistent over the snapshot, the navigator has to come from the "current" snapshot. * * So although everything should be injected... we also need a notion of "the current published * snapshot". This is provided by the IPublishedSnapshotAccessor. @@ -105,7 +105,7 @@ namespace Umbraco.Web.PublishedCache * rely on cache refreshers CacheUpdated events to update itself, as these events are external * and the order-of-execution of the handlers cannot be guaranteed, which means that some * user code may run before Umbraco is finished updating itself. Instead, the cache refreshers - * explicitely notify the service of changes. + * explicitly notify the service of changes. * */ diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs index 44d38c8f3a..d983a880cc 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs @@ -93,7 +93,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // if in a domain then start with the root node of the domain // and follow the path // note: if domain has a path (eg example.com/en) which is not recommended anymore - // then then /en part of the domain is basically ignored here... + // then /en part of the domain is basically ignored here... content = GetById(preview, startNodeId); content = FollowRoute(content, parts, 0, culture); } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs index 01f0bbad9b..ed17420645 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/SerializerBase.cs @@ -60,7 +60,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource case 'D': return PrimitiveSerializer.DateTime.ReadFrom(stream); default: - throw new NotSupportedException($"Cannot deserialize unknow type '{type}'."); + throw new NotSupportedException($"Cannot deserialize unknown type '{type}'."); } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/Navigable/NavigableContentType.cs b/src/Umbraco.Web/PublishedCache/NuCache/Navigable/NavigableContentType.cs index 068a1866ee..18bf3ead13 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/Navigable/NavigableContentType.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/Navigable/NavigableContentType.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.Navigable // note - PublishedContentType are immutable ie they do not _change_ when the actual IContentTypeComposition // changes, but they are replaced by a new instance, so our map here will clean itself automatically and - // we don't have to manage cache - ConditionalWeakTable does not prevent keys from beeing GCed + // we don't have to manage cache - ConditionalWeakTable does not prevent keys from being GCed private static readonly ConditionalWeakTable TypesMap = new ConditionalWeakTable(); diff --git a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs index 0423084285..f4449008f9 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/NuCacheComposer.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.PublishedCache.NuCache composition.SetPublishedSnapshotService(); // add the NuCache health check (hidden from type finder) - // todo - no NuCache health check yet + // TODO: no NuCache health check yet //composition.HealthChecks().Add(); } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index 69c672ab98..3dee81f1bb 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -370,7 +370,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // notes: // _contentNode.ChildContentIds is an unordered int[] - // need needs to fetch & sort - do it only once, lazyily, though + // needs to fetch & sort - do it only once, lazily, though // Q: perfs-wise, is it better than having the store managed an ordered list } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 8675aefd1a..889ce72ce0 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -58,18 +58,18 @@ namespace Umbraco.Web.PublishedCache.NuCache // define constant - determines whether to use cache when previewing // to store eg routes, property converted values, anything - caching // means faster execution, but uses memory - not sure if we want it - // so making it configureable. + // so making it configurable. public static readonly bool FullCacheWhenPreviewing = true; // define constant - determines whether to cache the published content // objects (in the elements cache, or snapshot cache, depending on preview) - // or to refetch them all the time. caching is faster but uses more + // or to re-fetch them all the time. caching is faster but uses more // memory. not sure what we want. public static readonly bool CachePublishedContentChildren = true; // define constant - determines whether to cache the content cache root // objects (in the elements cache, or snapshot cache, depending on preview) - // or to refecth them all the time. caching is faster but uses more + // or to re-fetch them all the time. caching is faster but uses more // memory - not sure what we want. public static readonly bool CacheContentCacheRoots = true; @@ -88,7 +88,7 @@ namespace Umbraco.Web.PublishedCache.NuCache : base(publishedSnapshotAccessor, variationContextAccessor) { //if (Interlocked.Increment(ref _singletonCheck) > 1) - // throw new Exception("Singleton must be instancianted only once!"); + // throw new Exception("Singleton must be instantiated only once!"); _serviceContext = serviceContext; _publishedContentTypeFactory = publishedContentTypeFactory; @@ -140,14 +140,14 @@ namespace Umbraco.Web.PublishedCache.NuCache var localMediaDbPath = IOHelper.MapPath("~/App_Data/NuCache.Media.db"); _localDbExists = System.IO.File.Exists(localContentDbPath) && System.IO.File.Exists(localMediaDbPath); - // if both local dbs exist then GetTree will open them, else new dbs will be created + // if both local databases exist then GetTree will open them, else new databases will be created _localContentDb = BTree.GetTree(localContentDbPath, _localDbExists); _localMediaDb = BTree.GetTree(localMediaDbPath, _localDbExists); } // stores are created with a db so they can write to it, but they do not read from it, // stores need to be populated, happens in OnResolutionFrozen which uses _localDbExists to - // figure out whether it can read the dbs or it should populate them from sql + // figure out whether it can read the databases or it should populate them from sql _contentStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localContentDb); _mediaStore = new ContentStore(publishedSnapshotAccessor, variationContextAccessor, logger, _localMediaDb); } @@ -194,7 +194,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _logger.Fatal(ex, "Panic, exception while loading cache data."); } - // finaly, cache is ready! + // finally, cache is ready! _isReady = true; } } @@ -253,7 +253,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // //// indicates that the snapshot cache should reuse the application request cache //// otherwise a new cache object would be created for the snapshot specifically, - //// which is the default - web boot manager uses this to optimze facades + //// which is the default - web boot manager uses this to optimize facades //public bool PublishedSnapshotCacheIsApplicationRequestCache; public bool IgnoreLocalDb; diff --git a/src/Umbraco.Web/PublishedCache/NuCache/SnapDictionary.cs b/src/Umbraco.Web/PublishedCache/NuCache/SnapDictionary.cs index b0231368af..30f6e7e638 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/SnapDictionary.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/SnapDictionary.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // // so when getting a read-lock, // either we are write-locked or not, but if not, we won't be write-locked - // otoh the write-lock may be released in the meantime + // on the other hand the write-lock may be released in the meantime // Lock has a 'forceGen' parameter: // used to start a set of changes that may not commit, to isolate the set from any pending diff --git a/src/Umbraco.Web/PublishedCache/PublishedElementPropertyBase.cs b/src/Umbraco.Web/PublishedCache/PublishedElementPropertyBase.cs index 6d69b96e0c..62f72a27aa 100644 --- a/src/Umbraco.Web/PublishedCache/PublishedElementPropertyBase.cs +++ b/src/Umbraco.Web/PublishedCache/PublishedElementPropertyBase.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.PublishedCache // define constant - determines whether to use cache when previewing // to store eg routes, property converted values, anything - caching // means faster execution, but uses memory - not sure if we want it - // so making it configureable. + // so making it configurable. private const bool FullCacheWhenPreviewing = true; public PublishedElementPropertyBase(PublishedPropertyType propertyType, IPublishedElement element, bool previewing, PropertyCacheLevel referenceCacheLevel, object sourceValue = null, IPublishedSnapshotAccessor publishedSnapshotAccessor = null) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs index a395db1da5..4e206f73d7 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/DictionaryPublishedContent.cs @@ -124,7 +124,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } /// - /// Flag to get/set if this was laoded from examine cache + /// Flag to get/set if this was loaded from examine cache /// internal bool LoadedFromExamine { get; } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index dadf40a33b..5521cabe76 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -119,7 +119,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { if (ex is FileNotFoundException) { - //Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco + //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia //TODO: Need to fix examine in LB scenarios! @@ -245,7 +245,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } catch (FileNotFoundException) { - //Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco + //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia //TODO: Need to fix examine in LB scenarios! @@ -302,7 +302,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { if (ex is FileNotFoundException) { - //Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco + //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia //TODO: Need to fix examine in LB scenarios! @@ -485,7 +485,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } /// - /// A Helper methods to return the children for media whther it is based on examine or xml + /// A Helper methods to return the children for media whether it is based on examine or xml /// /// /// @@ -532,14 +532,14 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } //if there's no result then return null. Previously we defaulted back to library.GetMedia below - //but this will always get called for when we are getting descendents since many items won't have + //but this will always get called for when we are getting descendants since many items won't have //children and then we are hitting the database again! //So instead we're going to rely on Examine to have the correct results like it should. return Enumerable.Empty(); } catch (FileNotFoundException) { - //Currently examine is throwing FileNotFound exceptions when we have a loadbalanced filestore and a node is published in umbraco + //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs index 0d7d188dac..0153cca18b 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache /// Represents the Xml storage for the Xml published cache. /// /// - /// One instance of is instanciated by the and + /// One instance of is instantiated by the and /// then passed to all instances that are created (one per request). /// This class should *not* be public. /// @@ -751,7 +751,7 @@ AND (umbracoNode.id=@id)"; { // using that one method because we want to have proper indent // and in addition, writing async is never fully async because - // althouth the writer is async, xml.WriteTo() will not async + // although the writer is async, xml.WriteTo() will not async // that one almost works but... "The elements are indented as long as the element // does not contain mixed content. Once the WriteString or WriteWhitespace method @@ -918,7 +918,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; // assumes xml lock private void LoadXmlTreeFromDatabaseLocked(SafeXmlReaderWriter safeXml) { - // initialise the document ready for the composition of content + // initialize the document ready for the composition of content var xml = new XmlDocument(); InitializeXml(xml, GetDtd()); @@ -973,7 +973,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; var xmlDtos = scope.Database.Query(ReadMoreCmsContentXmlSql, new { /*@nodeObjectType =*/ nodeObjectType }); - // Initialise the document ready for the final composition of content + // Initialize the document ready for the final composition of content InitializeXml(xmlDoc, string.Empty); XmlNode parent = null; @@ -1102,7 +1102,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; id = content.Id }); - // 'using' the enumerator ensures that the enumeration is properly terminated even if abandonned + // 'using' the enumerator ensures that the enumeration is properly terminated even if abandoned // otherwise, it would leak an open reader & an un-released database connection // see PetaPoco.Query(Type[] types, Delegate cb, string sql, params object[] args) // and read http://blogs.msdn.com/b/oldnewthing/archive/2008/08/14/8862242.aspx @@ -1348,7 +1348,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; if (docNode.Name == currentNode.Name) { // name has not changed, safe to just update the current node - // by transfering values eg copying the attributes, and importing the data elements + // by transferring values eg copying the attributes, and importing the data elements TransferValuesFromDocumentXmlToPublishedXml(docNode, currentNode); // if moving, move the node to the new parent @@ -1819,7 +1819,7 @@ WHERE cmsPreviewXml.nodeId IN ( long total; do { - // .GetPagedResultsByQuery implicitely adds ({Constants.DatabaseSchema.Tables.Document}.newest = 1) which + // .GetPagedResultsByQuery implicitly adds ({Constants.DatabaseSchema.Tables.Document}.newest = 1) which // is what we want for preview (ie latest version of a content, published or not) var descendants = _documentRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path")); const bool published = true; // previewXml contains edit content! diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStoreFilePersister.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStoreFilePersister.cs index c656562236..83d25d3e49 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStoreFilePersister.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStoreFilePersister.cs @@ -72,7 +72,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { // if _released is false then we're going to setup a timer // then the runner wants to shutdown & run immediately - // this sets _released to true & the timer will trigger eventualy & who cares? + // this sets _released to true & the timer will trigger eventually & who cares? // if _released is true, either it's a normal release, or // a runner shutdown, in which case we won't be able to // add a new task, and so we'll run immediately diff --git a/src/Umbraco.Web/PublishedElementExtensions.cs b/src/Umbraco.Web/PublishedElementExtensions.cs index 3250dbc2ce..f2a49f7f60 100644 --- a/src/Umbraco.Web/PublishedElementExtensions.cs +++ b/src/Umbraco.Web/PublishedElementExtensions.cs @@ -145,7 +145,7 @@ namespace Umbraco.Web } #endregion - + #region ToIndexedArray public static IndexedArrayItem[] ToIndexedArray(this IEnumerable source) diff --git a/src/Umbraco.Web/RouteCollectionExtensions.cs b/src/Umbraco.Web/RouteCollectionExtensions.cs index 7fe80db10d..08630820b7 100644 --- a/src/Umbraco.Web/RouteCollectionExtensions.cs +++ b/src/Umbraco.Web/RouteCollectionExtensions.cs @@ -84,7 +84,7 @@ namespace Umbraco.Web } /// - /// Extension method to manually regsiter an area + /// Extension method to manually register an area /// /// /// @@ -103,7 +103,7 @@ namespace Umbraco.Web } ///// - ///// Extension method to manually regsiter an area from the container + ///// Extension method to manually register an area from the container ///// ///// ///// diff --git a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs index bd85d02dab..f20aa95c0d 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByRedirectUrl.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Routing return false; } - // Apending any querystring from the incoming request to the redirect url. + // Appending any querystring from the incoming request to the redirect url. url = string.IsNullOrEmpty(frequest.Uri.Query) ? url : url + frequest.Uri.Query; _logger.Debug("Route {Route} matches content {ContentId} with url '{Url}', redirecting.", route, content.Id, url); diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index fc1712dfbd..ff629609d3 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -59,8 +59,7 @@ namespace Umbraco.Web.Routing // there may be spaces as in "/foo/bar, /foo/nil" // these should probably be taken care of earlier on - // TODO - // can we normalize the values so that they contain no whitespaces, and no leading slashes? + // TODO: can we normalize the values so that they contain no whitespaces, and no leading slashes? // and then the comparisons in IsMatch can be way faster - and allocate way less strings const string propertyAlias = Constants.Conventions.Content.UrlAlias; diff --git a/src/Umbraco.Web/Routing/IContentLastChanceFinder.cs b/src/Umbraco.Web/Routing/IContentLastChanceFinder.cs index 91343b7d49..259c6b5d41 100644 --- a/src/Umbraco.Web/Routing/IContentLastChanceFinder.cs +++ b/src/Umbraco.Web/Routing/IContentLastChanceFinder.cs @@ -4,7 +4,7 @@ /// Provides a method to try to find and assign an Umbraco document to a PublishedContentRequest /// when everything else has failed. /// - /// Identical to but required in order to differenciate them in ioc. + /// Identical to but required in order to differentiate them in ioc. public interface IContentLastChanceFinder : IContentFinder { } } diff --git a/src/Umbraco.Web/Routing/PublishedRequest.cs b/src/Umbraco.Web/Routing/PublishedRequest.cs index 6814761572..540f6d727d 100644 --- a/src/Umbraco.Web/Routing/PublishedRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedRequest.cs @@ -93,7 +93,7 @@ namespace Umbraco.Web.Routing /// /// When the event triggers, no preparation has been done. It is still possible to /// modify the request's Uri property, for example to restore its original, public-facing value - /// that might have been modified by an in-between equipement such as a load-balancer. + /// that might have been modified by an in-between equipment such as a load-balancer. public static event EventHandler Preparing; /// @@ -274,7 +274,7 @@ namespace Umbraco.Web.Routing return true; } - // NOTE - can we stil get it with whitespaces in it due to old legacy bugs? + // NOTE - can we still get it with whitespaces in it due to old legacy bugs? alias = alias.Replace(" ", ""); var model = _publishedRouter.GetTemplate(alias); @@ -357,7 +357,7 @@ namespace Umbraco.Web.Routing } // note: do we want to have an ordered list of alternate cultures, - // to allow for fallbacks when doing dictionnary lookup and such? + // to allow for fallbacks when doing dictionary lookup and such? #endregion @@ -430,7 +430,7 @@ namespace Umbraco.Web.Routing } /// - /// Indicates that the content requet should trigger a redirect, with a specified status code. + /// Indicates that the content request should trigger a redirect, with a specified status code. /// /// The url to redirect to. /// The status code (300-308). @@ -507,7 +507,8 @@ namespace Umbraco.Web.Routing #region Legacy - // for legacy/webforms code - todo - get rid of it eventually + // for legacy/webforms code - + // TODO: get rid of it eventually internal page UmbracoPage { get diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs index b95977c3a3..94980a7a10 100644 --- a/src/Umbraco.Web/Routing/PublishedRouter.cs +++ b/src/Umbraco.Web/Routing/PublishedRouter.cs @@ -55,7 +55,7 @@ namespace Umbraco.Web.Routing // todo // in 7.7 this is cached in the PublishedContentRequest, which ... makes little sense // killing it entirely, if we need cache, just implement it properly !! - // this is all soooo weird + // this is all so weird public Func> GetRolesForLogin { get; } public PublishedRequest CreateRequest(UmbracoContext umbracoContext, Uri uri = null) @@ -691,7 +691,7 @@ namespace Umbraco.Web.Routing // read the alternate template alias, from querystring, form, cookie or server vars, // only if the published content is the initial once, else the alternate template // does not apply - // + optionnally, apply the alternate template on internal redirects + // + optionally, apply the alternate template on internal redirects var useAltTemplate = request.IsInitialPublishedContent || (_webRoutingSection.InternalRedirectPreservesTemplate && request.IsInternalRedirectPublishedContent); var altTemplate = useAltTemplate diff --git a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs index 669039f087..7795543320 100644 --- a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs +++ b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs @@ -92,7 +92,7 @@ namespace Umbraco.Web.Redirects // we cannot rely only on ContentCacheRefresher because when CacheUpdated triggers the old // route is gone // - // this is all verrrry weird but it seems to work + // this is all very weird but it seems to work ContentService.Publishing += ContentService_Publishing; ContentService.Published += ContentService_Published; diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs index b7f4e13432..26c8faca58 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComponent.cs @@ -255,7 +255,7 @@ namespace Umbraco.Web.Runtime { var appDomainHash = HttpRuntime.AppDomainAppId.ToSHA1(); var cachePath = Path.Combine(Environment.ExpandEnvironmentVariables("%temp%"), "UmbracoData", - //include the appdomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back + //include the AppDomain hash is just a safety check, for example if a website is moved from worker A to worker B and then back // to worker A again, in theory the %temp% folder should already be empty but we really want to make sure that its not // utilizing an old path appDomainHash); diff --git a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs index b4d122b64f..d9e3c3c980 100644 --- a/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs +++ b/src/Umbraco.Web/Scheduling/BackgroundTaskRunner.cs @@ -434,12 +434,12 @@ namespace Umbraco.Web.Scheduling private async Task GetNextBackgroundTask2(CancellationToken shutdownToken) { - // exit if cancelling + // exit if canceling if (shutdownToken.IsCancellationRequested) return null; - // if keepalive is false then don't block, exit if there is - // no task in the buffer - yes, there is a race cond, which + // if KeepAlive is false then don't block, exit if there is + // no task in the buffer - yes, there is a race condition, which // we'll take care of if (_options.KeepAlive == false && _tasks.Count == 0) return null; @@ -482,7 +482,7 @@ namespace Umbraco.Web.Scheduling var latched = bgTask as ILatchedBackgroundTask; if (latched == null || latched.IsLatched == false) return bgTask; - // support cancelling awaiting + // support canceling awaiting // read https://github.com/dotnet/corefx/issues/2704 // read http://stackoverflow.com/questions/27238232/how-can-i-cancel-task-whenall var tokenTaskSource = new TaskCompletionSource(); @@ -519,7 +519,7 @@ namespace Umbraco.Web.Scheduling try { if (bgTask.IsAsync) - //configure await = false since we don't care about the context, we're on a background thread. + // configure await = false since we don't care about the context, we're on a background thread. await bgTask.RunAsync(token).ConfigureAwait(false); else bgTask.Run(); @@ -706,7 +706,7 @@ namespace Umbraco.Web.Scheduling // immediate parameter is true, the registered object must call the UnregisterObject method before returning; // otherwise, its registration will be removed by the application manager. - _logger.Info("{LogPrefix} Cancelling tasks", _logPrefix); + _logger.Info("{LogPrefix} Canceling tasks", _logPrefix); Shutdown(true, true); // cancel all tasks, wait for the current one to end Terminate(true); } diff --git a/src/Umbraco.Web/Scheduling/RecurringTaskBase.cs b/src/Umbraco.Web/Scheduling/RecurringTaskBase.cs index 7a51890c12..58df54a07e 100644 --- a/src/Umbraco.Web/Scheduling/RecurringTaskBase.cs +++ b/src/Umbraco.Web/Scheduling/RecurringTaskBase.cs @@ -9,9 +9,9 @@ namespace Umbraco.Web.Scheduling /// /// Implement by overriding PerformRun or PerformRunAsync and then IsAsync accordingly, /// depending on whether the task is implemented as a sync or async method. Run nor RunAsync are - /// sealed here as overriding them would break recurrence. And then optionnally override + /// sealed here as overriding them would break recurrence. And then optionally override /// RunsOnShutdown, in order to indicate whether the latched task should run immediately on - /// shutdown, or just be abandonned (default). + /// shutdown, or just be abandoned (default). public abstract class RecurringTaskBase : LatchedBackgroundTaskBase { private readonly IBackgroundTaskRunner _runner; diff --git a/src/Umbraco.Web/Scheduling/ScheduledTasks.cs b/src/Umbraco.Web/Scheduling/ScheduledTasks.cs index 115a28504c..66037a0456 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledTasks.cs +++ b/src/Umbraco.Web/Scheduling/ScheduledTasks.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Scheduling ScheduledTaskTimes.Add(t.Alias, DateTime.Now); } - // Add 1 second to timespan to compensate for differencies in timer + // Add 1 second to timespan to compensate for differences in timer else if ( new TimeSpan( DateTime.Now.Ticks - ((DateTime)ScheduledTaskTimes[t.Alias]).Ticks).TotalSeconds + 1 >= t.Interval) diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs index cd4f5ac933..d400ccc077 100644 --- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs +++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs @@ -65,7 +65,7 @@ namespace Umbraco.Web.Scheduling public void Terminate() { - // the appdomain / maindom / whatever takes care of stopping background task runners + // the AppDomain / maindom / whatever takes care of stopping background task runners } private void RegisterBackgroundTasksOnce(object sender, RoutableAttemptEventArgs e) diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Web/Search/ExamineComponent.cs index 4735780231..871f90a319 100644 --- a/src/Umbraco.Web/Search/ExamineComponent.cs +++ b/src/Umbraco.Web/Search/ExamineComponent.cs @@ -71,7 +71,7 @@ namespace Umbraco.Web.Search public void Initialize() { - //we want to tell examine to use a different fs lock instead of the default NativeFSFileLock which could cause problems if the appdomain + //we want to tell examine to use a different fs lock instead of the default NativeFSFileLock which could cause problems if the AppDomain //terminates and in some rare cases would only allow unlocking of the file if IIS is forcefully terminated. Instead we'll rely on the simplefslock //which simply checks the existence of the lock file DirectoryFactory.DefaultLockFactory = d => @@ -91,7 +91,7 @@ namespace Umbraco.Web.Search if (!examineShutdownRegistered) { - _logger.Debug("Examine shutdown not registered, this appdomain is not the MainDom, Examine will be disabled"); + _logger.Debug("Examine shutdown not registered, this AppDomain is not the MainDom, Examine will be disabled"); //if we could not register the shutdown examine ourselves, it means we are not maindom! in this case all of examine should be disabled! Suspendable.ExamineEvents.SuspendIndexers(_logger); @@ -174,7 +174,7 @@ namespace Umbraco.Web.Search lock (IsConfiguredLocker) { - //double chekc + //double check if (_isConfigured) return; _isConfigured = true; @@ -218,7 +218,7 @@ namespace Umbraco.Web.Search else // RefreshNode or RefreshBranch (maybe trashed) { // don't try to be too clever - refresh entirely - // there has to be race conds in there ;-( + // there has to be race conditions in there ;-( var content = contentService.GetById(payload.Id); if (content == null) @@ -585,7 +585,7 @@ namespace Umbraco.Web.Search } #endregion - #region Defered Actions + #region Deferred Actions private class DeferedActions { private readonly List _actions = new List(); diff --git a/src/Umbraco.Web/Search/ExamineComposer.cs b/src/Umbraco.Web/Search/ExamineComposer.cs index 7aab3cfd8f..5a897144f9 100644 --- a/src/Umbraco.Web/Search/ExamineComposer.cs +++ b/src/Umbraco.Web/Search/ExamineComposer.cs @@ -45,7 +45,7 @@ namespace Umbraco.Web.Search composition.RegisterUnique, MediaValueSetBuilder>(); composition.RegisterUnique, MemberValueSetBuilder>(); - //We want to manage Examine's appdomain shutdown sequence ourselves so first we'll disable Examine's default behavior + //We want to manage Examine's AppDomain shutdown sequence ourselves so first we'll disable Examine's default behavior //and then we'll use MainDom to control Examine's shutdown - this MUST be done in Compose ie before ExamineManager //is instantiated, as the value is used during instantiation ExamineManager.DisableDefaultHostingEnvironmentRegistration(); diff --git a/src/Umbraco.Web/Security/AuthenticationExtensions.cs b/src/Umbraco.Web/Security/AuthenticationExtensions.cs index 66fbd8e201..1fa75a214b 100644 --- a/src/Umbraco.Web/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Web/Security/AuthenticationExtensions.cs @@ -34,21 +34,21 @@ namespace Umbraco.Web.Security { if (http == null) throw new ArgumentNullException(nameof(http)); - //if there was a ticket, it's not expired, - it should not be renewed or its renewable + // if there was a ticket, it's not expired, - it should not be renewed or its renewable if (ticket?.Properties.ExpiresUtc != null && ticket.Properties.ExpiresUtc.Value > DateTimeOffset.UtcNow && (renewTicket == false || http.RenewUmbracoAuthTicket())) { try { - //get the Umbraco user identity + // get the Umbraco user identity if (!(ticket.Identity is UmbracoBackOfficeIdentity identity)) throw new InvalidOperationException("The AuthenticationTicket specified does not contain the correct Identity type"); - //set the principal object + // set the principal object var principal = new ClaimsPrincipal(identity); - //It is actually not good enough to set this on the current app Context and the thread, it also needs + // It is actually not good enough to set this on the current app Context and the thread, it also needs // to be set explicitly on the HttpContext.Current !! This is a strange web api thing that is actually - // an underlying fault of asp.net not propogating the User correctly. + // an underlying fault of asp.net not propagating the User correctly. if (HttpContext.Current != null) { HttpContext.Current.User = principal; @@ -56,7 +56,7 @@ namespace Umbraco.Web.Security http.User = principal; Thread.CurrentPrincipal = principal; - //This is a back office request, we will also set the culture/ui culture + // This is a back office request, we will also set the culture/ui culture Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(identity.Culture); @@ -67,7 +67,7 @@ namespace Umbraco.Web.Security { if (ex is FormatException || ex is JsonReaderException) { - //this will occur if the cookie data is invalid + // this will occur if the cookie data is invalid http.UmbracoLogout(); } else @@ -99,17 +99,17 @@ namespace Umbraco.Web.Security if (http == null) throw new ArgumentNullException(nameof(http)); if (http.User == null) return null; //there's no user at all so no identity - //If it's already a UmbracoBackOfficeIdentity + // If it's already a UmbracoBackOfficeIdentity var backOfficeIdentity = http.User.GetUmbracoIdentity(); if (backOfficeIdentity != null) return backOfficeIdentity; if (authenticateRequestIfNotFound == false) return null; - //even if authenticateRequestIfNotFound is true we cannot continue if the request is actually authenticated + // even if authenticateRequestIfNotFound is true we cannot continue if the request is actually authenticated // which would mean something strange is going on that it is not an umbraco identity. if (http.User.Identity.IsAuthenticated) return null; - //So the user is not authed but we've been asked to do the auth if authenticateRequestIfNotFound = true, + // So the user is not authed but we've been asked to do the auth if authenticateRequestIfNotFound = true, // which might occur in old webforms style things or for routes that aren't included as a back office request. // in this case, we are just reverting to authing using the cookie. @@ -237,8 +237,8 @@ namespace Umbraco.Web.Security /// private static void Logout(this HttpContextBase http, string cookieName) { - //We need to clear the sessionId from the database. This is legacy code to do any logging out and shouldn't really be used at all but in any case - //we need to make sure the session is cleared. Due to the legacy nature of this it means we need to use singletons + // We need to clear the sessionId from the database. This is legacy code to do any logging out and shouldn't really be used at all but in any case + // we need to make sure the session is cleared. Due to the legacy nature of this it means we need to use singletons if (http.User != null) { var claimsIdentity = http.User.Identity as ClaimsIdentity; @@ -254,23 +254,23 @@ namespace Umbraco.Web.Security } if (http == null) throw new ArgumentNullException("http"); - //clear the preview cookie and external login + // clear the preview cookie and external login var cookies = new[] { cookieName, Constants.Web.PreviewCookieName, Constants.Security.BackOfficeExternalCookieName }; foreach (var c in cookies) { - //remove from the request + // remove from the request http.Request.Cookies.Remove(c); - //expire from the response + // expire from the response var formsCookie = http.Response.Cookies[c]; if (formsCookie != null) { - //this will expire immediately and be removed from the browser + // this will expire immediately and be removed from the browser formsCookie.Expires = DateTime.Now.AddYears(-1); } else { - //ensure there's def an expired cookie + // ensure there's def an expired cookie http.Response.Cookies.Add(new HttpCookie(c) { Expires = DateTime.Now.AddYears(-1) }); } } @@ -287,7 +287,7 @@ namespace Umbraco.Web.Security var secureFormat = owinCtx.GetUmbracoAuthTicketDataProtector(); - //get the ticket + // get the ticket try { @@ -314,17 +314,17 @@ namespace Umbraco.Web.Security var owinCtx = http.GetOwinContext(); var secureFormat = owinCtx.GetUmbracoAuthTicketDataProtector(); - //will only happen in tests + // will only happen in tests if (secureFormat == null) return null; - //get the ticket + // get the ticket try { return GetAuthTicket(secureFormat, asDictionary, cookieName); } catch (Exception) { - //occurs when decryption fails + // occurs when decryption fails http.Logout(cookieName); return null; } @@ -341,7 +341,7 @@ namespace Umbraco.Web.Security { return null; } - //get the ticket + // get the ticket return secureDataFormat.Unprotect(formsCookie); } diff --git a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs index b711fe76cf..4315d3a762 100644 --- a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Security } /// - /// Borrowed from Micorosoft's underlying sign in manager which is not flexible enough to tell it to use a different cookie type + /// Borrowed from Microsoft's underlying sign in manager which is not flexible enough to tell it to use a different cookie type /// /// /// @@ -148,7 +148,7 @@ namespace Umbraco.Web.Security } /// - /// Borrowed from Micorosoft's underlying sign in manager which is not flexible enough to tell it to use a different cookie type + /// Borrowed from Microsoft's underlying sign in manager which is not flexible enough to tell it to use a different cookie type /// /// /// diff --git a/src/Umbraco.Web/Security/BackOfficeUserManager.cs b/src/Umbraco.Web/Security/BackOfficeUserManager.cs index ce51f82c43..a7256b257d 100644 --- a/src/Umbraco.Web/Security/BackOfficeUserManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeUserManager.cs @@ -211,7 +211,7 @@ namespace Umbraco.Web.Security contentSectionConfig.NotificationEmailAddress, new EmailSender()); - //NOTE: Not implementing these, if people need custom 2 factor auth, they'll need to implement their own UserStore to suport it + //NOTE: Not implementing these, if people need custom 2 factor auth, they'll need to implement their own UserStore to support it //// Register two factor authentication providers. This application uses Phone and Emails as a step of receiving a code for verifying the user //// You can write your own provider and plug in here. @@ -250,7 +250,7 @@ namespace Umbraco.Web.Security /// protected virtual IPasswordHasher GetDefaultPasswordHasher(MembershipProviderBase provider) { - //if the current user membership provider is unkown (this would be rare), then return the default password hasher + //if the current user membership provider is unknown (this would be rare), then return the default password hasher if (provider.IsUmbracoUsersProvider() == false) return new PasswordHasher(); @@ -459,7 +459,7 @@ namespace Umbraco.Web.Security } /// - /// This is copied from the underlying .NET base class since they decied to not expose it + /// This is copied from the underlying .NET base class since they decided to not expose it /// /// /// @@ -471,7 +471,7 @@ namespace Umbraco.Web.Security } /// - /// This is copied from the underlying .NET base class since they decied to not expose it + /// This is copied from the underlying .NET base class since they decided to not expose it /// /// private IUserSecurityStampStore GetSecurityStore() @@ -483,7 +483,7 @@ namespace Umbraco.Web.Security } /// - /// This is copied from the underlying .NET base class since they decied to not expose it + /// This is copied from the underlying .NET base class since they decided to not expose it /// /// private static string NewSecurityStamp() @@ -534,14 +534,14 @@ namespace Umbraco.Web.Security /// - /// Overides the microsoft ASP.NET user managment method + /// Overrides the Microsoft ASP.NET user management method /// /// /// /// returns a Async Task /// /// - /// Doesnt set fail attempts back to 0 + /// Doesn't set fail attempts back to 0 /// public override async Task AccessFailedAsync(int userId) { diff --git a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs index dace264996..dba7a8c33a 100644 --- a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs +++ b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs @@ -123,7 +123,7 @@ namespace Umbraco.Web.Security } } - //Hack! we need to suppress the stupid forms authentcation module but we can only do that by using non owin stuff + //Hack! we need to suppress the stupid forms authentication module but we can only do that by using non owin stuff if (HttpContext.Current != null && HttpContext.Current.Response != null) { HttpContext.Current.Response.SuppressFormsAuthenticationRedirect = true; diff --git a/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs b/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs index 4756390d06..81407afe50 100644 --- a/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs +++ b/src/Umbraco.Web/Security/IdentityAuditEventArgs.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Security; namespace Umbraco.Web.Security { /// - /// This class is used by events raised from hthe BackofficeUserManager + /// This class is used by events raised from the BackofficeUserManager /// public class IdentityAuditEventArgs : EventArgs { @@ -30,7 +30,7 @@ namespace Umbraco.Web.Security public int AffectedUser { get; private set; } /// - /// If a user is perfoming an action on a different user, then this will be set. Otherwise it will be -1 + /// If a user is performing an action on a different user, then this will be set. Otherwise it will be -1 /// public int PerformingUser { get; private set; } diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index db93df953f..79eb27bc3c 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -486,7 +486,7 @@ namespace Umbraco.Web.Security ////This is a rudimentary check to see what data template we should render //// if developers want to change the template they can do so dynamically in their views or controllers //// for a given property. - ////These are the default built-in MVC template types: “Boolean”, “Decimal”, “EmailAddress”, “HiddenInput”, “Html”, “Object”, “String”, “Text”, and “Url” + ////These are the default built-in MVC template types: “Boolean”, “Decimal”, “EmailAddress”, “HiddenInput”, “HTML”, “Object”, “String”, “Text”, and “Url” //// by default we'll render a text box since we've defined that metadata on the UmbracoProperty.Value property directly. //if (prop.DataTypeId == new Guid(Constants.PropertyEditors.TrueFalse)) //{ @@ -706,7 +706,7 @@ namespace Umbraco.Web.Security /// /// /// - /// Returns successful if the membershipuser required updating, otherwise returns failed if it didn't require updating. + /// Returns successful if the membership user required updating, otherwise returns failed if it didn't require updating. /// internal Attempt UpdateMember(MembershipUser member, MembershipProvider provider, string email = null, @@ -763,7 +763,7 @@ namespace Umbraco.Web.Security if (provider.IsUmbracoMembershipProvider() == false) { - throw new NotSupportedException("An IMember model can only be retreived when using the built-in Umbraco membership providers"); + throw new NotSupportedException("An IMember model can only be retrieved when using the built-in Umbraco membership providers"); } var username = provider.GetCurrentUserName(); var member = _memberService.GetByUsername(username); diff --git a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs index 1b528c2ba9..413023c27c 100644 --- a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs +++ b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Security.Providers /// protected override bool PerformChangePassword(string username, string oldPassword, string newPassword) { - //NOTE: due to backwards compatibilty reasons (and UX reasons), this provider doesn't care about the old password and + //NOTE: due to backwards compatibility reasons (and UX reasons), this provider doesn't care about the old password and // allows simply setting the password manually so we don't really care about the old password. // This is allowed based on the overridden AllowManuallyChangingPassword option. @@ -354,7 +354,7 @@ namespace Umbraco.Web.Security.Providers // cause all distributed cache to execute - which will clear out some caches we don't want. // http://issues.umbraco.org/issue/U4-3451 - // when upgrating from 7.2 to 7.3 trying to save will throw + // when upgrading from 7.2 to 7.3 trying to save will throw if (UmbracoVersion.Current >= new Version(7, 3, 0, 0)) MemberService.Save(member, false); } @@ -594,7 +594,7 @@ namespace Umbraco.Web.Security.Providers //TODO: In v8 we aren't going to have an overload to disable events, so we'll need to make a different method // for this type of thing (i.e. UpdateLastLogin or similar). - // when upgrating from 7.2 to 7.3 trying to save will throw + // when upgrading from 7.2 to 7.3 trying to save will throw if (UmbracoVersion.Current >= new Version(7, 3, 0, 0)) MemberService.Save(member, false); diff --git a/src/Umbraco.Web/Security/SessionIdValidator.cs b/src/Umbraco.Web/Security/SessionIdValidator.cs index e5e1394aea..58b6c6ad1c 100644 --- a/src/Umbraco.Web/Security/SessionIdValidator.cs +++ b/src/Umbraco.Web/Security/SessionIdValidator.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.Security /// /// /// This uses another cookie to track the last checked time which is done for a few reasons: - /// * We can't use the user's auth ticket to do thsi because we'd be re-issuing the auth ticket all of the time and it would never expire + /// * We can't use the user's auth ticket to do this because we'd be re-issuing the auth ticket all of the time and it would never expire /// plus the auth ticket size is much larger than this small value /// * This will execute quite often (every minute per user) and in some cases there might be several requests that end up re-issuing the cookie so the cookie value should be small /// * We want to avoid the user lookup if it's not required so that will only happen when the time diff is great enough in the cookie diff --git a/src/Umbraco.Web/Security/UmbracoAuthTicketDataProtector.cs b/src/Umbraco.Web/Security/UmbracoAuthTicketDataProtector.cs index c65c010204..3824935559 100644 --- a/src/Umbraco.Web/Security/UmbracoAuthTicketDataProtector.cs +++ b/src/Umbraco.Web/Security/UmbracoAuthTicketDataProtector.cs @@ -5,7 +5,7 @@ using Umbraco.Core; namespace Umbraco.Web.Security { /// - /// This is used so that we can retrive the auth ticket protector from an IOwinContext + /// This is used so that we can retrieve the auth ticket protector from an IOwinContext /// internal class UmbracoAuthTicketDataProtector : DisposableObjectSlim { diff --git a/src/Umbraco.Web/Security/UmbracoSecureDataFormat.cs b/src/Umbraco.Web/Security/UmbracoSecureDataFormat.cs index 0dc73f5214..19cd602657 100644 --- a/src/Umbraco.Web/Security/UmbracoSecureDataFormat.cs +++ b/src/Umbraco.Web/Security/UmbracoSecureDataFormat.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Security } /// - /// Unprotects the cookie + /// Un-protects the cookie /// /// /// diff --git a/src/Umbraco.Web/Security/WebAuthExtensions.cs b/src/Umbraco.Web/Security/WebAuthExtensions.cs index d38345e48c..aa06616d90 100644 --- a/src/Umbraco.Web/Security/WebAuthExtensions.cs +++ b/src/Umbraco.Web/Security/WebAuthExtensions.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Security { //It is actually not good enough to set this on the current app Context and the thread, it also needs // to be set explicitly on the HttpContext.Current !! This is a strange web api thing that is actually - // an underlying fault of asp.net not propogating the User correctly. + // an underlying fault of asp.net not propagating the User correctly. if (HttpContext.Current != null) { HttpContext.Current.User = principal; @@ -51,7 +51,7 @@ namespace Umbraco.Web.Security { //It is actually not good enough to set this on the current app Context and the thread, it also needs // to be set explicitly on the HttpContext.Current !! This is a strange web api thing that is actually - // an underlying fault of asp.net not propogating the User correctly. + // an underlying fault of asp.net not propagating the User correctly. if (HttpContext.Current != null) { HttpContext.Current.User = principal; diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 18ef806ad1..54ff1bba3f 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -223,7 +223,7 @@ namespace Umbraco.Web.Security // Check for console access if (user == null || (requiresApproval && user.IsApproved == false) || (user.IsLockedOut && RequestIsInUmbracoApplication(_httpContext))) { - if (throwExceptions) throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator"); + if (throwExceptions) throw new ArgumentException("You have no privileges to the umbraco console. Please contact your administrator"); return ValidateRequestAttempt.FailedNoPrivileges; } return ValidateRequestAttempt.Success; diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index db786655b4..ff87719b12 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -177,7 +177,7 @@ namespace Umbraco.Web.Templates /// /// /// To achieve this we temporarily change the output text writer of the current HttpResponse, then - /// execute the controller via the handler which innevitably writes the result to the text writer + /// execute the controller via the handler which inevitably writes the result to the text writer /// that has been assigned to the response. Then we change the response textwriter back to the original /// before continuing . /// diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index c8b13562cd..b4a91f8ab8 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -137,7 +137,7 @@ namespace Umbraco.Web.Trees //If treeGroupName == null then its third party if (treeGroupName.IsNullOrWhiteSpace()) { - //This is used for the localisation key + //This is used for the localization key //treeHeaders/thirdPartyGroup treeGroupName = "thirdPartyGroup"; } diff --git a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs index cce40eb047..ba851191b2 100644 --- a/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentBlueprintTreeController.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.Trees var treeNode = CreateTreeNode(entity, Constants.ObjectTypes.DocumentBlueprint, id, queryStrings, "icon-item-arrangement", true); treeNode.Path = $"-1,{entity.Id}"; treeNode.NodeType = "document-type-blueprints"; - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. + // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; return treeNode; })); diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index 8113a85690..b50f06e14e 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Trees var allowedUserOptions = GetAllowedUserMenuItemsForNode(entity); if (CanUserAccessNode(entity, allowedUserOptions, culture)) { - //Special check to see if it ia a container, if so then we'll hide children. + //Special check to see if it is a container, if so then we'll hide children. var isContainer = entity.IsContainer; // && (queryStrings.Get("isDialog") != "true"); var node = CreateTreeNode( diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index c7420d8d9c..7c0e7c736d 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -429,7 +429,7 @@ namespace Umbraco.Web.Trees } /// - /// Determins if the user has access to view the node/document + /// Determines if the user has access to view the node/document /// /// The Document to check permissions against /// A list of MenuItems that the user has permissions to execute on the current document diff --git a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs index 3c6b9c782c..65a2aa3fb5 100644 --- a/src/Umbraco.Web/Trees/ContentTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTypeTreeController.cs @@ -43,7 +43,7 @@ namespace Umbraco.Web.Trees var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-folder", dt.HasChildren, ""); node.Path = dt.Path; node.NodeType = "container"; - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. + // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. node.AdditionalData["jsClickCallback"] = "javascript:void(0);"; return node; })); @@ -57,7 +57,7 @@ namespace Umbraco.Web.Trees .Select(dt => { // since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to. - // need this check to keep supporting sites where childs have already been created. + // need this check to keep supporting sites where children have already been created. var hasChildren = dt.HasChildren; var node = CreateTreeNode(dt, Constants.ObjectTypes.DocumentType, id, queryStrings, "icon-item-arrangement", hasChildren); diff --git a/src/Umbraco.Web/Trees/DataTypeTreeController.cs b/src/Umbraco.Web/Trees/DataTypeTreeController.cs index 8b38bee865..e60bbe49ed 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -38,8 +38,8 @@ namespace Umbraco.Web.Trees var node = CreateTreeNode(dt, Constants.ObjectTypes.DataType, id, queryStrings, "icon-folder", dt.HasChildren); node.Path = dt.Path; node.NodeType = "container"; - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. - node.AdditionalData["jsClickCallback"] = "javascript:void(0);"; + // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. + node.AdditionalData["jsClickCallback"] = "javascript:void(0);"; return node; })); diff --git a/src/Umbraco.Web/Trees/DictionaryTreeController.cs b/src/Umbraco.Web/Trees/DictionaryTreeController.cs index 6c8f576732..4ff3697a17 100644 --- a/src/Umbraco.Web/Trees/DictionaryTreeController.cs +++ b/src/Umbraco.Web/Trees/DictionaryTreeController.cs @@ -45,7 +45,7 @@ namespace Umbraco.Web.Trees /// All of the query string parameters passed from jsTree /// /// - /// We are allowing an arbitrary number of query strings to be pased in so that developers are able to persist custom data from the front-end + /// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end /// to the back end to be used in the query for model data. /// protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) diff --git a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs index b93c1ac9e3..8420126db4 100644 --- a/src/Umbraco.Web/Trees/MediaTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTypeTreeController.cs @@ -36,12 +36,12 @@ namespace Umbraco.Web.Trees var node = CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, "icon-folder", dt.HasChildren, ""); node.Path = dt.Path; node.NodeType = "container"; - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. + // TODO: This isn't the best way to ensure a no operation process for clicking a node but it works for now. node.AdditionalData["jsClickCallback"] = "javascript:void(0);"; return node; })); - //if the request is for folders only then just return + // if the request is for folders only then just return if (queryStrings["foldersonly"].IsNullOrWhiteSpace() == false && queryStrings["foldersonly"] == "1") return nodes; nodes.AddRange( @@ -50,7 +50,7 @@ namespace Umbraco.Web.Trees .Select(dt => { // since 7.4+ child type creation is enabled by a config option. It defaults to on, but can be disabled if we decide to. - // need this check to keep supporting sites where childs have already been created. + // need this check to keep supporting sites where children have already been created. var hasChildren = dt.HasChildren; var node = CreateTreeNode(dt, Constants.ObjectTypes.MediaType, id, queryStrings, "icon-thumbnails", hasChildren); @@ -69,7 +69,7 @@ namespace Umbraco.Web.Trees if (id == Constants.System.Root.ToInvariantString()) { - //set the default to create + // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; // root actions @@ -81,7 +81,7 @@ namespace Umbraco.Web.Trees var container = Services.EntityService.Get(int.Parse(id), UmbracoObjectTypes.MediaTypeContainer); if (container != null) { - //set the default to create + // set the default to create menu.DefaultMenuAlias = ActionNew.ActionAlias; menu.Items.Add(Services.TextService, opensDialog: true); @@ -93,7 +93,7 @@ namespace Umbraco.Web.Trees if (container.HasChildren == false) { - //can delete doc type + // can delete doc type menu.Items.Add(Services.TextService, opensDialog: true); } menu.Items.Add(new RefreshNode(Services.TextService, true)); @@ -107,7 +107,7 @@ namespace Umbraco.Web.Trees { menu.Items.Add(Services.TextService, opensDialog: true); - //no move action if this is a child doc type + // no move action if this is a child doc type if (parent == null) { menu.Items.Add(Services.TextService, true, opensDialog: true); @@ -116,7 +116,7 @@ namespace Umbraco.Web.Trees else { menu.Items.Add(Services.TextService, opensDialog: true); - //no move action if this is a child doc type + // no move action if this is a child doc type if (parent == null) { menu.Items.Add(Services.TextService, true, opensDialog: true); diff --git a/src/Umbraco.Web/Trees/TreeControllerBase.cs b/src/Umbraco.Web/Trees/TreeControllerBase.cs index d06d768f2d..7b4c049353 100644 --- a/src/Umbraco.Web/Trees/TreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/TreeControllerBase.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Trees /// All of the query string parameters passed from jsTree /// /// - /// We are allowing an arbitrary number of query strings to be pased in so that developers are able to persist custom data from the front-end + /// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end /// to the back end to be used in the query for model data. /// protected abstract TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings); @@ -115,7 +115,7 @@ namespace Umbraco.Web.Trees /// /// JSON markup for jsTree /// - /// We are allowing an arbitrary number of query strings to be pased in so that developers are able to persist custom data from the front-end + /// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end /// to the back end to be used in the query for model data. /// [HttpQueryStringFilter("queryStrings")] @@ -389,7 +389,7 @@ namespace Umbraco.Web.Trees } /// - /// An event that allows developers to modify the meun that is being rendered + /// An event that allows developers to modify the menu that is being rendered /// /// /// Developers can add/remove/replace/insert/update/etc... any of the tree items in the collection. diff --git a/src/Umbraco.Web/Trees/UrlHelperExtensions.cs b/src/Umbraco.Web/Trees/UrlHelperExtensions.cs index c794110d88..3221023ca2 100644 --- a/src/Umbraco.Web/Trees/UrlHelperExtensions.cs +++ b/src/Umbraco.Web/Trees/UrlHelperExtensions.cs @@ -39,7 +39,7 @@ namespace Umbraco.Web.Trees //to convert a filepath to a tree syncing path string. //removes the basepath from the path - //and normalises paths - / is used consistently between trees and editors + //and normalizes paths - / is used consistently between trees and editors basePath = basePath.TrimStart("~"); virtualPath = virtualPath.TrimStart("~"); virtualPath = virtualPath.Substring(basePath.Length); diff --git a/src/Umbraco.Web/UI/JavaScript/AssetInitialization.cs b/src/Umbraco.Web/UI/JavaScript/AssetInitialization.cs index cd7270ac62..9b6aa96e37 100644 --- a/src/Umbraco.Web/UI/JavaScript/AssetInitialization.cs +++ b/src/Umbraco.Web/UI/JavaScript/AssetInitialization.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.UI.JavaScript var dependencies = assets.Select(x => { // most declarations with be made relative to the /umbraco folder, so things - // ike lib/blah/blah.js so we need to turn them into absolutes here + // like lib/blah/blah.js so we need to turn them into absolutes here if (x.StartsWith("/") == false && Uri.IsWellFormedUriString(x, UriKind.Relative)) { return new BasicFile(assetType) { FilePath = new Uri(requestUrl, x).AbsolutePath }; diff --git a/src/Umbraco.Web/UI/JavaScript/ClientDependencyConfiguration.cs b/src/Umbraco.Web/UI/JavaScript/ClientDependencyConfiguration.cs index f1f57a03a7..b5235c7938 100644 --- a/src/Umbraco.Web/UI/JavaScript/ClientDependencyConfiguration.cs +++ b/src/Umbraco.Web/UI/JavaScript/ClientDependencyConfiguration.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.UI.JavaScript /// The version of Umbraco we're upgrading to /// A date value to use in the hash to prevent this method from updating the version on each startup /// Allows the developer to specify the date precision for the hash (i.e. "yyyyMMdd" would be a precision for the day) - /// Boolean to indicate succesful update of the ClientDependency.config file + /// Boolean to indicate successful update of the ClientDependency.config file public bool UpdateVersionNumber(SemVersion version, DateTime date, string dateFormat) { var byteContents = Encoding.Unicode.GetBytes(version + date.ToString(dateFormat)); @@ -56,7 +56,7 @@ namespace Umbraco.Web.UI.JavaScript //CDF requires an INT, and although this isn't fail safe, it will work for our purposes. We are not hashing for crypto purposes //so there could be some collisions with this conversion but it's not a problem for our purposes //It's also important to note that the long.GetHashCode() implementation in .NET is this: return (int) this ^ (int) (this >> 32); - //which means that this value will not change per appdomain like some GetHashCode implementations. + //which means that this value will not change per AppDomain like some GetHashCode implementations. intHash = longResult.GetHashCode(); } diff --git a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs index 2f320ef839..f223fe5310 100644 --- a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs +++ b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs @@ -8,10 +8,11 @@ // //------------------------------------------------------------------------------ -namespace Umbraco.Web.UI.JavaScript { +namespace Umbraco.Web.UI.JavaScript +{ using System; - - + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -22,44 +23,52 @@ namespace Umbraco.Web.UI.JavaScript { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - + internal class Resources + { + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { + internal Resources() + { } - + /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if (object.ReferenceEquals(resourceMan, null)) + { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Umbraco.Web.UI.JavaScript.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { + internal static global::System.Globalization.CultureInfo Culture + { + get + { return resourceCulture; } - set { + set + { resourceCulture = value; } } - + /// /// Looks up a localized string similar to [ /// 'lib/jquery/jquery.min.js', @@ -80,12 +89,14 @@ namespace Umbraco.Web.UI.JavaScript { /// 'lib/angular-animate/angular-animate.js', /// [rest of string was truncated]";. /// - internal static string JsInitialize { - get { + internal static string JsInitialize + { + get + { return ResourceManager.GetString("JsInitialize", resourceCulture); } } - + /// /// Looks up a localized string similar to LazyLoad.js("##JsInitialize##", function () { /// //we need to set the legacy UmbClientMgr path @@ -99,12 +110,14 @@ namespace Umbraco.Web.UI.JavaScript { ///}); ///. /// - internal static string Main { - get { + internal static string Main + { + get + { return ResourceManager.GetString("Main", resourceCulture); } } - + /// /// Looks up a localized string similar to [ /// '../lib/jquery/jquery.min.js', @@ -122,12 +135,14 @@ namespace Umbraco.Web.UI.JavaScript { ///] ///. /// - internal static string PreviewInitialize { - get { + internal static string PreviewInitialize + { + get + { return ResourceManager.GetString("PreviewInitialize", resourceCulture); } } - + /// /// Looks up a localized string similar to //TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but ///// how to do that when this is not a regular JS file, it is a server side JS file and RequireJS seems to only want @@ -139,8 +154,10 @@ namespace Umbraco.Web.UI.JavaScript { /////define a global static object ///Umbraco.Sys.ServerVariables = ##Variables## ;. /// - internal static string ServerVariables { - get { + internal static string ServerVariables + { + get + { return ResourceManager.GetString("ServerVariables", resourceCulture); } } diff --git a/src/Umbraco.Web/UI/JavaScript/Resources.resx b/src/Umbraco.Web/UI/JavaScript/Resources.resx index 34cea3a2d4..95526f51e7 100644 --- a/src/Umbraco.Web/UI/JavaScript/Resources.resx +++ b/src/Umbraco.Web/UI/JavaScript/Resources.resx @@ -37,7 +37,7 @@ mimetype set. The mimetype is used for serialized objects, and tells the - ResXResourceReader how to depersist the object. This is currently not + ResXResourceReader how to stop persisting the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format @@ -130,4 +130,4 @@ servervariables.js;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - \ No newline at end of file + diff --git a/src/Umbraco.Web/UI/Pages/BasePage.cs b/src/Umbraco.Web/UI/Pages/BasePage.cs index a8fbc92722..c0c266367a 100644 --- a/src/Umbraco.Web/UI/Pages/BasePage.cs +++ b/src/Umbraco.Web/UI/Pages/BasePage.cs @@ -40,9 +40,9 @@ namespace Umbraco.Web.UI.Pages public UrlHelper Url => _url ?? (_url = new UrlHelper(Context.Request.RequestContext)); /// - /// Gets the Html helper. + /// Gets the HTML helper. /// - /// This html helper is created with an empty context and page so it may not have all of the functionality expected. + /// This HTML helper is created with an empty context and page so it may not have all of the functionality expected. public HtmlHelper Html => _html ?? (_html = new HtmlHelper(new ViewContext(), new ViewPage())); /// diff --git a/src/Umbraco.Web/UI/Pages/ClientTools.cs b/src/Umbraco.Web/UI/Pages/ClientTools.cs index 6988877fa2..92b879dad1 100644 --- a/src/Umbraco.Web/UI/Pages/ClientTools.cs +++ b/src/Umbraco.Web/UI/Pages/ClientTools.cs @@ -126,10 +126,10 @@ namespace Umbraco.Web.UI.Pages } /// - /// A reference to the umbraco UI component "speechbubble". The speechbubble appears in the lower right corner of the screen, notifying users of events + /// A reference to the umbraco UI component "speechbubble". The speech bubble appears in the lower right corner of the screen, notifying users of events /// - /// The speechbubble icon. - /// The speechbubble header. + /// The speech bubble icon. + /// The speech bubble header. /// The body text public ClientTools ShowSpeechBubble(SpeechBubbleIcon i, string header, string body) { diff --git a/src/Umbraco.Web/UmbracoApplicationBase.cs b/src/Umbraco.Web/UmbracoApplicationBase.cs index d8d0d65b55..1ce518a653 100644 --- a/src/Umbraco.Web/UmbracoApplicationBase.cs +++ b/src/Umbraco.Web/UmbracoApplicationBase.cs @@ -86,7 +86,7 @@ namespace Umbraco.Web // which means that this will be called *many* times for different apps when Umbraco runs public override void Init() { - // note: base.Init() is what initializes all of the httpmodules, ties up a bunch of stuff with IIS, etc... + // note: base.Init() is what initializes all of the http modules, ties up a bunch of stuff with IIS, etc... // therefore, since OWIN is an HttpModule when running in IIS/ASP.Net the OWIN startup is not executed // until this method fires and by that time - Umbraco has booted already diff --git a/src/Umbraco.Web/UmbracoComponentRenderer.cs b/src/Umbraco.Web/UmbracoComponentRenderer.cs index e2d4ecfc39..48d0d571ee 100644 --- a/src/Umbraco.Web/UmbracoComponentRenderer.cs +++ b/src/Umbraco.Web/UmbracoComponentRenderer.cs @@ -132,7 +132,7 @@ namespace Umbraco.Web // looks for a lower case match. WTF. the whole macro concept needs to be rewritten. - //NOTE: the value could have html encoded values, so we need to deal with that + //NOTE: the value could have HTML encoded values, so we need to deal with that macroProps.Add(i.Key.ToLowerInvariant(), (i.Value is string) ? HttpUtility.HtmlDecode(i.Value.ToString()) : i.Value); } var renderer = new MacroRenderer(Current.ProfilingLogger); diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs index 41ac309653..49a3832483 100644 --- a/src/Umbraco.Web/UmbracoContext.cs +++ b/src/Umbraco.Web/UmbracoContext.cs @@ -260,7 +260,7 @@ namespace Umbraco.Web /// ctor will have to have another parameter added only for this one method which is annoying and doesn't make a ton of sense /// since the UmbracoContext itself doesn't use this. /// - /// TODO The alternative is to have a IDomainHelperAccessor singleton which is cached per UmbracoContext + /// TODO: The alternative is to have a IDomainHelperAccessor singleton which is cached per UmbracoContext /// internal DomainHelper GetDomainHelper(ISiteDomainHelper siteDomainHelper) => _domainHelper ?? (_domainHelper = new DomainHelper(PublishedSnapshot.Domains, siteDomainHelper)); diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index ee57054dc9..110c3e84d0 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -770,10 +770,10 @@ namespace Umbraco.Web #region Strings /// - /// Replaces text line breaks with html line breaks + /// Replaces text line breaks with HTML line breaks /// /// The text. - /// The text with text line breaks replaced with html linebreaks (
)
+ /// The text with text line breaks replaced with HTML line breaks (
)
public IHtmlString ReplaceLineBreaksForHtml(string text) { return StringUtilities.ReplaceLineBreaksForHtml(text); @@ -791,7 +791,7 @@ namespace Umbraco.Web } /// - /// Strips all html tags from a given string, all contents of the tags will remain. + /// Strips all HTML tags from a given string, all contents of the tags will remain. /// public HtmlString StripHtml(IHtmlString html, params string[] tags) { @@ -799,7 +799,7 @@ namespace Umbraco.Web } /// - /// Strips all html tags from a given string, all contents of the tags will remain. + /// Strips all HTML tags from a given string, all contents of the tags will remain. /// public HtmlString StripHtml(string html, params string[] tags) { @@ -831,7 +831,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(IHtmlString html, int length) { @@ -839,7 +839,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis) { @@ -847,7 +847,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(IHtmlString html, int length, bool addElipsis, bool treatTagsAsContent) { @@ -855,7 +855,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(string html, int length) { @@ -863,7 +863,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(string html, int length, bool addElipsis) { @@ -871,7 +871,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given length, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given length, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString Truncate(string html, int length, bool addElipsis, bool treatTagsAsContent) { @@ -881,7 +881,7 @@ namespace Umbraco.Web #region Truncate by Words /// - /// Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString TruncateByWords(string html, int words) { @@ -891,7 +891,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString TruncateByWords(string html, int words, bool addElipsis) { @@ -901,7 +901,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString TruncateByWords(IHtmlString html, int words) { @@ -911,7 +911,7 @@ namespace Umbraco.Web } /// - /// Truncates a string to a given amount of words, can add a elipsis at the end (...). Method checks for open html tags, and makes sure to close them + /// Truncates a string to a given amount of words, can add a ellipsis at the end (...). Method checks for open HTML tags, and makes sure to close them /// public IHtmlString TruncateByWords(IHtmlString html, int words, bool addElipsis) { diff --git a/src/Umbraco.Web/UmbracoInjectedModule.cs b/src/Umbraco.Web/UmbracoInjectedModule.cs index eb6fc54fbb..9c413402b8 100644 --- a/src/Umbraco.Web/UmbracoInjectedModule.cs +++ b/src/Umbraco.Web/UmbracoInjectedModule.cs @@ -107,7 +107,7 @@ namespace Umbraco.Web } /// - /// Processses the Umbraco Request + /// Processes the Umbraco Request /// /// /// @@ -150,9 +150,9 @@ namespace Umbraco.Web // note: requestModule.UmbracoRewrite also did some stripping of &umbPage // from the querystring... that was in v3.x to fix some issues with pre-forms - // auth. Paul Sterling confirmed in jan. 2013 that we can get rid of it. + // auth. Paul Sterling confirmed in Jan. 2013 that we can get rid of it. - // instanciate, prepare and process the published content request + // instantiate, prepare and process the published content request // important to use CleanedUmbracoUrl - lowercase path-only version of the current url var request = _publishedRouter.CreateRequest(umbracoContext); umbracoContext.PublishedRequest = request; @@ -347,7 +347,7 @@ namespace Umbraco.Web context.RewritePath(rewritePath, "", "", false); //if it is MVC we need to do something special, we are not using TransferRequest as this will - //require us to rewrite the path with query strings and then reparse the query strings, this would + //require us to rewrite the path with query strings and then re-parse the query strings, this would //also mean that we need to handle IIS 7 vs pre-IIS 7 differently. Instead we are just going to create //an instance of the UrlRoutingModule and call it's PostResolveRequestCache method. This does: // * Looks up the route based on the new rewritten URL @@ -380,7 +380,7 @@ namespace Umbraco.Web context.RewritePath(rewritePath, "", query, false); //if it is MVC we need to do something special, we are not using TransferRequest as this will - //require us to rewrite the path with query strings and then reparse the query strings, this would + //require us to rewrite the path with query strings and then re-parse the query strings, this would //also mean that we need to handle IIS 7 vs pre-IIS 7 differently. Instead we are just going to create //an instance of the UrlRoutingModule and call it's PostResolveRequestCache method. This does: // * Looks up the route based on the new rewritten URL diff --git a/src/Umbraco.Web/UriUtility.cs b/src/Umbraco.Web/UriUtility.cs index 9f90c803c6..a4de3c412e 100644 --- a/src/Umbraco.Web/UriUtility.cs +++ b/src/Umbraco.Web/UriUtility.cs @@ -223,7 +223,7 @@ namespace Umbraco.Web #endregion /// - /// Returns an faull url with the host, port, etc... + /// Returns an full url with the host, port, etc... /// /// An absolute path (i.e. starts with a '/' ) /// diff --git a/src/Umbraco.Web/UrlHelperExtensions.cs b/src/Umbraco.Web/UrlHelperExtensions.cs index 0a04539967..1397ffc818 100644 --- a/src/Umbraco.Web/UrlHelperExtensions.cs +++ b/src/Umbraco.Web/UrlHelperExtensions.cs @@ -177,7 +177,7 @@ namespace Umbraco.Web public static string GetCacheBustHash() { //make a hash of umbraco and client dependency version - //in case the user bypasses the installer and just bumps the web.config or clientdep config + //in case the user bypasses the installer and just bumps the web.config or client dependency config //if in debug mode, always burst the cache if (GlobalSettings.DebugMode) diff --git a/src/Umbraco.Web/UrlHelperRenderExtensions.cs b/src/Umbraco.Web/UrlHelperRenderExtensions.cs index 490ad9a6a7..2835bc02dc 100644 --- a/src/Umbraco.Web/UrlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/UrlHelperRenderExtensions.cs @@ -32,7 +32,7 @@ namespace Umbraco.Web /// The crop alias e.g. thumbnail /// /// - /// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be + /// Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be /// set to false if using the result of this method for CSS. /// /// @@ -56,7 +56,7 @@ namespace Umbraco.Web /// The crop alias e.g. thumbnail /// /// - /// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be + /// Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be /// set to false if using the result of this method for CSS. /// /// @@ -102,7 +102,7 @@ namespace Umbraco.Web /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters /// /// - /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated + /// Add a serialized date of the last edit of the item to ensure client cache refresh when updated /// /// /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example: @@ -120,7 +120,7 @@ namespace Umbraco.Web /// /// /// - /// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be + /// Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be /// set to false if using the result of this method for CSS. /// /// @@ -183,7 +183,7 @@ namespace Umbraco.Web /// Use crop dimensions to have the output image sized according to the predefined crop sizes, this will override the width and height parameters /// /// - /// Add a serialised date of the last edit of the item to ensure client cache refresh when updated + /// Add a serialized date of the last edit of the item to ensure client cache refresh when updated /// /// /// These are any query string parameters (formatted as query strings) that ImageProcessor supports. For example: @@ -201,7 +201,7 @@ namespace Umbraco.Web /// /// /// - /// Whether to HTML encode this URL - default is true - w3c standards require html attributes to be html encoded but this can be + /// Whether to HTML encode this URL - default is true - w3c standards require HTML attributes to be HTML encoded but this can be /// set to false if using the result of this method for CSS. /// /// diff --git a/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs b/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs index 99e08a4597..cfb7ddb6bc 100644 --- a/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.WebApi.Filters } //NOTE: Until we upgraded to WebApi 2, this didn't work correctly and we had to revert to using // HttpContext.Current responses. I've changed this back to what it should be now since it works - // and now with WebApi2, the HttpContext.Current responses dont! Anyways, all good now. + // and now with WebApi2, the HttpContext.Current responses don't! Anyways, all good now. actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue() { NoCache = true, diff --git a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs index 233ce39e52..6e6ec35b1b 100644 --- a/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/FileUploadCleanupFilterAttribute.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.WebApi.Filters //cleanup any files associated foreach (var f in contentItem.UploadedFiles) { - //track all temp folders so we can remove old files afterwords + //track all temp folders so we can remove old files afterwards var dir = Path.GetDirectoryName(f.TempFilePath); if (tempFolders.Contains(dir) == false) { @@ -104,7 +104,7 @@ namespace Umbraco.Web.WebApi.Filters { if (f.TempFilePath.IsNullOrWhiteSpace() == false) { - //track all temp folders so we can remove old files afterwords + //track all temp folders so we can remove old files afterwards var dir = Path.GetDirectoryName(f.TempFilePath); if (tempFolders.Contains(dir) == false) { diff --git a/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs b/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs index d56411952d..522c3af8bb 100644 --- a/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.WebApi.Filters return; } - //if the controller is allowing overridable authorization at the action level and there are action level authorization attributes + //if the controller is allowing authorization to be overridden at the action level and there are action level authorization attributes // then exit and let the action level auth attribute(s) execute. if (actionContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes().Any() diff --git a/src/Umbraco.Web/WebApi/Filters/UmbracoApplicationAuthorizeAttribute.cs b/src/Umbraco.Web/WebApi/Filters/UmbracoApplicationAuthorizeAttribute.cs index bbb91efd64..37a8f8a4b4 100644 --- a/src/Umbraco.Web/WebApi/Filters/UmbracoApplicationAuthorizeAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/UmbracoApplicationAuthorizeAttribute.cs @@ -18,7 +18,7 @@ namespace Umbraco.Web.WebApi.Filters private readonly string[] _appNames; /// - /// Constructor to set any number of applications that the user needs access to to be authorized + /// Constructor to set any number of applications that the user needs access to be authorized /// /// /// If the user has access to any of the specified apps, they will be authorized. diff --git a/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs b/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs index 6390ead73e..c67ec2f6a7 100644 --- a/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs +++ b/src/Umbraco.Web/WebApi/HttpActionContextExtensions.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.WebApi // But it deadlocks. See https://stackoverflow.com/questions/15201255 for details, which // points to https://msdn.microsoft.com/en-us/magazine/jj991977.aspx which contains more // details under "Async All the Way" - see also https://olitee.com/2015/01/c-async-await-common-deadlock-scenario/ - // which contains a simplified explaination: ReadAsMultipartAsync is meant to be awaited, + // which contains a simplified explanation: ReadAsMultipartAsync is meant to be awaited, // not used in the non-async .Result way, and there is nothing we can do about it. // // Alas, model binders cannot be async "all the way", so we have to wrap in a task, to diff --git a/src/Umbraco.Web/WebApi/HttpRequestMessageExtensions.cs b/src/Umbraco.Web/WebApi/HttpRequestMessageExtensions.cs index 5bd429b598..96c9c0e9a0 100644 --- a/src/Umbraco.Web/WebApi/HttpRequestMessageExtensions.cs +++ b/src/Umbraco.Web/WebApi/HttpRequestMessageExtensions.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.WebApi } /// - /// Create a 403 (Forbidden) response indicating that hte current user doesn't have access to the resource + /// Create a 403 (Forbidden) response indicating that the current user doesn't have access to the resource /// requested or the action it needs to take. /// /// @@ -131,7 +131,7 @@ namespace Umbraco.Web.WebApi } /// - /// Creates a succressful response with notifications in the result to be displayed in the UI + /// Creates a successful response with notifications in the result to be displayed in the UI /// /// /// diff --git a/src/Umbraco.Web/WebApi/SessionHttpControllerRouteHandler.cs b/src/Umbraco.Web/WebApi/SessionHttpControllerRouteHandler.cs index 5dd641b25c..fac3a633a4 100644 --- a/src/Umbraco.Web/WebApi/SessionHttpControllerRouteHandler.cs +++ b/src/Umbraco.Web/WebApi/SessionHttpControllerRouteHandler.cs @@ -10,7 +10,7 @@ namespace Umbraco.Web.WebApi ///
/// /// WebApi controllers (and REST in general) shouldn't have session state enabled since it's stateless, - /// enabling session state puts additional locks on requests so only use this when absolutley needed + /// enabling session state puts additional locks on requests so only use this when absolutely needed /// internal class SessionHttpControllerRouteHandler : HttpControllerRouteHandler { diff --git a/src/Umbraco.Web/_Legacy/Controls/TabPage.cs b/src/Umbraco.Web/_Legacy/Controls/TabPage.cs index 4a5be34d7c..5be5bf1147 100644 --- a/src/Umbraco.Web/_Legacy/Controls/TabPage.cs +++ b/src/Umbraco.Web/_Legacy/Controls/TabPage.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web._Legacy.Controls public class TabPage : WebControl { - // Ensure that a TabPage cannot be instatiated outside + // Ensure that a TabPage cannot be instantiated outside // this assembly -> New instances of a tabpage can only be retrieved through the tabview private bool _hasMenu = true; protected LiteralControl ErrorHeaderControl = new LiteralControl(); diff --git a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs index f276afeca9..94e1b6e923 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web._Legacy.PackageActions /// /// /// - /// true if executed successfully + /// True if executed succesfully public bool Execute(string packageName, XElement xmlData) { diff --git a/src/Umbraco.Web/_Legacy/UI/LegacyDialogHandler.cs b/src/Umbraco.Web/_Legacy/UI/LegacyDialogHandler.cs index cfa93dc0f6..5390d3d30a 100644 --- a/src/Umbraco.Web/_Legacy/UI/LegacyDialogHandler.cs +++ b/src/Umbraco.Web/_Legacy/UI/LegacyDialogHandler.cs @@ -197,7 +197,7 @@ namespace Umbraco.Web._Legacy.UI ITaskReturnUrl returnUrlTask = typeInstance as LegacyDialogTask; if (returnUrlTask != null) { - // if castable to LegacyDialogTask: add in additionalValues + // if it is possible to cast to LegacyDialogTask: add in additionalValues ((LegacyDialogTask) returnUrlTask).AdditionalValues = additionalValues; } else diff --git a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs index 56d596e24d..1c2fdcb72b 100644 --- a/src/Umbraco.Web/umbraco.presentation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/default.aspx.cs @@ -60,7 +60,7 @@ namespace umbraco }; FireBeforeRequestInit(args); - //if we are cancelling then return and don't proceed + //if we are canceling then return and don't proceed if (args.Cancel) return; // reset the friendly path so it's used by forms, etc. diff --git a/src/Umbraco.Web/umbraco.presentation/item.cs b/src/Umbraco.Web/umbraco.presentation/item.cs index 74cfb9bf25..bbbc67bb26 100644 --- a/src/Umbraco.Web/umbraco.presentation/item.cs +++ b/src/Umbraco.Web/umbraco.presentation/item.cs @@ -88,7 +88,7 @@ namespace umbraco } else { - //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent) + //get the value the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent) var elt = elements[_fieldName]; if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false) _fieldContent = elt.ToString().Trim(); @@ -108,7 +108,7 @@ namespace umbraco } else { - //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent) + //get the value the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent) var elt = elements[altFieldName]; if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false) _fieldContent = elt.ToString().Trim(); @@ -135,7 +135,7 @@ namespace umbraco /// private string GetRecursiveValueLegacy(IDictionary elements) { - using (Current.ProfilingLogger.DebugDuration("Checking recusively")) + using (Current.ProfilingLogger.DebugDuration("Checking recursively")) { var content = ""; diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index 0c9b0c6ff3..3b879c5b02 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -51,7 +51,7 @@ namespace umbraco /// /// The difference between creating the page with PublishedContentRequest vs an IPublishedContent item is /// that the PublishedContentRequest takes into account how a template is assigned during the routing process whereas - /// with an IPublishedContent item, the template id is asssigned purely based on the default. + /// with an IPublishedContent item, the template id is assigned purely based on the default. /// internal page(PublishedRequest frequest) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs index 58d219e0c6..0997d2675e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs @@ -53,7 +53,7 @@ namespace dashboardUtilities } else { - Current.Logger.Debug("Access to unallowed feedproxy attempted: {RequestUrl}", requestUri); + Current.Logger.Debug("Access to unallowed feed proxy attempted: {RequestUrl}", requestUri); } } catch (Exception ex) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs index 584ad4ca7f..b47f48804e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs @@ -6,7 +6,7 @@ using System.Web.Mvc; using System.Web.UI; using System.Web.UI.WebControls; -//This is only in case an upgrade goes wrong and the the /masterpages/ files are not copied over +//This is only in case an upgrade goes wrong and the /masterpages/ files are not copied over //which would result in an error. so we have kept the old namespaces intact with references to new ones using StackExchange.Profiling; using Umbraco.Core.Configuration; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/DisableEventValidation.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/DisableEventValidation.cs index 1672053023..f3552cdb4d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/DisableEventValidation.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/DisableEventValidation.cs @@ -8,7 +8,7 @@ using System.ComponentModel; namespace umbraco.presentation.templateControls { /// - /// This control disables request validation (equalevant of setting validateRequest to false in page directive) + /// This control disables request validation (equivalent of setting validateRequest to false in page directive) /// [ToolboxData("<{0}:DisableRequestValidation runat=\"server\">")] [Designer("umbraco.presentation.templateControls.ItemDesigner, Umbraco.Web")] diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Item.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Item.cs index 8473341ca8..f6f2510818 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Item.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Item.cs @@ -145,7 +145,7 @@ namespace umbraco.presentation.templateControls #endregion - #region Overriden Control Methods + #region Overridden Control Methods /// /// Raises the event. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs index 67e82b3822..0b91be5faf 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs @@ -134,7 +134,7 @@ namespace umbraco.presentation.templateControls } /// - /// Inits the specified item. To be called from the OnInit method of Item. + /// Initializes the specified item. To be called from the OnInit method of Item. /// /// The item. public virtual void Init(Item item) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Macro.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Macro.cs index 0d54ce2a02..a6aa51752e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/Macro.cs @@ -159,7 +159,7 @@ namespace umbraco.presentation.templateControls if (int.TryParse(Attributes["Cache"], out cacheDuration)) tempMacro.CacheDuration = cacheDuration; else - Context.Trace.Warn("Template", "Cache attribute is in incorect format (should be an integer)."); + Context.Trace.Warn("Template", "Cache attribute is in incorrect format (should be an integer)."); } var renderer = new MacroRenderer(Current.ProfilingLogger); From 8d2c1332d3ba41f47c036ef8948afce9a0b43225 Mon Sep 17 00:00:00 2001 From: Chris Houston Date: Sat, 26 Jan 2019 10:56:30 -0500 Subject: [PATCH 49/76] Fixed a few typos I spotted in the last commit :) (#4215) --- src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs index 7b292307cc..6c266ced2a 100644 --- a/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs +++ b/src/Umbraco.Core/Deploy/IDataTypeConfigurationConnector.cs @@ -5,11 +5,11 @@ using Umbraco.Core.Models; namespace Umbraco.Core.Deploy { /// - /// Defines methods that can convert a data type configurations to / from an environment-agnostic string. + /// Defines methods that can convert data type configuration to / from an environment-agnostic string. /// - /// Configurations may contain values such as content identifiers, that would be local + /// Configuration may contain values such as content identifiers, that would be local /// to one environment, and need to be converted in order to be deployed. - [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This is actual only used by Deploy, but we dont want third parties to have references on deploy, thats why this interface is part of core.")] + [SuppressMessage("ReSharper", "UnusedMember.Global", Justification = "This is actual only used by Deploy, but we don't want third parties to have references on deploy, that's why this interface is part of core.")] public interface IDataTypeConfigurationConnector { /// From 32f228fa7c7e8b062b35db1c7f5dfd41c69e03f5 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 24 Jan 2019 11:48:39 +0100 Subject: [PATCH 50/76] Use the media file name as display name in the file link --- .../components/media/umbmedianodeinfo.directive.js | 9 ++++++++- .../src/views/components/media/umb-media-node-info.html | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js index ce816261d0..577ffe0176 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/media/umbmedianodeinfo.directive.js @@ -40,6 +40,13 @@ function setMediaLink(){ scope.nodeUrl = scope.node.mediaLink; + // grab the file name from the URL and use it as the display name in the file link + var match = /.*\/(.*)/.exec(scope.nodeUrl); + if (match) { + scope.nodeFileName = match[1]; + } else { + scope.nodeFileName = scope.nodeUrl; + } } scope.openMediaType = function (mediaType) { @@ -92,4 +99,4 @@ angular.module('umbraco.directives').directive('umbMediaNodeInfo', MediaNodeInfoDirective); -})(); \ No newline at end of file +})(); diff --git a/src/Umbraco.Web.UI.Client/src/views/components/media/umb-media-node-info.html b/src/Umbraco.Web.UI.Client/src/views/components/media/umb-media-node-info.html index 4004c2b958..f411437b1d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/media/umb-media-node-info.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/media/umb-media-node-info.html @@ -14,7 +14,7 @@
  • - {{nodeUrl}} + {{nodeFileName}}
  • From 52a56c8852f0053fe293f5107902158302d30f30 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Thu, 24 Jan 2019 00:24:37 +0100 Subject: [PATCH 51/76] Only add TLS 1.2 if explicit protocols are defined --- src/Umbraco.Web/WebBootManager.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index faf1418b42..950676355e 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -131,9 +131,9 @@ namespace Umbraco.Web InstallHelper insHelper = new InstallHelper(UmbracoContext.Current); insHelper.DeleteLegacyInstaller(); - // Tell .net 4.5 that we also want to try connecting over TLS 1.2, not just 1.1 - if (ServicePointManager.SecurityProtocol.HasFlag(SecurityProtocolType.Tls12) == false) - ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12; + // Tell .NET 4.5 that we also want to try connecting over TLS 1.2, not just TLS 1.1 (but only if specific protocols are defined) + if (ServicePointManager.SecurityProtocol != 0) + ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; return this; } From a2f0ad67ab904b52ea06ba14b5016bb96d39bb60 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 24 Jan 2019 22:52:45 +0100 Subject: [PATCH 52/76] Fix the flickering tooltip --- .../src/less/components/tooltip/umb-tooltip.less | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web.UI.Client/src/less/components/tooltip/umb-tooltip.less b/src/Umbraco.Web.UI.Client/src/less/components/tooltip/umb-tooltip.less index 6528c2120e..77eba94b6d 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/tooltip/umb-tooltip.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/tooltip/umb-tooltip.less @@ -10,4 +10,5 @@ animation-timing-function: ease-in; animation: fadeIn; margin-top: 15px; + pointer-events: none; } From 0194ccdad78a23fbca989f632128c0e5c977a33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Thu, 24 Jan 2019 11:58:08 +0100 Subject: [PATCH 53/76] corrected on-edit method for MultiUrlPicker, Fixes #4171 --- .../views/propertyeditors/multiurlpicker/multiurlpicker.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.html index ca79c7faa0..0d1c736438 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/multiurlpicker/multiurlpicker.html @@ -13,7 +13,7 @@ allow-remove="true" allow-edit="true" on-remove="remove($index)" - on-edit="openContentEditor(link, $index)"> + on-edit="openLinkPicker(link, $index)"> From a4c5b7118df15b0017bdc288d0f9e68ecaff1d0a Mon Sep 17 00:00:00 2001 From: Nathan Woulfe Date: Sat, 26 Jan 2019 20:50:19 +1000 Subject: [PATCH 54/76] check for editorstate.current before attempting to access properties object --- .../src/views/propertyeditors/rte/rte.controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index 212db4fc31..2b81521ca9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -278,7 +278,7 @@ angular.module("umbraco") $scope.linkPickerOverlay = { view: "linkpicker", currentTarget: currentTarget, - anchors: tinyMceService.getAnchorNames(JSON.stringify(editorState.current.properties)), + anchors: editorState.current ? tinyMceService.getAnchorNames(JSON.stringify(editorState.current.properties)) : [], show: true, submit: function(model) { tinyMceService.insertLinkInEditor(editor, model.target, anchorElement); From 35a6d721eeb40d0c250532525e6793ff312db381 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sat, 26 Jan 2019 13:03:21 +0100 Subject: [PATCH 55/76] Make sure to inform the content editor of an app change when split view is opened --- .../components/content/umbvariantcontenteditors.directive.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js index 99d6b939e0..af07925021 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js @@ -232,6 +232,10 @@ var app = editor.content.apps[i]; if (app.alias === "umbContent") { app.active = true; + // tell the world that the app has changed (but do it only once) + if (e === 0) { + selectApp(app); + } } else { app.active = false; From 9f2477ad75b1a637ae5752650c8044031eccd36a Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 24 Jan 2019 23:14:55 +0100 Subject: [PATCH 56/76] Remove the hover underline from grid items --- .../src/less/components/umb-content-grid.less | 2 +- .../src/views/components/umb-content-grid.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-content-grid.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-content-grid.less index 63a0856c84..399a367dc5 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-content-grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-content-grid.less @@ -53,7 +53,7 @@ display: inline-flex; } -.umb-content-grid__item-name:hover { +.umb-content-grid__item-name:hover span { text-decoration: underline; } diff --git a/src/Umbraco.Web.UI.Client/src/views/components/umb-content-grid.html b/src/Umbraco.Web.UI.Client/src/views/components/umb-content-grid.html index 760597fcab..490c94a79d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/umb-content-grid.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/umb-content-grid.html @@ -12,7 +12,7 @@
    - {{ item.name }} + {{ item.name }}
      From 54bb3384b232df89e91bfba61603699935890f7b Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 24 Jan 2019 13:19:41 +0100 Subject: [PATCH 57/76] Add "time" and "bigint" to value types --- .../src/views/prevalueeditors/valuetype.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/valuetype.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/valuetype.html index 4146ba0763..739ef11226 100644 --- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/valuetype.html +++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/valuetype.html @@ -2,6 +2,8 @@ + + From 57fb9888a2c6d13358699dd854d73832d3c1ebe8 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 23 Jan 2019 22:56:00 +0100 Subject: [PATCH 58/76] Add localization to Flatpickr --- .../gulp/tasks/dependencies.js | 3 ++- .../components/umbflatpickr.directive.js | 25 +++++++++++++------ .../resources/javascriptlibrary.resource.js | 12 ++++----- .../src/common/services/assets.service.js | 25 ++++++++++++------- .../Editors/BackOfficeAssetsController.cs | 19 +++++++++++--- .../Editors/BackOfficeServerVariables.cs | 2 +- src/Umbraco.Web/UI/JavaScript/JsInitialize.js | 1 + 7 files changed, 58 insertions(+), 29 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js index e9ada635e5..819c804a4f 100644 --- a/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js +++ b/src/Umbraco.Web.UI.Client/gulp/tasks/dependencies.js @@ -141,7 +141,8 @@ gulp.task('dependencies', function () { "name": "flatpickr", "src": [ "./node_modules/flatpickr/dist/flatpickr.js", - "./node_modules/flatpickr/dist/flatpickr.css" + "./node_modules/flatpickr/dist/flatpickr.css", + "./node_modules/flatpickr/dist/l10n/*.js" ], "base": "./node_modules/flatpickr/dist" }, diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbflatpickr.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbflatpickr.directive.js index 1f396ab6c2..79b29b407b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbflatpickr.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbflatpickr.directive.js @@ -92,20 +92,25 @@ Use this directive to render a date time picker } }; - function umbFlatpickrCtrl($element, $timeout, $scope, assetsService) { + function umbFlatpickrCtrl($element, $timeout, $scope, assetsService, userService) { var ctrl = this; var loaded = false; + var userLocale = null; ctrl.$onInit = function() { // load css file for the date picker - assetsService.loadCss('lib/flatpickr/flatpickr.css', $scope); + assetsService.loadCss('lib/flatpickr/flatpickr.css', $scope).then(function () { + userService.getCurrentUser().then(function (user) { + // init date picker + userLocale = user.locale; + if (userLocale.indexOf('-') > -1) { + userLocale = userLocale.split('-')[0]; + } + loaded = true; + grabElementAndRunFlatpickr(); - // load the js file for the date picker - assetsService.loadJs('lib/flatpickr/flatpickr.js', $scope).then(function () { - // init date picker - loaded = true; - grabElementAndRunFlatpickr(); + }); }); }; @@ -128,6 +133,10 @@ Use this directive to render a date time picker setUpCallbacks(); + if (!ctrl.options.locale) { + ctrl.options.locale = userLocale; + } + var fpInstance = new fpLib(element, ctrl.options); if (ctrl.onSetup) { @@ -228,4 +237,4 @@ Use this directive to render a date time picker angular.module('umbraco.directives').component('umbFlatpickr', umbFlatpickr); -})(); \ No newline at end of file +})(); diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/javascriptlibrary.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/javascriptlibrary.resource.js index fbd54433d7..15460a3356 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/javascriptlibrary.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/javascriptlibrary.resource.js @@ -8,17 +8,17 @@ **/ function javascriptLibraryResource($q, $http, umbRequestHelper) { - var existingLocales = []; + var existingLocales = null; - function getSupportedLocalesForMoment() { + function getSupportedLocales() { var deferred = $q.defer(); - if (existingLocales.length === 0) { + if (existingLocales === null) { umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "backOfficeAssetsApiBaseUrl", - "GetSupportedMomentLocales")), + "GetSupportedLocales")), "Failed to get cultures").then(function(locales) { existingLocales = locales; deferred.resolve(existingLocales); @@ -29,9 +29,9 @@ return deferred.promise; } - + var service = { - getSupportedLocalesForMoment: getSupportedLocalesForMoment + getSupportedLocales: getSupportedLocales }; return service; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/assets.service.js b/src/Umbraco.Web.UI.Client/src/common/services/assets.service.js index 27e055a7d3..81e439a9bb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/assets.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/assets.service.js @@ -66,20 +66,26 @@ angular.module('umbraco.services') } function getMomentLocales(locales, supportedLocales) { + return getLocales(locales, supportedLocales, 'lib/moment/'); + } + function getFlatpickrLocales(locales, supportedLocales) { + return getLocales(locales, supportedLocales, 'lib/flatpickr/l10n/'); + } + + function getLocales(locales, supportedLocales, path) { var localeUrls = []; var locales = locales.split(','); for (var i = 0; i < locales.length; i++) { var locale = locales[i].toString().toLowerCase(); if (locale !== 'en-us') { - if (supportedLocales.indexOf(locale + '.js') > -1) { - localeUrls.push('lib/moment/' + locale + '.js'); + localeUrls.push(path + locale + '.js'); } if (locale.indexOf('-') > -1) { var majorLocale = locale.split('-')[0] + '.js'; if (supportedLocales.indexOf(majorLocale) > -1) { - localeUrls.push('lib/moment/' + majorLocale); + localeUrls.push(path + majorLocale); } } } @@ -89,12 +95,13 @@ angular.module('umbraco.services') } /** - * Loads specific Moment.js Locales. + * Loads specific Moment.js and Flatpickr Locales. * @param {any} locales * @param {any} supportedLocales */ function loadLocales(locales, supportedLocales) { - var localeUrls = getMomentLocales(locales, supportedLocales); + var localeUrls = getMomentLocales(locales, supportedLocales.moment); + localeUrls = localeUrls.concat(getFlatpickrLocales(locales, supportedLocales.flatpickr)); if (localeUrls.length >= 1) { return service.load(localeUrls, $rootScope); } @@ -104,12 +111,12 @@ angular.module('umbraco.services') } /** - * Loads in moment.js requirements during the _loadInitAssets call + * Loads in locale requirements during the _loadInitAssets call */ - function loadMomentLocaleForCurrentUser() { + function loadLocaleForCurrentUser() { userService.getCurrentUser().then(function (currentUser) { - return javascriptLibraryResource.getSupportedLocalesForMoment().then(function (supportedLocales) { + return javascriptLibraryResource.getSupportedLocales().then(function (supportedLocales) { return loadLocales(currentUser.locale, supportedLocales); }); }); @@ -141,7 +148,7 @@ angular.module('umbraco.services') var self = this; return self.loadJs(umbRequestHelper.getApiUrl("serverVarsJs", "", ""), $rootScope).then(function () { initAssetsLoaded = true; - return loadMomentLocaleForCurrentUser(); + return loadLocaleForCurrentUser(); }); } else { diff --git a/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs b/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs index cb23e88c9b..71aeb73d15 100644 --- a/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeAssetsController.cs @@ -11,16 +11,27 @@ namespace Umbraco.Web.Editors public class BackOfficeAssetsController : UmbracoAuthorizedJsonController { private readonly IFileSystem _jsLibFileSystem = new PhysicalFileSystem(SystemDirectories.Umbraco + IOHelper.DirSepChar + "lib"); - + [HttpGet] - public IEnumerable GetSupportedMomentLocales() + public object GetSupportedLocales() { const string momentLocaleFolder = "moment"; - var cultures = _jsLibFileSystem.GetFiles(momentLocaleFolder, "*.js").ToList(); + const string flatpickrLocaleFolder = "flatpickr/l10n"; + + return new + { + moment = GetLocales(momentLocaleFolder), + flatpickr = GetLocales(flatpickrLocaleFolder) + }; + } + + private IEnumerable GetLocales(string path) + { + var cultures = _jsLibFileSystem.GetFiles(path, "*.js").ToList(); for (var i = 0; i < cultures.Count; i++) { cultures[i] = cultures[i] - .Substring(cultures[i].IndexOf(momentLocaleFolder, StringComparison.Ordinal) + momentLocaleFolder.Length + 1); + .Substring(cultures[i].IndexOf(path, StringComparison.Ordinal) + path.Length + 1); } return cultures; } diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 1d4113bb7d..66289a3c7c 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -302,7 +302,7 @@ namespace Umbraco.Web.Editors }, { "backOfficeAssetsApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( - controller => controller.GetSupportedMomentLocales()) + controller => controller.GetSupportedLocales()) }, { "languageApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl( diff --git a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js index 62d294ee6f..1ef6e74dfe 100644 --- a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js +++ b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js @@ -7,6 +7,7 @@ 'lib/underscore/underscore-min.js', 'lib/moment/moment.min.js', + 'lib/flatpickr/flatpickr.js', 'lib/animejs/anime.min.js', From b709ed4aa3d1b1aec21df204438f56b79bd7e6f3 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 23 Jan 2019 12:13:55 +0100 Subject: [PATCH 59/76] Don't attempt to resolve URLs for element types --- src/Umbraco.Web/Models/Mapping/ContentUrlResolver.cs | 5 +++++ src/Umbraco.Web/Routing/UrlProvider.cs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Models/Mapping/ContentUrlResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentUrlResolver.cs index dd235bda75..f09638330b 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentUrlResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentUrlResolver.cs @@ -35,6 +35,11 @@ namespace Umbraco.Web.Models.Mapping public UrlInfo[] Resolve(IContent source, ContentItemDisplay destination, UrlInfo[] destMember, ResolutionContext context) { + if (source.ContentType.IsElement) + { + return new UrlInfo[0]; + } + var umbracoContext = _umbracoContextAccessor.UmbracoContext; var urls = umbracoContext == null diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index 7ed530093c..4dd4820d26 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -185,7 +185,7 @@ namespace Umbraco.Web.Routing /// public string GetUrl(IPublishedContent content, UrlProviderMode mode, string culture = null, Uri current = null) { - if (content == null) + if (content == null || content.ItemType == PublishedItemType.Element) return "#"; // this the ONLY place where we deal with default culture - IUrlProvider always receive a culture From 19554095821038ffd45650d61042cfef25356894 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 23 Jan 2019 07:45:39 +0100 Subject: [PATCH 60/76] Don't allow creation of element types in the content tree --- src/Umbraco.Web/Editors/ContentTypeController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index b59e17d9e1..d5a72a7378 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -413,7 +413,7 @@ namespace Umbraco.Web.Editors types = Services.ContentTypeService.GetAll(ids).ToList(); } - var basics = types.Select(Mapper.Map).ToList(); + var basics = types.Where(type => type.IsElement == false).Select(Mapper.Map).ToList(); var localizedTextService = Services.TextService; foreach (var basic in basics) From ae25e4564ea320faa37ccabc0f7835447540a363 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 27 Jan 2019 10:26:20 +0100 Subject: [PATCH 61/76] Fix the tests --- .../Web/HealthChecks/HealthCheckResultsTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Tests/Web/HealthChecks/HealthCheckResultsTests.cs b/src/Umbraco.Tests/Web/HealthChecks/HealthCheckResultsTests.cs index 9247cb92a0..39a9ca6211 100644 --- a/src/Umbraco.Tests/Web/HealthChecks/HealthCheckResultsTests.cs +++ b/src/Umbraco.Tests/Web/HealthChecks/HealthCheckResultsTests.cs @@ -84,8 +84,8 @@ namespace Umbraco.Tests.Web.HealthChecks Assert.IsTrue(results.AllChecksSuccessful); var resultAsMarkdown = results.ResultsAsMarkDown(HealthCheckNotificationVerbosity.Summary); - Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed succesfully.") > -1); - Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 2' all completed succesfully.") > -1); + Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed successfully.") > -1); + Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 2' all completed successfully.") > -1); } [Test] @@ -101,7 +101,7 @@ namespace Umbraco.Tests.Web.HealthChecks Assert.IsFalse(results.AllChecksSuccessful); var resultAsMarkdown = results.ResultsAsMarkDown(HealthCheckNotificationVerbosity.Summary); - Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed succesfully.") > -1); + Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed successfully.") > -1); Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 2' completed with errors.") > -1); } @@ -119,7 +119,7 @@ namespace Umbraco.Tests.Web.HealthChecks Assert.IsFalse(results.AllChecksSuccessful); var resultAsMarkdown = results.ResultsAsMarkDown(HealthCheckNotificationVerbosity.Summary); - Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed succesfully.") > -1); + Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 1' all completed successfully.") > -1); Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 2' completed with errors.") > -1); Assert.IsTrue(resultAsMarkdown.IndexOf("Checks for 'Stub check 3' completed with errors.") > -1); } From df20feb70395a31addc6bb3e31493d2cf29e427b Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 8 Jan 2019 10:31:44 +0100 Subject: [PATCH 62/76] Make cache properties on PublishedContentRequest public --- src/Umbraco.Web/Routing/PublishedContentRequest.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Routing/PublishedContentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs index 3598d5ff8d..ef55b51767 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -613,13 +613,13 @@ namespace Umbraco.Web.Routing // Note: we used to set a default value here but that would then be the default // for ALL requests, we shouldn't overwrite it though if people are using [OutputCache] for example // see: https://our.umbraco.com/forum/using-umbraco-and-getting-started/79715-output-cache-in-umbraco-752 - internal HttpCacheability Cacheability { get; set; } + public HttpCacheability Cacheability { get; set; } /// /// Gets or sets a list of Extensions to append to the Response.Cache object /// private List _cacheExtensions = new List(); - internal List CacheExtensions + public List CacheExtensions { get { return _cacheExtensions; } set { _cacheExtensions = value; } @@ -629,7 +629,7 @@ namespace Umbraco.Web.Routing /// Gets or sets a dictionary of Headers to append to the Response object ///
    private Dictionary _headers = new Dictionary(); - internal Dictionary Headers + public Dictionary Headers { get { return _headers; } set { _headers = value; } @@ -640,4 +640,4 @@ namespace Umbraco.Web.Routing ///
    public bool IgnorePublishedContentCollisions { get; set; } } -} \ No newline at end of file +} From d31e25281d4d5f3ec0e8ba859096c9d3aa13f016 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Sat, 26 Jan 2019 19:01:30 +0100 Subject: [PATCH 63/76] Fix infinite loop when saving multiple variants using list view --- .../common/directives/components/content/edit.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js index 60d44abfa5..79701414f7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/edit.controller.js @@ -305,8 +305,8 @@ var fieldControl = item.control; var fieldErrorKeys = item.errorKeys; - for (var i = 0; i < fieldErrorKeys.length; i++) { - fieldControl.$setValidity(fieldErrorKeys[i], false); + for (var j = 0; j < fieldErrorKeys.length; j++) { + fieldControl.$setValidity(fieldErrorKeys[j], false); } } } From 193e24afd256b2994a0900c0e9739f3f3466c036 Mon Sep 17 00:00:00 2001 From: Chris Houston Date: Sun, 27 Jan 2019 01:17:32 -0500 Subject: [PATCH 64/76] Fixing all the TODO, FIXME & HACK comments so they all follow the same layout. --- build/NuSpecs/UmbracoCms.nuspec | 2 +- build/build.ps1 | 4 +-- src/Umbraco.Core/Cache/CacheKeys.cs | 2 +- src/Umbraco.Core/Cache/HttpRequestAppCache.cs | 2 +- .../Components/RelateOnCopyComponent.cs | 2 +- src/Umbraco.Core/Composing/TypeFinder.cs | 2 +- src/Umbraco.Core/Composing/TypeHelper.cs | 2 +- .../Configuration/Grid/GridEditorsConfig.cs | 2 +- .../UmbracoSettings/TourConfigElement.cs | 4 +-- .../Configuration/UmbracoVersion.cs | 4 +-- src/Umbraco.Core/Constants-Applications.cs | 2 +- src/Umbraco.Core/EmailSender.cs | 2 +- .../Events/ImportPackageEventArgs.cs | 2 +- src/Umbraco.Core/IO/FileSystemExtensions.cs | 2 +- src/Umbraco.Core/IO/IOHelper.cs | 3 +- src/Umbraco.Core/IO/PhysicalFileSystem.cs | 2 +- src/Umbraco.Core/Media/Result.cs | 2 +- .../Migrations/Install/DatabaseDataCreator.cs | 2 +- .../Models/ContentScheduleCollection.cs | 6 ++-- .../Models/ContentTypeBaseExtensions.cs | 2 +- src/Umbraco.Core/Models/GridValue.cs | 2 +- src/Umbraco.Core/Models/Member.cs | 12 ++++---- src/Umbraco.Core/Models/MemberType.cs | 2 +- .../Membership/UmbracoMembershipMember.cs | 2 +- src/Umbraco.Core/Models/Membership/User.cs | 2 +- .../Models/Packaging/PreInstallWarnings.cs | 2 +- src/Umbraco.Core/Models/Property.cs | 4 +-- .../Models/PropertyGroupCollection.cs | 2 +- .../Models/PropertyTypeCollection.cs | 4 +-- src/Umbraco.Core/Models/UserExtensions.cs | 2 +- src/Umbraco.Core/ObjectExtensions.cs | 4 +-- .../Packaging/PackageDataInstallation.cs | 4 +-- .../Packaging/PackageFileInstallation.cs | 2 +- .../Packaging/PackagesRepository.cs | 2 +- src/Umbraco.Core/Persistence/Dtos/LogDto.cs | 4 +-- .../Persistence/Dtos/MemberTypeReadOnlyDto.cs | 4 +-- .../Persistence/EntityNotFoundException.cs | 2 +- .../Querying/ExpressionVisitorBase.cs | 4 +-- .../Querying/ModelToSqlExpressionVisitor.cs | 2 +- .../Implement/ContentTypeRepositoryBase.cs | 14 +++++----- .../Implement/DataTypeRepository.cs | 4 +-- .../Implement/DomainRepository.cs | 2 +- .../Implement/MemberRepository.cs | 2 +- .../Implement/RepositoryBaseOfTIdTEntity.cs | 2 +- .../Repositories/Implement/TagRepository.cs | 3 +- .../Implement/TemplateRepository.cs | 20 ++++++------- .../Implement/UserGroupRepository.cs | 4 +-- .../Repositories/Implement/UserRepository.cs | 8 +++--- .../SqlSyntax/SqlSyntaxProviderBase.cs | 2 +- .../Validators/DelimitedValueValidator.cs | 2 +- .../ValueConverters/JsonValueConverter.cs | 2 +- .../Runtime/CoreRuntimeComposer.cs | 2 +- src/Umbraco.Core/Scoping/ScopeContext.cs | 2 +- .../Security/BackOfficeUserStore.cs | 8 +++--- .../Security/MembershipProviderExtensions.cs | 2 +- ...erAwareMembershipProviderPasswordHasher.cs | 4 +-- .../Services/Implement/AuditService.cs | 4 +-- .../Services/Implement/ContentService.cs | 9 +++--- ...peServiceBaseOfTRepositoryTItemTService.cs | 10 +++---- .../Services/Implement/DataTypeService.cs | 6 ++-- .../Services/Implement/FileService.cs | 2 +- .../Implement/LocalizedTextService.cs | 6 ++-- .../LocalizedTextServiceFileSources.cs | 8 +++--- .../Services/Implement/MediaService.cs | 5 ++-- .../Services/Implement/MemberService.cs | 10 +++---- .../Services/Implement/NotificationService.cs | 2 +- .../Services/Implement/UserService.cs | 4 +-- .../Services/OperationResultType.cs | 2 +- .../Strings/IUrlSegmentProvider.cs | 2 +- src/Umbraco.Core/Sync/IServerAddress.cs | 2 +- src/Umbraco.Core/TypeExtensions.cs | 2 +- src/Umbraco.Core/UdiEntityType.cs | 2 +- .../Xml/UmbracoXPathPathSyntaxParser.cs | 4 +-- .../Xml/XPath/INavigableContent.cs | 2 +- src/Umbraco.Examine/ContentValueSetBuilder.cs | 2 +- src/Umbraco.Examine/ExamineExtensions.cs | 2 +- .../BulkInsertBenchmarks.cs | 2 +- .../Cache/DistributedCacheBinderTests.cs | 2 +- .../Clr/ReflectionUtilitiesTests.cs | 4 +-- .../Components/ComponentTests.cs | 4 +-- .../Composing/ContainerConformingTests.cs | 5 ++-- src/Umbraco.Tests/CoreThings/UdiTests.cs | 2 +- .../FrontEnd/UmbracoHelperTests.cs | 2 +- src/Umbraco.Tests/IO/FileSystemsTests.cs | 2 +- src/Umbraco.Tests/Logging/LogviewerTests.cs | 2 +- .../Manifest/ManifestParserTests.cs | 6 ++-- .../Membership/MembershipProviderBaseTests.cs | 3 +- src/Umbraco.Tests/Misc/UriUtilityTests.cs | 2 +- src/Umbraco.Tests/Models/LightEntityTest.cs | 2 +- .../Mapping/ContentTypeModelMappingTests.cs | 22 +++++++-------- .../Models/Mapping/UserModelMapperTests.cs | 2 +- .../CreatedPackagesRepositoryTests.cs | 4 +-- .../Packaging/PackageInstallationTest.cs | 2 +- .../Persistence/DatabaseContextTests.cs | 2 +- .../NPocoTests/NPocoBulkInsertTests.cs | 2 +- .../Persistence/NPocoTests/NPocoFetchTests.cs | 2 +- .../NPocoTests/PetaPocoCachesTest.cs | 2 +- .../Repositories/ContentTypeRepositoryTest.cs | 2 +- .../PublicAccessRepositoryTest.cs | 2 +- .../RedirectUrlRepositoryTests.cs | 4 +-- .../Repositories/TagRepositoryTest.cs | 2 +- .../Repositories/UserRepositoryTest.cs | 3 +- .../PublishedContentLanguageVariantTests.cs | 2 +- .../PublishedContentTestBase.cs | 2 +- .../Publishing/PublishingStrategyTests.cs | 2 +- .../Routing/ContentFinderByAliasTests.cs | 2 +- .../ContentFinderByPageIdQueryTests.cs | 6 ++-- .../Routing/ContentFinderByUrlTests.cs | 2 +- .../Routing/GetContentUrlsTests.cs | 10 +++---- .../Routing/RenderRouteHandlerTests.cs | 4 +-- src/Umbraco.Tests/Routing/RoutesCacheTests.cs | 2 +- .../Routing/UmbracoModuleTests.cs | 4 +-- .../Runtimes/CoreRuntimeTests.cs | 2 +- src/Umbraco.Tests/Runtimes/StandaloneTests.cs | 8 +++--- .../PassThroughEventDispatcherTests.cs | 2 +- .../Scoping/ScopedNuCacheTests.cs | 2 +- .../Scoping/ScopedRepositoryTests.cs | 2 +- src/Umbraco.Tests/Scoping/ScopedXmlTests.cs | 2 +- .../Security/BackOfficeCookieManagerTests.cs | 2 +- .../Services/ContentServiceTagsTests.cs | 10 +++---- .../Services/ContentServiceTests.cs | 18 ++++++------ .../Services/MemberServiceTests.cs | 2 +- .../Services/PerformanceTests.cs | 2 +- .../Services/SectionServiceTests.cs | 2 +- .../Strings/DefaultShortStringHelperTests.cs | 10 +++---- .../TestControllerActivatorBase.cs | 2 +- .../ControllerTesting/TestStartup.cs | 2 +- .../TestHelpers/SettingsForTests.cs | 2 +- src/Umbraco.Tests/TestHelpers/TestHelper.cs | 2 +- .../TestHelpers/TestObjects-Mocks.cs | 6 ++-- src/Umbraco.Tests/TestHelpers/TestObjects.cs | 6 ++-- .../TestHelpers/TestWithDatabaseBase.cs | 12 ++++---- .../Testing/UmbracoTestAttribute.cs | 3 +- src/Umbraco.Tests/Testing/UmbracoTestBase.cs | 4 +-- .../ExamineDemoDataContentService.cs | 2 +- .../ExamineDemoDataMediaService.cs | 2 +- .../Web/Controllers/ContentControllerTests.cs | 2 +- .../Web/TemplateUtilitiesTests.cs | 4 +-- .../lib/bootstrap/less/forms.less | 2 +- .../lib/umbraco/LegacySpeechBubble.js | 2 +- .../application/umblogin.directive.js | 6 ++-- .../components/buttons/umbbutton.directive.js | 2 +- .../umbvariantcontenteditors.directive.js | 6 ++-- .../editor/umbeditorcontainer.directive.js | 2 +- .../components/grid/grid.rte.directive.js | 6 ++-- .../imaging/umbimagegravity.directive.js | 2 +- .../overlays/umboverlaybackdrop.directive.js | 2 +- .../components/tree/umbtree.directive.js | 6 ++-- .../components/tree/umbtreeitem.directive.js | 2 +- .../components/umbgroupsbuilder.directive.js | 4 +-- .../upload/umbpropertyfileupload.directive.js | 2 +- .../users/changepassword.directive.js | 2 +- .../validation/valpropertymsg.directive.js | 4 +-- .../validation/valsubview.directive.js | 2 +- .../common/mocks/resources/dashboard.mocks.js | 2 +- .../src/common/resources/auth.resource.js | 2 +- .../src/common/services/appstate.service.js | 2 +- .../services/contenteditinghelper.service.js | 4 +-- .../src/common/services/formhelper.service.js | 2 +- .../src/common/services/iconhelper.service.js | 2 +- .../common/services/localization.service.js | 2 +- .../common/services/mediahelper.service.js | 2 +- .../services/mediatypehelper.service.js | 2 +- .../src/common/services/search.service.js | 2 +- .../src/common/services/tinymce.service.js | 4 +-- .../src/common/services/tour.service.js | 2 +- .../services/umbdataformatter.service.js | 2 +- .../services/umbrequesthelper.service.js | 6 ++-- .../src/controllers/navigation.controller.js | 12 ++++---- .../src/installer/installer.controller.js | 2 +- .../src/less/components/tree/umb-tree.less | 2 +- .../src/less/components/umb-grid.less | 2 +- src/Umbraco.Web.UI.Client/src/less/forms.less | 2 +- .../treepicker/treepicker.controller.js | 4 +-- .../apps/content/content.controller.js | 2 +- .../content/content.delete.controller.js | 2 +- .../content/overlays/publish.controller.js | 2 +- .../overlays/publishdescendants.controller.js | 2 +- .../content/overlays/schedule.controller.js | 2 +- .../contentblueprints/delete.controller.js | 2 +- .../content/redirecturls.controller.js | 9 +++--- .../settings/examinemanagement.controller.js | 6 ++-- .../src/views/datatypes/create.controller.js | 2 +- .../datatypes/datatype.delete.controller.js | 4 +-- .../views/documenttypes/delete.controller.js | 4 +-- .../views/media/media.delete.controller.js | 2 +- .../src/views/mediatypes/delete.controller.js | 4 +-- .../views/membergroups/delete.controller.js | 2 +- .../views/membertypes/create.controller.js | 2 +- .../views/membertypes/delete.controller.js | 2 +- .../partialviewmacros/delete.controller.js | 2 +- .../views/partialviews/delete.controller.js | 2 +- .../colorpicker/colorpicker.controller.js | 4 +-- .../listview/listview.controller.js | 2 +- .../markdowneditor.controller.js | 2 +- .../nestedcontent/nestedcontent.controller.js | 4 +-- .../rte/codeeditor.controller.js | 2 +- .../propertyeditors/rte/rte.controller.js | 2 +- .../src/views/scripts/delete.controller.js | 2 +- .../src/views/scripts/edit.controller.js | 2 +- .../src/views/stylesheets/edit.controller.js | 2 +- .../src/views/templates/delete.controller.js | 2 +- .../src/views/templates/edit.controller.js | 2 +- .../template-editor-controller.spec.js | 2 +- .../unit/common/directives/val-email.spec.js | 2 +- .../server-validation-manager.spec.js | 2 +- .../Actions/ActionChangeDocType.cs | 2 +- .../Cache/ContentCacheRefresher.cs | 2 +- .../Cache/DataTypeCacheRefresher.cs | 2 +- .../Cache/DistributedCacheBinder.cs | 2 +- .../Cache/DistributedCacheBinder_Handlers.cs | 10 +++---- .../Composing/Composers/InstallerComposer.cs | 2 +- src/Umbraco.Web/Composing/Current.cs | 2 +- .../Controllers/UmbRegisterController.cs | 2 +- .../Editors/BackOfficeController.cs | 2 +- .../Editors/BackOfficeServerVariables.cs | 10 +++---- .../Binders/ContentModelBinderHelper.cs | 2 +- .../Editors/Binders/MemberBinder.cs | 2 +- src/Umbraco.Web/Editors/CodeFileController.cs | 2 +- src/Umbraco.Web/Editors/ContentController.cs | 18 ++++++------ .../Editors/ContentControllerBase.cs | 2 +- .../Editors/ContentTypeController.cs | 2 +- .../Editors/CurrentUserController.cs | 2 +- src/Umbraco.Web/Editors/DashboardSecurity.cs | 2 +- src/Umbraco.Web/Editors/DataTypeController.cs | 2 +- src/Umbraco.Web/Editors/EditorValidator.cs | 2 +- src/Umbraco.Web/Editors/EntityController.cs | 12 ++++---- .../Filters/ContentItemValidationHelper.cs | 2 +- .../Filters/ContentSaveValidationAttribute.cs | 2 +- .../Filters/UserGroupValidateAttribute.cs | 4 +-- src/Umbraco.Web/Editors/MediaController.cs | 2 +- .../Editors/MediaTypeController.cs | 2 +- src/Umbraco.Web/Editors/MemberController.cs | 28 +++++++++---------- .../Checks/Config/ConfigurationService.cs | 2 +- src/Umbraco.Web/HealthCheck/HealthCheck.cs | 2 +- .../HealthCheck/HealthCheckAttribute.cs | 2 +- .../HealthCheck/HealthCheckResults.cs | 2 +- .../HealthCheck/HealthCheckStatus.cs | 2 +- .../Controllers/InstallApiController.cs | 2 +- .../Install/InstallStepCollection.cs | 4 +-- .../Install/InstallSteps/NewInstallStep.cs | 2 +- .../InstallSteps/StarterKitCleanupStep.cs | 2 +- .../Install/InstallSteps/UpgradeStep.cs | 4 +-- .../Install/Models/InstallPackageModel.cs | 2 +- .../EmbedProviders/AbstractOEmbedProvider.cs | 2 +- .../MembershipProviderExtensions.cs | 2 +- .../Models/ContentEditing/MemberSave.cs | 2 +- .../UserGroupPermissionsSave.cs | 2 +- .../Models/Mapping/ActionButtonsResolver.cs | 2 +- .../ContentPropertyDisplayConverter.cs | 2 +- .../Mapping/ContentTypeBasicResolver.cs | 2 +- .../Mapping/ContentTypeProfileExtensions.cs | 8 +++--- .../Models/Mapping/DatabaseTypeResolver.cs | 2 +- .../Models/Mapping/EntityMapperProfile.cs | 4 +-- .../Models/Mapping/MacroMapperProfile.cs | 2 +- .../Models/Mapping/MemberMapperProfile.cs | 2 +- .../MemberTabsAndPropertiesResolver.cs | 2 +- .../Mapping/TabsAndPropertiesResolver.cs | 2 +- .../PublishedValueFallback.cs | 3 +- .../Models/PublishedContentBase.cs | 8 +++--- src/Umbraco.Web/Models/PublishedProperty.cs | 2 +- src/Umbraco.Web/Models/Trees/MenuItem.cs | 2 +- src/Umbraco.Web/Models/UmbracoProperty.cs | 2 +- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 2 +- .../Mvc/UmbracoViewPageOfTModel.cs | 3 +- .../Mvc/UmbracoVirtualNodeRouteHandler.cs | 4 +-- .../FileUploadPropertyValueEditor.cs | 2 +- .../PropertyEditors/GridConfiguration.cs | 4 +-- .../GridPropertyIndexValueFactory.cs | 2 +- .../ImageCropperPropertyEditor.cs | 2 +- .../ImageCropperPropertyValueEditor.cs | 4 +-- .../PropertyEditors/ListViewConfiguration.cs | 6 ++-- .../MacroContainerPropertyEditor.cs | 2 +- .../MultipleTextStringConfigurationEditor.cs | 2 +- .../PropertyEditors/RichTextConfiguration.cs | 2 +- .../PropertyEditors/TrueFalseConfiguration.cs | 2 +- .../MultiNodeTreePickerValueConverter.cs | 2 +- .../PublishedCache/IPublishedCache.cs | 2 +- .../PublishedCache/NuCache/ContentCache.cs | 2 +- .../PublishedCache/NuCache/ContentStore.cs | 4 +-- ....DictionaryOfCultureVariationSerializer.cs | 2 +- .../NuCache/DataSource/DatabaseDataSource.cs | 2 +- .../NuCache/DataSource/PropertyData.cs | 4 +-- .../NuCache/PublishedSnapshotService.cs | 8 +++--- .../PublishedCache/PublishedMember.cs | 4 +-- .../XmlPublishedCache/PublishedMediaCache.cs | 6 ++-- .../XmlPublishedCache/SafeXmlReaderWriter.cs | 2 +- .../XmlPublishedCache/XmlPublishedContent.cs | 2 +- .../XmlPublishedCache/XmlStore.cs | 14 +++++----- src/Umbraco.Web/PublishedContentExtensions.cs | 4 +-- .../Routing/ContentFinderByUrlAlias.cs | 2 +- .../Routing/CustomRouteUrlProvider.cs | 2 +- src/Umbraco.Web/Routing/DomainHelper.cs | 4 +-- .../Routing/NotFoundHandlerHelper.cs | 2 +- src/Umbraco.Web/Routing/PublishedRouter.cs | 7 ++--- .../Routing/RedirectTrackingComponent.cs | 2 +- src/Umbraco.Web/Routing/SiteDomainHelper.cs | 4 +-- src/Umbraco.Web/Runtime/WebRuntimeComposer.cs | 2 +- .../Scheduling/BackgroundTaskRunnerOptions.cs | 2 +- .../Scheduling/IBackgroundTaskRunner.cs | 2 +- .../Scheduling/ScheduledPublishing.cs | 3 +- src/Umbraco.Web/Scheduling/ScheduledTasks.cs | 4 +-- src/Umbraco.Web/Search/ExamineComponent.cs | 6 ++-- .../Search/UmbracoIndexesCreator.cs | 2 +- src/Umbraco.Web/Search/UmbracoTreeSearcher.cs | 2 +- ...eDirectoryBackOfficeUserPasswordChecker.cs | 4 +-- .../Security/BackOfficeSignInManager.cs | 2 +- .../Security/BackOfficeUserManager.cs | 10 +++---- .../Security/GetUserSecondsMiddleWare.cs | 4 +-- src/Umbraco.Web/Security/MembershipHelper.cs | 10 +++---- .../Providers/UmbracoMembershipProvider.cs | 4 +-- src/Umbraco.Web/Suspendable.cs | 2 +- src/Umbraco.Web/Templates/TemplateRenderer.cs | 4 +-- .../Trees/ApplicationTreeController.cs | 2 +- .../Trees/ContentTreeController.cs | 2 +- .../Trees/ContentTreeControllerBase.cs | 4 +-- .../Trees/FileSystemTreeController.cs | 2 +- src/Umbraco.Web/Trees/FilesTreeController.cs | 2 +- src/Umbraco.Web/Trees/ITree.cs | 2 +- .../Trees/LegacyTreeDataConverter.cs | 2 +- .../Trees/ScriptsTreeController.cs | 2 +- .../Trees/StylesheetsTreeController.cs | 2 +- .../Trees/TemplatesTreeController.cs | 4 +-- src/Umbraco.Web/UI/Controls/UmbracoControl.cs | 2 +- .../UI/Controls/UmbracoUserControl.cs | 2 +- .../UI/JavaScript/Resources.Designer.cs | 2 +- .../UI/JavaScript/ServerVariables.js | 2 +- src/Umbraco.Web/UmbracoComponentRenderer.cs | 2 +- src/Umbraco.Web/UmbracoContext.cs | 2 +- src/Umbraco.Web/UmbracoHelper.cs | 4 +-- src/Umbraco.Web/UmbracoHttpHandler.cs | 2 +- .../EnableOverrideAuthorizationAttribute.cs | 2 +- ...EnsureUserPermissionForContentAttribute.cs | 4 +-- .../EnsureUserPermissionForMediaAttribute.cs | 2 +- .../OverridableAuthorizationAttribute.cs | 2 +- .../WebApi/UmbracoAuthorizeAttribute.cs | 2 +- .../PackageActions/publishRootDocument.cs | 2 +- src/Umbraco.Web/umbraco.presentation/page.cs | 2 +- 338 files changed, 573 insertions(+), 586 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index a188377c19..f642b2f4e8 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -55,7 +55,7 @@ - + diff --git a/build/build.ps1 b/build/build.ps1 index 65b4041e30..d811c2cc21 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -120,7 +120,7 @@ } finally { Pop-Location - # fixme - should we filter the log to find errors? + # FIXME: should we filter the log to find errors? #get-content .\build.tmp\belle.log | %{ if ($_ -match "build") { write $_}} # restore @@ -177,7 +177,7 @@ { Write-Host "Prepare Tests" - # fixme - idea is to avoid rebuilding everything for tests + # FIXME: - idea is to avoid rebuilding everything for tests # but because of our weird assembly versioning (with .* stuff) # everything gets rebuilt all the time... #Copy-Files "$tmp\bin" "." "$tmp\tests" diff --git a/src/Umbraco.Core/Cache/CacheKeys.cs b/src/Umbraco.Core/Cache/CacheKeys.cs index 50bd4ca0ac..e8f93d636a 100644 --- a/src/Umbraco.Core/Cache/CacheKeys.cs +++ b/src/Umbraco.Core/Cache/CacheKeys.cs @@ -7,7 +7,7 @@ { public const string ApplicationsCacheKey = "ApplicationCache"; // used by SectionService - // TODO this one can probably be removed + // TODO: this one can probably be removed public const string TemplateFrontEndCacheKey = "template"; public const string MacroContentCacheKey = "macroContent_"; // used in MacroRenderers diff --git a/src/Umbraco.Core/Cache/HttpRequestAppCache.cs b/src/Umbraco.Core/Cache/HttpRequestAppCache.cs index 0fdf70ac27..f1932f97ce 100644 --- a/src/Umbraco.Core/Cache/HttpRequestAppCache.cs +++ b/src/Umbraco.Core/Cache/HttpRequestAppCache.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Cache /// /// /// Will use HttpContext.Current. - /// TODO - https://github.com/umbraco/Umbraco-CMS/issues/4239 - use IHttpContextAccessor NOT HttpContext.Current + /// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4239 - use IHttpContextAccessor NOT HttpContext.Current /// public HttpRequestAppCache() { } diff --git a/src/Umbraco.Core/Components/RelateOnCopyComponent.cs b/src/Umbraco.Core/Components/RelateOnCopyComponent.cs index 404d385680..d38406f970 100644 --- a/src/Umbraco.Core/Components/RelateOnCopyComponent.cs +++ b/src/Umbraco.Core/Components/RelateOnCopyComponent.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Services.Implement; namespace Umbraco.Core.Components { - //TODO: This should just exist in the content service/repo! + // TODO: This should just exist in the content service/repo! public sealed class RelateOnCopyComponent : IComponent { public void Initialize() diff --git a/src/Umbraco.Core/Composing/TypeFinder.cs b/src/Umbraco.Core/Composing/TypeFinder.cs index 4086eb394b..308d0ecfd7 100644 --- a/src/Umbraco.Core/Composing/TypeFinder.cs +++ b/src/Umbraco.Core/Composing/TypeFinder.cs @@ -614,7 +614,7 @@ namespace Umbraco.Core.Composing var type = BuildManager.GetType(typeName, false); if (type != null) return type; - //TODO: This isn't very elegant, and will have issues since the AppDomain.CurrentDomain + // TODO: This isn't very elegant, and will have issues since the AppDomain.CurrentDomain // doesn't actualy load in all assemblies, only the types that have been referenced so far. // However, in a web context, the BuildManager will have executed which will force all assemblies // to be loaded so it's fine for now. diff --git a/src/Umbraco.Core/Composing/TypeHelper.cs b/src/Umbraco.Core/Composing/TypeHelper.cs index c2746bef96..2f29ee09bc 100644 --- a/src/Umbraco.Core/Composing/TypeHelper.cs +++ b/src/Umbraco.Core/Composing/TypeHelper.cs @@ -278,7 +278,7 @@ namespace Umbraco.Core.Composing #region Match Type - //TODO: Need to determine if these methods should replace/combine/merge etc with IsTypeAssignableFrom, IsAssignableFromGeneric + // TODO: Need to determine if these methods should replace/combine/merge etc with IsTypeAssignableFrom, IsAssignableFromGeneric // readings: // http://stackoverflow.com/questions/2033912/c-sharp-variance-problem-assigning-listderived-as-listbase diff --git a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs index 2862a98a0e..0e7ef62c58 100644 --- a/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs +++ b/src/Umbraco.Core/Configuration/Grid/GridEditorsConfig.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration.Grid { List GetResult() { - // TODO should use the common one somehow! + ignoring _appPlugins here! + // TODO: should use the common one somehow! + ignoring _appPlugins here! var parser = new ManifestParser(_appCaches, Current.ManifestValidators, _logger); var editors = new List(); diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs index ebb649ca3b..fb231ec0cf 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TourConfigElement.cs @@ -5,13 +5,13 @@ namespace Umbraco.Core.Configuration.UmbracoSettings internal class TourConfigElement : UmbracoConfigurationElement, ITourSection { //disabled by default so that upgraders don't get it enabled by default - //TODO: we probably just want to disable the initial one from automatically loading ? + // TODO: we probably just want to disable the initial one from automatically loading ? [ConfigurationProperty("enable", DefaultValue = false)] public bool EnableTours { get { return (bool)this["enable"]; } } - //TODO: We could have additional filters, etc... defined here + // TODO: We could have additional filters, etc... defined here } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index bc5b6993e3..7ab97500f0 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Configuration /// /// Gets the non-semantic version of the Umbraco code. /// - // TODO rename to Version + // TODO: rename to Version public static Version Current { get; } /// @@ -81,7 +81,7 @@ namespace Umbraco.Core.Configuration { try { - // TODO - https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings + // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"]; return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null; } diff --git a/src/Umbraco.Core/Constants-Applications.cs b/src/Umbraco.Core/Constants-Applications.cs index 415357aab3..2d4042fad0 100644 --- a/src/Umbraco.Core/Constants-Applications.cs +++ b/src/Umbraco.Core/Constants-Applications.cs @@ -156,7 +156,7 @@ public const string ThirdParty = "thirdPartyGroup"; } - //TODO: Fill in the rest! + // TODO: Fill in the rest! } } } diff --git a/src/Umbraco.Core/EmailSender.cs b/src/Umbraco.Core/EmailSender.cs index 1f2c6d8653..0fda5c40a4 100644 --- a/src/Umbraco.Core/EmailSender.cs +++ b/src/Umbraco.Core/EmailSender.cs @@ -17,7 +17,7 @@ namespace Umbraco.Core /// public class EmailSender : IEmailSender { - //TODO: This should encapsulate a BackgroundTaskRunner with a queue to send these emails! + // TODO: This should encapsulate a BackgroundTaskRunner with a queue to send these emails! private readonly bool _enableEvents; diff --git a/src/Umbraco.Core/Events/ImportPackageEventArgs.cs b/src/Umbraco.Core/Events/ImportPackageEventArgs.cs index 61369af59d..a044cd71b3 100644 --- a/src/Umbraco.Core/Events/ImportPackageEventArgs.cs +++ b/src/Umbraco.Core/Events/ImportPackageEventArgs.cs @@ -27,7 +27,7 @@ namespace Umbraco.Core.Events { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; - //TODO: MetaData for package metadata has no equality operators :/ + // TODO: MetaData for package metadata has no equality operators :/ return base.Equals(other) && PackageMetaData.Equals(other.PackageMetaData); } diff --git a/src/Umbraco.Core/IO/FileSystemExtensions.cs b/src/Umbraco.Core/IO/FileSystemExtensions.cs index ade2c58b38..e0f5af75c5 100644 --- a/src/Umbraco.Core/IO/FileSystemExtensions.cs +++ b/src/Umbraco.Core/IO/FileSystemExtensions.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.IO return Path.GetFileName(fs.GetFullPath(path)); } - //TODO: Currently this is the only way to do this + // TODO: Currently this is the only way to do this internal static void CreateFolder(this IFileSystem fs, string folderPath) { var path = fs.GetRelativePath(folderPath); diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 76e7631482..a92b556240 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -155,8 +155,7 @@ namespace Umbraco.Core.IO // // except that for templates, filePath actually is a virtual path - //TODO - // what's below is dirty, there are too many ways to get the root dir, etc. + // TODO: what's below is dirty, there are too many ways to get the root dir, etc. // not going to fix everything today var mappedRoot = MapPath(SystemDirectories.Root); diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index acf5e796e4..66ef095b04 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -284,7 +284,7 @@ namespace Umbraco.Core.IO var opath = path; path = EnsureDirectorySeparatorChar(path); - // fixme - this part should go! + // FIXME: this part should go! // not sure what we are doing here - so if input starts with a (back) slash, // we assume it's not a FS relative path and we try to convert it... but it // really makes little sense? diff --git a/src/Umbraco.Core/Media/Result.cs b/src/Umbraco.Core/Media/Result.cs index 82894a5ef5..a8683d03d5 100644 --- a/src/Umbraco.Core/Media/Result.cs +++ b/src/Umbraco.Core/Media/Result.cs @@ -1,7 +1,7 @@ namespace Umbraco.Core.Media { - //TODO: Could definitely have done with a better name + // TODO: Could definitely have done with a better name public class Result { public Status Status { get; set; } diff --git a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs index f32ea1cb6f..82ca5960ec 100644 --- a/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs +++ b/src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs @@ -263,7 +263,7 @@ namespace Umbraco.Core.Migrations.Install const string listLayout = "{\"name\": \"List\",\"path\": \"views/propertyeditors/listview/layouts/list/list.html\",\"icon\": \"icon-list\", \"isSystem\": 1,\"selected\": true}"; const string layouts = "[" + cardLayout + "," + listLayout + "]"; - //TODO Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors. + // TODO: Check which of the DataTypeIds below doesn't exist in umbracoNode, which results in a foreign key constraint errors. _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -49, EditorAlias = Constants.PropertyEditors.Aliases.Boolean, DbType = "Integer" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -51, EditorAlias = Constants.PropertyEditors.Aliases.Integer, DbType = "Integer" }); _database.Insert(Constants.DatabaseSchema.Tables.DataType, "pk", false, new DataTypeDto { NodeId = -87, EditorAlias = Constants.PropertyEditors.Aliases.TinyMce, DbType = "Ntext", diff --git a/src/Umbraco.Core/Models/ContentScheduleCollection.cs b/src/Umbraco.Core/Models/ContentScheduleCollection.cs index 4c06f8927d..6c7dd79312 100644 --- a/src/Umbraco.Core/Models/ContentScheduleCollection.cs +++ b/src/Umbraco.Core/Models/ContentScheduleCollection.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Models _schedule[schedule.Culture] = changes; } - //TODO: Below will throw if there are duplicate dates added, validate/return bool? + // TODO: Below will throw if there are duplicate dates added, validate/return bool? changes.Add(schedule.Date, schedule); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, schedule)); @@ -62,7 +62,7 @@ namespace Umbraco.Core.Models if (!releaseDate.HasValue && !expireDate.HasValue) return false; - //TODO: Do we allow passing in a release or expiry date that is before now? + // TODO: Do we allow passing in a release or expiry date that is before now? if (!_schedule.TryGetValue(culture, out var changes)) { @@ -70,7 +70,7 @@ namespace Umbraco.Core.Models _schedule[culture] = changes; } - //TODO: Below will throw if there are duplicate dates added, should validate/return bool? + // TODO: Below will throw if there are duplicate dates added, should validate/return bool? // but the bool won't indicate which date was in error, maybe have 2 diff methods to schedule start/end? if (releaseDate.HasValue) diff --git a/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs b/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs index adbc3de54f..51c642c20d 100644 --- a/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs +++ b/src/Umbraco.Core/Models/ContentTypeBaseExtensions.cs @@ -48,7 +48,7 @@ namespace Umbraco.Core.Models throw new Exception("oops"); // skip new properties - //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly + // TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly var isNewProperty = dirtyProperty.WasPropertyDirty("Id"); if (isNewProperty) return false; diff --git a/src/Umbraco.Core/Models/GridValue.cs b/src/Umbraco.Core/Models/GridValue.cs index 4f19576f17..157304463f 100644 --- a/src/Umbraco.Core/Models/GridValue.cs +++ b/src/Umbraco.Core/Models/GridValue.cs @@ -5,7 +5,7 @@ using Newtonsoft.Json.Linq; namespace Umbraco.Core.Models { - //TODO: Make a property value converter for this! + // TODO: Make a property value converter for this! /// /// A model representing the value saved for the grid diff --git a/src/Umbraco.Core/Models/Member.cs b/src/Umbraco.Core/Models/Member.cs index c47f68c930..0ef15ee413 100644 --- a/src/Umbraco.Core/Models/Member.cs +++ b/src/Umbraco.Core/Models/Member.cs @@ -189,7 +189,7 @@ namespace Umbraco.Core.Models [DataMember] public IEnumerable Groups { get; set; } - //TODO: When get/setting all of these properties we MUST: + // TODO: When get/setting all of these properties we MUST: // * Check if we are using the umbraco membership provider, if so then we need to use the configured fields - not the explicit fields below // * If any of the fields don't exist, what should we do? Currently it will throw an exception! @@ -338,7 +338,7 @@ namespace Umbraco.Core.Models return tryConvert.Result; } return false; - //TODO: Use TryConvertTo instead + // TODO: Use TryConvertTo instead } set { @@ -371,7 +371,7 @@ namespace Umbraco.Core.Models return tryConvert.Result; } return default(DateTime); - //TODO: Use TryConvertTo instead + // TODO: Use TryConvertTo instead } set { @@ -404,7 +404,7 @@ namespace Umbraco.Core.Models return tryConvert.Result; } return default(DateTime); - //TODO: Use TryConvertTo instead + // TODO: Use TryConvertTo instead } set { @@ -437,7 +437,7 @@ namespace Umbraco.Core.Models return tryConvert.Result; } return default(DateTime); - //TODO: Use TryConvertTo instead + // TODO: Use TryConvertTo instead } set { @@ -471,7 +471,7 @@ namespace Umbraco.Core.Models return tryConvert.Result; } return default(int); - //TODO: Use TryConvertTo instead + // TODO: Use TryConvertTo instead } set { diff --git a/src/Umbraco.Core/Models/MemberType.cs b/src/Umbraco.Core/Models/MemberType.cs index bcc7e14fd7..1ce883d9a7 100644 --- a/src/Umbraco.Core/Models/MemberType.cs +++ b/src/Umbraco.Core/Models/MemberType.cs @@ -66,7 +66,7 @@ namespace Umbraco.Core.Models // leading underscores which we don't want in this case. // see : http://issues.umbraco.org/issue/U4-3968 - //TODO: BUT, I'm pretty sure we could do this with regards to underscores now: + // TODO: BUT, I'm pretty sure we could do this with regards to underscores now: // .ToCleanString(CleanStringType.Alias | CleanStringType.UmbracoCase) // Need to ask Stephen diff --git a/src/Umbraco.Core/Models/Membership/UmbracoMembershipMember.cs b/src/Umbraco.Core/Models/Membership/UmbracoMembershipMember.cs index ed3422d4f9..debce3afe5 100644 --- a/src/Umbraco.Core/Models/Membership/UmbracoMembershipMember.cs +++ b/src/Umbraco.Core/Models/Membership/UmbracoMembershipMember.cs @@ -44,7 +44,7 @@ namespace Umbraco.Core.Models.Membership _isLockedOut = member.IsLockedOut; _creationDate = member.CreateDate.ToUniversalTime(); _lastLoginDate = member.LastLoginDate.ToUniversalTime(); - //TODO: We currently don't really have any place to store this data!! + // TODO: We currently don't really have any place to store this data!! _lastActivityDate = member.LastLoginDate.ToUniversalTime(); _lastPasswordChangedDate = member.LastPasswordChangeDate.ToUniversalTime(); _lastLockoutDate = member.LastLockoutDate.ToUniversalTime(); diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs index 5e79967a94..7832390b92 100644 --- a/src/Umbraco.Core/Models/Membership/User.cs +++ b/src/Umbraco.Core/Models/Membership/User.cs @@ -242,7 +242,7 @@ namespace Umbraco.Core.Models.Membership set { SetPropertyValueAndDetectChanges(value, ref _failedLoginAttempts, Ps.Value.FailedPasswordAttemptsSelector); } } - //TODO: Figure out how to support all of this! - we cannot have NotImplementedExceptions because these get used by the IMembershipMemberService service so + // TODO: Figure out how to support all of this! - we cannot have NotImplementedExceptions because these get used by the IMembershipMemberService service so // we'll just have them as generic get/set which don't interact with the db. [IgnoreDataMember] diff --git a/src/Umbraco.Core/Models/Packaging/PreInstallWarnings.cs b/src/Umbraco.Core/Models/Packaging/PreInstallWarnings.cs index f0acb2a46b..69c7a5641d 100644 --- a/src/Umbraco.Core/Models/Packaging/PreInstallWarnings.cs +++ b/src/Umbraco.Core/Models/Packaging/PreInstallWarnings.cs @@ -10,7 +10,7 @@ namespace Umbraco.Core.Models.Packaging public IEnumerable UnsecureFiles { get; set; } = Enumerable.Empty(); public IEnumerable FilesReplaced { get; set; } = Enumerable.Empty(); - //TODO: Shouldn't we detect other conflicting entities too ? + // TODO: Shouldn't we detect other conflicting entities too ? public IEnumerable ConflictingMacros { get; set; } = Enumerable.Empty(); public IEnumerable ConflictingTemplates { get; set; } = Enumerable.Empty(); public IEnumerable ConflictingStylesheets { get; set; } = Enumerable.Empty(); diff --git a/src/Umbraco.Core/Models/Property.cs b/src/Umbraco.Core/Models/Property.cs index f5c475908d..11b5239a70 100644 --- a/src/Umbraco.Core/Models/Property.cs +++ b/src/Umbraco.Core/Models/Property.cs @@ -55,7 +55,7 @@ namespace Umbraco.Core.Models /// public class PropertyValue { - //TODO: Either we allow change tracking at this class level, or we add some special change tracking collections to the Property + // TODO: Either we allow change tracking at this class level, or we add some special change tracking collections to the Property // class to deal with change tracking which variants have changed private string _culture; @@ -103,7 +103,7 @@ namespace Umbraco.Core.Models // ReSharper disable once ClassNeverInstantiated.Local private class PropertySelectors { - //TODO: This allows us to track changes for an entire Property, but doesn't allow us to track changes at the variant level + // TODO: This allows us to track changes for an entire Property, but doesn't allow us to track changes at the variant level public readonly PropertyInfo ValuesSelector = ExpressionHelper.GetPropertyInfo(x => x.Values); public readonly DelegateEqualityComparer PropertyValueComparer = new DelegateEqualityComparer( diff --git a/src/Umbraco.Core/Models/PropertyGroupCollection.cs b/src/Umbraco.Core/Models/PropertyGroupCollection.cs index 2e9fb6520e..26e0fef178 100644 --- a/src/Umbraco.Core/Models/PropertyGroupCollection.cs +++ b/src/Umbraco.Core/Models/PropertyGroupCollection.cs @@ -14,7 +14,7 @@ namespace Umbraco.Core.Models /// [Serializable] [DataContract] - //TODO: Change this to ObservableDictionary so we can reduce the INotifyCollectionChanged implementation details + // TODO: Change this to ObservableDictionary so we can reduce the INotifyCollectionChanged implementation details public class PropertyGroupCollection : KeyedCollection, INotifyCollectionChanged, IDeepCloneable { private readonly ReaderWriterLockSlim _addLocker = new ReaderWriterLockSlim(); diff --git a/src/Umbraco.Core/Models/PropertyTypeCollection.cs b/src/Umbraco.Core/Models/PropertyTypeCollection.cs index f39918d5af..e79015d828 100644 --- a/src/Umbraco.Core/Models/PropertyTypeCollection.cs +++ b/src/Umbraco.Core/Models/PropertyTypeCollection.cs @@ -13,7 +13,7 @@ namespace Umbraco.Core.Models /// [Serializable] [DataContract] - //TODO: Change this to ObservableDictionary so we can reduce the INotifyCollectionChanged implementation details + // TODO: Change this to ObservableDictionary so we can reduce the INotifyCollectionChanged implementation details public class PropertyTypeCollection : KeyedCollection, INotifyCollectionChanged, IDeepCloneable { [IgnoreDataMember] @@ -76,7 +76,7 @@ namespace Umbraco.Core.Models OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } - //TODO: Instead of 'new' this should explicitly implement one of the collection interfaces members + // TODO: Instead of 'new' this should explicitly implement one of the collection interfaces members internal new void Add(PropertyType item) { item.IsPublishing = IsPublishing; diff --git a/src/Umbraco.Core/Models/UserExtensions.cs b/src/Umbraco.Core/Models/UserExtensions.cs index e14d7ee2de..f9aa1113b3 100644 --- a/src/Umbraco.Core/Models/UserExtensions.cs +++ b/src/Umbraco.Core/Models/UserExtensions.cs @@ -136,7 +136,7 @@ namespace Umbraco.Core.Models try { var culture = CultureInfo.GetCultureInfo(userLanguage.Replace("_", "-")); - //TODO: This is a hack because we store the user language as 2 chars instead of the full culture + // TODO: This is a hack because we store the user language as 2 chars instead of the full culture // which is actually stored in the language files (which are also named with 2 chars!) so we need to attempt // to convert to a supported full culture var result = textService.ConvertToSupportedCultureWithRegionCode(culture); diff --git a/src/Umbraco.Core/ObjectExtensions.cs b/src/Umbraco.Core/ObjectExtensions.cs index 1a66cb96fb..68bc9c923d 100644 --- a/src/Umbraco.Core/ObjectExtensions.cs +++ b/src/Umbraco.Core/ObjectExtensions.cs @@ -143,7 +143,7 @@ namespace Umbraco.Core // Special case for empty strings for bools/dates which should return null if an empty string. if (input is string inputString) { - //TODO: Why the check against only bool/date when a string is null/empty? In what scenario can we convert to another type when the string is null or empty other than just being null? + // TODO: Why the check against only bool/date when a string is null/empty? In what scenario can we convert to another type when the string is null or empty other than just being null? if (string.IsNullOrEmpty(inputString) && (underlying == typeof(DateTime) || underlying == typeof(bool))) { return Attempt.Succeed(null); @@ -391,7 +391,7 @@ namespace Umbraco.Core } internal static void CheckThrowObjectDisposed(this IDisposable disposable, bool isDisposed, string objectname) { - //TODO: Localize this exception + // TODO: Localize this exception if (isDisposed) throw new ObjectDisposedException(objectname); } diff --git a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs index 72dc0cb325..a569954629 100644 --- a/src/Umbraco.Core/Packaging/PackageDataInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageDataInstallation.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Packaging //Order the DocumentTypes before removing them if (contentTypes.Any()) { - //TODO: I don't think this ordering is necessary + // TODO: I don't think this ordering is necessary var orderedTypes = (from contentType in contentTypes orderby contentType.ParentId descending, contentType.Id descending select contentType).ToList(); @@ -710,7 +710,7 @@ namespace Umbraco.Core.Packaging // This means that the property will not be created. if (dataTypeDefinition == null) { - //TODO: We should expose this to the UI during install! + // TODO: We should expose this to the UI during install! _logger.Warn("Packager: Error handling creation of PropertyType '{PropertyType}'. Could not find DataTypeDefintion with unique id '{DataTypeDefinitionId}' nor one referencing the DataType with a property editor alias (or legacy control id) '{PropertyEditorAlias}'. Did the package creator forget to package up custom datatypes? This property will be converted to a label/readonly editor if one exists.", property.Element("Name").Value, dataTypeDefinitionId, property.Element("Type").Value.Trim()); diff --git a/src/Umbraco.Core/Packaging/PackageFileInstallation.cs b/src/Umbraco.Core/Packaging/PackageFileInstallation.cs index 7c0891175b..29afc11d83 100644 --- a/src/Umbraco.Core/Packaging/PackageFileInstallation.cs +++ b/src/Umbraco.Core/Packaging/PackageFileInstallation.cs @@ -65,7 +65,7 @@ namespace Umbraco.Core.Packaging var file = IOHelper.FindFile(item); if (file != null) { - //TODO: Surely this should be ~/ ? + // TODO: Surely this should be ~/ ? file = file.EnsureStartsWith("/"); var filePath = IOHelper.MapPath(file); diff --git a/src/Umbraco.Core/Packaging/PackagesRepository.cs b/src/Umbraco.Core/Packaging/PackagesRepository.cs index dcf3b62e55..05f67b3ed6 100644 --- a/src/Umbraco.Core/Packaging/PackagesRepository.cs +++ b/src/Umbraco.Core/Packaging/PackagesRepository.cs @@ -362,7 +362,7 @@ namespace Umbraco.Core.Packaging new XAttribute("importMode", "root"), contentXml))); - //TODO: I guess tags has been broken for a very long time for packaging, we should get this working again sometime + // TODO: I guess tags has been broken for a very long time for packaging, we should get this working again sometime ////Create the TagProperties node - this is used to store a definition for all //// document properties that are tags, this ensures that we can re-import tags properly //XmlNode tagProps = new XElement("TagProperties"); diff --git a/src/Umbraco.Core/Persistence/Dtos/LogDto.cs b/src/Umbraco.Core/Persistence/Dtos/LogDto.cs index 9a710c1fec..bfd96426e2 100644 --- a/src/Umbraco.Core/Persistence/Dtos/LogDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/LogDto.cs @@ -35,12 +35,12 @@ namespace Umbraco.Core.Persistence.Dtos [NullSetting(NullSetting = NullSettings.Null)] public string EntityType { get; set; } - //TODO: Should we have an index on this since we allow searching on it? + // TODO: Should we have an index on this since we allow searching on it? [Column("Datestamp")] [Constraint(Default = SystemMethods.CurrentDateTime)] public DateTime Datestamp { get; set; } - //TODO: Should we have an index on this since we allow searching on it? + // TODO: Should we have an index on this since we allow searching on it? [Column("logHeader")] [Length(50)] public string Header { get; set; } diff --git a/src/Umbraco.Core/Persistence/Dtos/MemberTypeReadOnlyDto.cs b/src/Umbraco.Core/Persistence/Dtos/MemberTypeReadOnlyDto.cs index f9e70cce18..c4ea6a10fd 100644 --- a/src/Umbraco.Core/Persistence/Dtos/MemberTypeReadOnlyDto.cs +++ b/src/Umbraco.Core/Persistence/Dtos/MemberTypeReadOnlyDto.cs @@ -66,13 +66,13 @@ namespace Umbraco.Core.Persistence.Dtos public bool AllowAtRoot { get; set; } /* PropertyTypes */ - //TODO Add PropertyTypeDto (+MemberTypeDto and DataTypeDto as one) ReadOnly list + // TODO: Add PropertyTypeDto (+MemberTypeDto and DataTypeDto as one) ReadOnly list [ResultColumn] [Reference(ReferenceType.Many, ReferenceMemberName = "ContentTypeId")] public List PropertyTypes { get; set; } /* PropertyTypeGroups */ - //TODO Add PropertyTypeGroupDto ReadOnly list + // TODO: Add PropertyTypeGroupDto ReadOnly list [ResultColumn] [Reference(ReferenceType.Many, ReferenceMemberName = "ContentTypeNodeId")] public List PropertyTypeGroups { get; set; } diff --git a/src/Umbraco.Core/Persistence/EntityNotFoundException.cs b/src/Umbraco.Core/Persistence/EntityNotFoundException.cs index 49e85046a0..e0fe778fa6 100644 --- a/src/Umbraco.Core/Persistence/EntityNotFoundException.cs +++ b/src/Umbraco.Core/Persistence/EntityNotFoundException.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Umbraco.Core.Persistence { - //TODO: Would be good to use this exception type anytime we cannot find an entity + // TODO: Would be good to use this exception type anytime we cannot find an entity /// /// An exception used to indicate that an umbraco entity could not be found diff --git a/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs b/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs index b6f5401bec..d04930fa92 100644 --- a/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs +++ b/src/Umbraco.Core/Persistence/Querying/ExpressionVisitorBase.cs @@ -269,7 +269,7 @@ namespace Umbraco.Core.Persistence.Querying protected virtual string VisitNew(NewExpression newExpression) { - // TODO : check ! + // TODO: check ! var member = Expression.Convert(newExpression, typeof(object)); var lambda = Expression.Lambda>(member); try @@ -662,7 +662,7 @@ namespace Umbraco.Core.Persistence.Querying // sql 'COALESCE(x,fb) = COALESCE(y,fb)' - of course, fb must be a value outside // of x and y range - and if that is not possible, then a manual comparison need // to be written - //TODO support SqlNullableEquals with 0 parameters, using the full syntax below + // TODO: support SqlNullableEquals with 0 parameters, using the full syntax below case "SqlNullableEquals": var compareTo = Visit(m.Arguments[1]); var fallback = Visit(m.Arguments[2]); diff --git a/src/Umbraco.Core/Persistence/Querying/ModelToSqlExpressionVisitor.cs b/src/Umbraco.Core/Persistence/Querying/ModelToSqlExpressionVisitor.cs index 9f57e61db9..a353f01f5b 100644 --- a/src/Umbraco.Core/Persistence/Querying/ModelToSqlExpressionVisitor.cs +++ b/src/Umbraco.Core/Persistence/Querying/ModelToSqlExpressionVisitor.cs @@ -79,7 +79,7 @@ namespace Umbraco.Core.Persistence.Querying return string.Empty; } - //TODO: When m.Expression.NodeType == ExpressionType.Constant and it's an expression like: content => aliases.Contains(content.ContentType.Alias); + // TODO: When m.Expression.NodeType == ExpressionType.Constant and it's an expression like: content => aliases.Contains(content.ContentType.Alias); // then an SQL parameter will be added for aliases as an array, however in SqlIn on the subclass it will manually add these SqlParameters anyways, // however the query will still execute because the SQL that is written will only contain the correct indexes of SQL parameters, this would be ignored, // I'm just unsure right now due to time constraints how to make it correct. It won't matter right now and has been working already with this bug but I've diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs index 92ade18204..7f41d2a456 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/ContentTypeRepositoryBase.cs @@ -271,7 +271,7 @@ AND umbracoNode.id <> @id", compositionBase.RemovedContentTypeKeyTracker != null && compositionBase.RemovedContentTypeKeyTracker.Any()) { - //TODO: Could we do the below with bulk SQL statements instead of looking everything up and then manipulating? + // TODO: Could we do the below with bulk SQL statements instead of looking everything up and then manipulating? // find Content based on the current ContentType var sql = Sql() @@ -291,7 +291,7 @@ AND umbracoNode.id <> @id", // based on the PropertyTypes that belong to the removed ContentType. foreach (var contentDto in contentDtos) { - //TODO: This could be done with bulk SQL statements + // TODO: This could be done with bulk SQL statements foreach (var propertyType in propertyTypes) { var nodeId = contentDto.NodeId; @@ -437,7 +437,7 @@ AND umbracoNode.id <> @id", case ContentVariation.CultureAndSegment: case ContentVariation.Segment: default: - throw new NotSupportedException(); //TODO: Support this + throw new NotSupportedException(); // TODO: Support this } } @@ -627,7 +627,7 @@ AND umbracoNode.id <> @id", /// private void ClearScheduledPublishing(IContentTypeComposition contentType) { - //TODO: Fill this in when scheduled publishing is enabled for variants + // TODO: Fill this in when scheduled publishing is enabled for variants } /// @@ -670,7 +670,7 @@ AND umbracoNode.id <> @id", case ContentVariation.CultureAndSegment: case ContentVariation.Segment: default: - throw new NotSupportedException(); //TODO: Support this + throw new NotSupportedException(); // TODO: Support this } } } @@ -753,7 +753,7 @@ AND umbracoNode.id <> @id", case ContentVariation.CultureAndSegment: case ContentVariation.Segment: default: - throw new NotSupportedException(); //TODO: Support this + throw new NotSupportedException(); // TODO: Support this } } @@ -1037,7 +1037,7 @@ AND umbracoNode.id <> @id", var dtos = Database.Fetch(sql); - //TODO Move this to a PropertyTypeFactory + // TODO: Move this to a PropertyTypeFactory var list = new List(); foreach (var dto in dtos.Where(x => x.PropertyTypeGroupId <= 0)) { diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs index 0e6ff0310d..3de9e3c99b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DataTypeRepository.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { private readonly Lazy _editors; - // TODO - https://github.com/umbraco/Umbraco-CMS/issues/4237 - get rid of Lazy injection and fix circular dependencies + // TODO: https://github.com/umbraco/Umbraco-CMS/issues/4237 - get rid of Lazy injection and fix circular dependencies public DataTypeRepository(IScopeAccessor scopeAccessor, AppCaches cache, Lazy editors, ILogger logger) : base(scopeAccessor, cache, logger) { @@ -111,7 +111,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement //ensure a datatype has a unique name before creating it entity.Name = EnsureUniqueNodeName(entity.Name); - //TODO: should the below be removed? + // TODO: should the below be removed? //Cannot add a duplicate data type var existsSql = Sql() .SelectCount() diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/DomainRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/DomainRepository.cs index fa06216f9b..01b8bdd66c 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/DomainRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/DomainRepository.cs @@ -12,7 +12,7 @@ using Umbraco.Core.Scoping; namespace Umbraco.Core.Persistence.Repositories.Implement { - //TODO: We need to get a readonly ISO code for the domain assigned + // TODO: We need to get a readonly ISO code for the domain assigned internal class DomainRepository : NPocoRepositoryBase, IDomainRepository { diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs index 18dc16cbce..ba3526f1f0 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/MemberRepository.cs @@ -460,7 +460,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement var subQuery = Sql().Select("Member").From().Where(dto => dto.MemberGroup == memberGroup.Id); var sql = GetBaseQuery(false) - //TODO: An inner join would be better, though I've read that the query optimizer will always turn a + // TODO: An inner join would be better, though I've read that the query optimizer will always turn a // subquery with an IN clause into an inner join anyways. .Append("WHERE umbracoNode.id IN (" + subQuery.SQL + ")", subQuery.Arguments) .OrderByDescending(x => x.VersionDate) diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs index fb45a79e43..a7e366a94f 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/RepositoryBaseOfTIdTEntity.cs @@ -207,7 +207,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement //ensure they are de-duplicated, easy win if people don't do this as this can cause many excess queries ids = ids.Distinct() //don't query by anything that is a default of T (like a zero) - //TODO: I think we should enabled this in case accidental calls are made to get all with invalid ids + // TODO: I think we should enabled this in case accidental calls are made to get all with invalid ids //.Where(x => Equals(x, default(TId)) == false) .ToArray(); diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs index 7dd3f03407..f26fcca81b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TagRepository.cs @@ -254,8 +254,7 @@ WHERE r.tagId IS NULL"; #region Queries - // TODO - // consider caching implications + // TODO: consider caching implications // add lookups for parentId or path (ie get content in tag group, that are descendants of x) // ReSharper disable once ClassNeverInstantiated.Local diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs index a183894462..b348317989 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/TemplateRepository.cs @@ -407,13 +407,12 @@ namespace Umbraco.Core.Persistence.Repositories.Implement template.UpdateDate = fs.GetLastModified(filename).UtcDateTime; } - // TODO - // see if this could enable us to update UpdateDate without messing with change tracking - // and then we'd want to do it for scripts, stylesheets and partial views too (ie files) - //var xtemplate = template as Template; - //xtemplate.DisableChangeTracking(); - //template.UpdateDate = fs.GetLastModified(filename).UtcDateTime; - //xtemplate.EnableChangeTracking(); + // TODO: see if this could enable us to update UpdateDate without messing with change tracking + // and then we'd want to do it for scripts, stylesheets and partial views too (ie files) + // var xtemplate = template as Template; + // xtemplate.DisableChangeTracking(); + // template.UpdateDate = fs.GetLastModified(filename).UtcDateTime; + // xtemplate.EnableChangeTracking(); template.VirtualPath = fs.GetUrl(filename); @@ -580,9 +579,8 @@ namespace Umbraco.Core.Persistence.Repositories.Implement public bool ValidateTemplate(ITemplate template) { // get path - // TODO - // templates should have a real Path somehow - but anyways - // are we using Path for something else?! + // TODO: templates should have a real Path somehow - but anyways + // are we using Path for something else?! var path = template.VirtualPath; // get valid paths @@ -652,7 +650,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement private string EnsureUniqueAlias(ITemplate template, int attempts) { - //TODO: This is ported from the old data layer... pretty crap way of doing this but it works for now. + // TODO: This is ported from the old data layer... pretty crap way of doing this but it works for now. if (AliasAlreadExists(template)) return template.Alias + attempts; attempts++; diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs index b42060b6cc..3935027ada 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/UserGroupRepository.cs @@ -128,7 +128,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement { foreach (var nodeId in nodeIds) { - //TODO: We could/should change the EntityPermissionsCollection into a KeyedCollection and they key could be + // TODO: We could/should change the EntityPermissionsCollection into a KeyedCollection and they key could be // a struct of the nodeid + groupid so then we don't actually allocate this class just to check if it's not // going to be included in the result! @@ -444,7 +444,7 @@ namespace Umbraco.Core.Persistence.Repositories.Implement /// Ids of users private void AddUsersToGroup(int groupId, int[] userIds) { - //TODO: Check if the user exists? + // TODO: Check if the user exists? foreach (var userId in userIds) { var dto = new User2UserGroupDto diff --git a/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs index fdd5fb0d86..07ad6bcba9 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Implement/UserRepository.cs @@ -169,7 +169,7 @@ ORDER BY colName"; public Guid CreateLoginSession(int userId, string requestingIpAddress, bool cleanStaleSessions = true) { - //TODO: I know this doesn't follow the normal repository conventions which would require us to create a UserSessionRepository + // TODO: I know this doesn't follow the normal repository conventions which would require us to create a UserSessionRepository //and also business logic models for these objects but that's just so overkill for what we are doing //and now that everything is properly in a transaction (Scope) there doesn't seem to be much reason for using that anymore var now = DateTime.UtcNow; @@ -443,7 +443,7 @@ ORDER BY colName"; var userDto = UserFactory.BuildDto(entity); // check if we have a known config, we only want to store config for hashing - //TODO: This logic will need to be updated when we do http://issues.umbraco.org/issue/U4-10089 + // TODO: This logic will need to be updated when we do http://issues.umbraco.org/issue/U4-10089 if (PasswordConfigJson != null) userDto.PasswordConfig = PasswordConfigJson; @@ -538,7 +538,7 @@ ORDER BY colName"; } // check if we have a known config, we only want to store config for hashing - //TODO: This logic will need to be updated when we do http://issues.umbraco.org/issue/U4-10089 + // TODO: This logic will need to be updated when we do http://issues.umbraco.org/issue/U4-10089 if (PasswordConfigJson != null) { userDto.PasswordConfig = PasswordConfigJson; @@ -573,7 +573,7 @@ ORDER BY colName"; : Database.Fetch("SELECT * FROM umbracoUserGroup WHERE userGroupAlias IN (@aliases)", new { aliases = entity.Groups.Select(x => x.Alias) }); //first delete all - //TODO: We could do this a nicer way instead of "Nuke and Pave" + // TODO: We could do this a nicer way instead of "Nuke and Pave" Database.Delete("WHERE UserId = @UserId", new { UserId = entity.Id }); foreach (var groupDto in assigned) diff --git a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs index d6ceeaa3e6..5b6a9afb04 100644 --- a/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs +++ b/src/Umbraco.Core/Persistence/SqlSyntax/SqlSyntaxProviderBase.cs @@ -500,7 +500,7 @@ namespace Umbraco.Core.Persistence.SqlSyntax if (column.DefaultValue == null) return string.Empty; - //hack - probably not needed with latest changes + // HACK: probably not needed with latest changes if (column.DefaultValue.ToString().ToLower().Equals("getdate()".ToLower())) column.DefaultValue = SystemMethods.CurrentDateTime; diff --git a/src/Umbraco.Core/PropertyEditors/Validators/DelimitedValueValidator.cs b/src/Umbraco.Core/PropertyEditors/Validators/DelimitedValueValidator.cs index 3891d7952b..c3dca609d2 100644 --- a/src/Umbraco.Core/PropertyEditors/Validators/DelimitedValueValidator.cs +++ b/src/Umbraco.Core/PropertyEditors/Validators/DelimitedValueValidator.cs @@ -23,7 +23,7 @@ namespace Umbraco.Core.PropertyEditors.Validators /// public IEnumerable Validate(object value, string valueType, object dataTypeConfiguration) { - //TODO: localize these! + // TODO: localize these! if (value != null) { var delimiter = ","; diff --git a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs index d4cee4762f..e04893716a 100644 --- a/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs +++ b/src/Umbraco.Core/PropertyEditors/ValueConverters/JsonValueConverter.cs @@ -65,6 +65,6 @@ namespace Umbraco.Core.PropertyEditors.ValueConverters return sourceString; } - //TODO: Now to convert that to XPath! + // TODO: Now to convert that to XPath! } } diff --git a/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs b/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs index 83cc456127..8285b9b4fd 100644 --- a/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs +++ b/src/Umbraco.Core/Runtime/CoreRuntimeComposer.cs @@ -73,7 +73,7 @@ namespace Umbraco.Core.Runtime // register a server registrar, by default it's the db registrar composition.RegisterUnique(f => { - // TODO this is a hack, use proper configuration! + // TODO: this is a hack, use proper configuration! // also: we still register the full IServerMessenger because // even on 1 single server we can have 2 concurrent app domains var singleServer = "true".InvariantEquals(ConfigurationManager.AppSettings["umbracoDisableElectionForSingleServer"]); diff --git a/src/Umbraco.Core/Scoping/ScopeContext.cs b/src/Umbraco.Core/Scoping/ScopeContext.cs index 03a0da1a55..7b62c5c7a2 100644 --- a/src/Umbraco.Core/Scoping/ScopeContext.cs +++ b/src/Umbraco.Core/Scoping/ScopeContext.cs @@ -13,7 +13,7 @@ namespace Umbraco.Core.Scoping if (_enlisted == null) return; - // TODO: - can we create infinite loops? - what about nested events? will they just be plainly ignored = really bad? + // TODO: can we create infinite loops? - what about nested events? will they just be plainly ignored = really bad? List exceptions = null; List orderedEnlisted; while ((orderedEnlisted = _enlisted.Values.OrderBy(x => x.Priority).ToList()).Count > 0) diff --git a/src/Umbraco.Core/Security/BackOfficeUserStore.cs b/src/Umbraco.Core/Security/BackOfficeUserStore.cs index 2d9469180a..3d87482d60 100644 --- a/src/Umbraco.Core/Security/BackOfficeUserStore.cs +++ b/src/Umbraco.Core/Security/BackOfficeUserStore.cs @@ -30,9 +30,9 @@ namespace Umbraco.Core.Security IUserTwoFactorStore, IUserSessionStore - //TODO: This would require additional columns/tables for now people will need to implement this on their own + // TODO: This would require additional columns/tables for now people will need to implement this on their own //IUserPhoneNumberStore, - //TODO: To do this we need to implement IQueryable - we'll have an IQuerable implementation soon with the UmbracoLinqPadDriver implementation + // TODO: To do this we need to implement IQueryable - we'll have an IQuerable implementation soon with the UmbracoLinqPadDriver implementation //IQueryableUserStore { private readonly IUserService _userService; @@ -99,7 +99,7 @@ namespace Umbraco.Core.Security UpdateMemberProperties(userEntity, user); - //TODO: We should deal with Roles --> User Groups here which we currently are not doing + // TODO: We should deal with Roles --> User Groups here which we currently are not doing _userService.Save(userEntity); @@ -720,7 +720,7 @@ namespace Umbraco.Core.Security user.SecurityStamp = identityUser.SecurityStamp; } - //TODO: Fix this for Groups too + // TODO: Fix this for Groups too if (identityUser.IsPropertyDirty("Roles") || identityUser.IsPropertyDirty("Groups")) { var userGroupAliases = user.Groups.Select(x => x.Alias).ToArray(); diff --git a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs index ff595a5d45..8fc2cb77e4 100644 --- a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs +++ b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs @@ -161,7 +161,7 @@ namespace Umbraco.Core.Security return (membershipProvider is UmbracoMembershipProviderBase); } - //TODO: Add role provider checks too + // TODO: Add role provider checks too public static UmbracoMembershipProviderBase AsUmbracoMembershipProvider(this MembershipProvider membershipProvider) { diff --git a/src/Umbraco.Core/Security/UserAwareMembershipProviderPasswordHasher.cs b/src/Umbraco.Core/Security/UserAwareMembershipProviderPasswordHasher.cs index 7fecb30fba..e09c861caa 100644 --- a/src/Umbraco.Core/Security/UserAwareMembershipProviderPasswordHasher.cs +++ b/src/Umbraco.Core/Security/UserAwareMembershipProviderPasswordHasher.cs @@ -15,14 +15,14 @@ namespace Umbraco.Core.Security public string HashPassword(BackOfficeIdentityUser user, string password) { - //TODO: Implement the logic for this, we need to lookup the password format for the user and hash accordingly: http://issues.umbraco.org/issue/U4-10089 + // TODO: Implement the logic for this, we need to lookup the password format for the user and hash accordingly: http://issues.umbraco.org/issue/U4-10089 //NOTE: For now this just falls back to the hashing we are currently using return base.HashPassword(password); } public PasswordVerificationResult VerifyHashedPassword(BackOfficeIdentityUser user, string hashedPassword, string providedPassword) { - //TODO: Implement the logic for this, we need to lookup the password format for the user and hash accordingly: http://issues.umbraco.org/issue/U4-10089 + // TODO: Implement the logic for this, we need to lookup the password format for the user and hash accordingly: http://issues.umbraco.org/issue/U4-10089 //NOTE: For now this just falls back to the hashing we are currently using return base.VerifyHashedPassword(hashedPassword, providedPassword); } diff --git a/src/Umbraco.Core/Services/Implement/AuditService.cs b/src/Umbraco.Core/Services/Implement/AuditService.cs index d02d7f541b..46c851a789 100644 --- a/src/Umbraco.Core/Services/Implement/AuditService.cs +++ b/src/Umbraco.Core/Services/Implement/AuditService.cs @@ -200,7 +200,7 @@ namespace Umbraco.Core.Services.Implement return entry; } - //TODO: Currently used in testing only, not part of the interface, need to add queryable methods to the interface instead + // TODO: Currently used in testing only, not part of the interface, need to add queryable methods to the interface instead internal IEnumerable GetAll() { if (_isAvailable.Value == false) return Enumerable.Empty(); @@ -211,7 +211,7 @@ namespace Umbraco.Core.Services.Implement } } - //TODO: Currently used in testing only, not part of the interface, need to add queryable methods to the interface instead + // TODO: Currently used in testing only, not part of the interface, need to add queryable methods to the interface instead internal IEnumerable GetPage(long pageIndex, int pageCount, out long records) { if (_isAvailable.Value == false) diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index cbc2eeca7a..266f34cc37 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -778,7 +778,7 @@ namespace Umbraco.Core.Services.Implement var culturesChanging = content.ContentType.VariesByCulture() ? content.CultureInfos.Where(x => x.Value.IsDirty()).Select(x => x.Key).ToList() : null; - //TODO: Currently there's no way to change track which variant properties have changed, we only have change + // TODO: Currently there's no way to change track which variant properties have changed, we only have change // tracking enabled on all values on the Property which doesn't allow us to know which variants have changed. // in this particular case, determining which cultures have changed works with the above with names since it will // have always changed if it's been saved in the back office but that's not really fail safe. @@ -1562,8 +1562,7 @@ namespace Umbraco.Core.Services.Implement DoDelete(content); } - //TODO: - // both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way + //TODO: both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way // Delete does - for a good reason: the file may be referenced by other, non-deleted, versions. BUT, // if that's not the case, then the file will never be deleted, because when we delete the content, // the version referencing the file will not be there anymore. SO, we can leak files. @@ -2001,7 +2000,7 @@ namespace Umbraco.Core.Services.Implement ? string.Join(",", content.CultureInfos.Where(x => x.Value.IsDirty()).Select(x => x.Key)) : null; - //TODO: Currently there's no way to change track which variant properties have changed, we only have change + // TODO: Currently there's no way to change track which variant properties have changed, we only have change // tracking enabled on all values on the Property which doesn't allow us to know which variants have changed. // in this particular case, determining which cultures have changed works with the above with names since it will // have always changed if it's been saved in the back office but that's not really fail safe. @@ -2553,7 +2552,7 @@ namespace Umbraco.Core.Services.Implement /// Optional Id of the user issuing the delete operation public void DeleteOfTypes(IEnumerable contentTypeIds, int userId = 0) { - //TODO: This currently this is called from the ContentTypeService but that needs to change, + // TODO: This currently this is called from the ContentTypeService but that needs to change, // if we are deleting a content type, we should just delete the data and do this operation slightly differently. // This method will recursively go lookup every content item, check if any of it's descendants are // of a different type, move them to the recycle bin, then permanently delete the content items. diff --git a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs index 0cac249cdf..bf43693d3b 100644 --- a/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentTypeServiceBaseOfTRepositoryTItemTService.cs @@ -134,7 +134,7 @@ namespace Umbraco.Core.Services.Implement var dirty = (IRememberBeingDirty)contentType; // skip new content types - //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly + // TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly var isNewContentType = dirty.WasPropertyDirty("Id"); if (isNewContentType) { @@ -152,7 +152,7 @@ namespace Umbraco.Core.Services.Implement throw new Exception("oops"); // skip new properties - //TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly + // TODO: This used to be WasPropertyDirty("HasIdentity") but i don't think that actually worked for detecting new entities this does seem to work properly var isNewProperty = dirtyProperty.WasPropertyDirty("Id"); if (isNewProperty) return false; @@ -758,7 +758,7 @@ namespace Umbraco.Core.Services.Implement saveEventArgs.CanCancel = false; OnSavedContainer(scope, saveEventArgs); - //TODO: Audit trail ? + // TODO: Audit trail ? return OperationResult.Attempt.Succeed(evtMsgs, container); } @@ -805,7 +805,7 @@ namespace Umbraco.Core.Services.Implement OnSavedContainer(scope, args); } - //TODO: Audit trail ? + // TODO: Audit trail ? return OperationResult.Attempt.Succeed(evtMsgs); } @@ -897,7 +897,7 @@ namespace Umbraco.Core.Services.Implement OnDeletedContainer(scope, deleteEventArgs); return OperationResult.Attempt.Succeed(evtMsgs); - //TODO: Audit trail ? + // TODO: Audit trail ? } } diff --git a/src/Umbraco.Core/Services/Implement/DataTypeService.cs b/src/Umbraco.Core/Services/Implement/DataTypeService.cs index 4c588157d0..97368e9047 100644 --- a/src/Umbraco.Core/Services/Implement/DataTypeService.cs +++ b/src/Umbraco.Core/Services/Implement/DataTypeService.cs @@ -62,7 +62,7 @@ namespace Umbraco.Core.Services.Implement scope.Complete(); scope.Events.Dispatch(SavedContainer, this, new SaveEventArgs(container, evtMsgs)); - //TODO: Audit trail ? + // TODO: Audit trail ? return OperationResult.Attempt.Succeed(evtMsgs, container); } @@ -149,7 +149,7 @@ namespace Umbraco.Core.Services.Implement scope.Complete(); } - //TODO: Audit trail ? + // TODO: Audit trail ? return OperationResult.Attempt.Succeed(evtMsgs); } @@ -182,7 +182,7 @@ namespace Umbraco.Core.Services.Implement scope.Complete(); } - //TODO: Audit trail ? + // TODO: Audit trail ? return OperationResult.Attempt.Succeed(evtMsgs); } diff --git a/src/Umbraco.Core/Services/Implement/FileService.cs b/src/Umbraco.Core/Services/Implement/FileService.cs index 36b4af6d5e..f49395d73d 100644 --- a/src/Umbraco.Core/Services/Implement/FileService.cs +++ b/src/Umbraco.Core/Services/Implement/FileService.cs @@ -1039,7 +1039,7 @@ namespace Umbraco.Core.Services.Implement _auditRepository.Save(new AuditItem(objectId, type, userId, entityType)); } - //TODO Method to change name and/or alias of view template + // TODO: Method to change name and/or alias of view template #region Event Handlers diff --git a/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs b/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs index 9401cefa7d..4f5121def7 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizedTextService.cs @@ -8,7 +8,7 @@ using Umbraco.Core.Logging; namespace Umbraco.Core.Services.Implement { - //TODO: Convert all of this over to Niels K's localization framework one day + // TODO: Convert all of this over to Niels K's localization framework one day public class LocalizedTextService : ILocalizedTextService { @@ -58,7 +58,7 @@ namespace Umbraco.Core.Services.Implement { if (culture == null) throw new ArgumentNullException(nameof(culture)); - //TODO: Hack, see notes on ConvertToSupportedCultureWithRegionCode + // TODO: Hack, see notes on ConvertToSupportedCultureWithRegionCode culture = ConvertToSupportedCultureWithRegionCode(culture); //This is what the legacy ui service did @@ -91,7 +91,7 @@ namespace Umbraco.Core.Services.Implement { if (culture == null) throw new ArgumentNullException("culture"); - //TODO: Hack, see notes on ConvertToSupportedCultureWithRegionCode + // TODO: Hack, see notes on ConvertToSupportedCultureWithRegionCode culture = ConvertToSupportedCultureWithRegionCode(culture); var result = new Dictionary(); diff --git a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs index f19dd9f63e..a0b952a75a 100644 --- a/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs +++ b/src/Umbraco.Core/Services/Implement/LocalizedTextServiceFileSources.cs @@ -21,7 +21,7 @@ namespace Umbraco.Core.Services.Implement private readonly IEnumerable _supplementFileSources; private readonly DirectoryInfo _fileSourceFolder; - //TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( + // TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( private readonly Dictionary _twoLetterCultureConverter = new Dictionary(); private readonly Lazy>> _xmlSources; @@ -60,7 +60,7 @@ namespace Umbraco.Core.Services.Implement var localCopy = fileInfo; var filename = Path.GetFileNameWithoutExtension(localCopy.FullName).Replace("_", "-"); - //TODO: Fix this nonsense... would have to wait until v8 to store the language files with their correct + // TODO: Fix this nonsense... would have to wait until v8 to store the language files with their correct // names instead of storing them as 2 letters but actually having a 4 letter culture. wtf. So now, we // need to check if the file is 2 letters, then open it to try to find it's 4 letter culture, then use that // if it's successful. We're going to assume (though it seems assuming in the legacy logic is never a great idea) @@ -150,7 +150,7 @@ namespace Umbraco.Core.Services.Implement return _xmlSources.Value; } - //TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( + // TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( public Attempt TryConvert2LetterCultureTo4Letter(string twoLetterCulture) { if (twoLetterCulture.Length != 2) return Attempt.Fail(); @@ -163,7 +163,7 @@ namespace Umbraco.Core.Services.Implement : Attempt.Fail(); } - //TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( + // TODO: See other notes in this class, this is purely a hack because we store 2 letter culture file names that contain 4 letter cultures :( public Attempt TryConvert4LetterCultureTo2Letter(CultureInfo culture) { if (culture == null) throw new ArgumentNullException("culture"); diff --git a/src/Umbraco.Core/Services/Implement/MediaService.cs b/src/Umbraco.Core/Services/Implement/MediaService.cs index 9ca7892f62..e7a42e28e4 100644 --- a/src/Umbraco.Core/Services/Implement/MediaService.cs +++ b/src/Umbraco.Core/Services/Implement/MediaService.cs @@ -773,8 +773,7 @@ namespace Umbraco.Core.Services.Implement DoDelete(media); } - //TODO: - // both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way + //TODO: both DeleteVersions methods below have an issue. Sort of. They do NOT take care of files the way // Delete does - for a good reason: the file may be referenced by other, non-deleted, versions. BUT, // if that's not the case, then the file will never be deleted, because when we delete the media, // the version referencing the file will not be there anymore. SO, we can leak files. @@ -1276,7 +1275,7 @@ namespace Umbraco.Core.Services.Implement /// Optional id of the user deleting the media public void DeleteMediaOfTypes(IEnumerable mediaTypeIds, int userId = 0) { - //TODO: This currently this is called from the ContentTypeService but that needs to change, + // TODO: This currently this is called from the ContentTypeService but that needs to change, // if we are deleting a content type, we should just delete the data and do this operation slightly differently. // This method will recursively go lookup every content item, check if any of it's descendants are // of a different type, move them to the recycle bin, then permanently delete the content items. diff --git a/src/Umbraco.Core/Services/Implement/MemberService.cs b/src/Umbraco.Core/Services/Implement/MemberService.cs index b7afaea1be..3b35896769 100644 --- a/src/Umbraco.Core/Services/Implement/MemberService.cs +++ b/src/Umbraco.Core/Services/Implement/MemberService.cs @@ -449,7 +449,7 @@ namespace Umbraco.Core.Services.Implement /// public IMember GetByUsername(string username) { - //TODO: Somewhere in here, whether at this level or the repository level, we need to add + // TODO: Somewhere in here, whether at this level or the repository level, we need to add // a caching mechanism since this method is used by all the membership providers and could be // called quite a bit when dealing with members. @@ -770,8 +770,8 @@ namespace Umbraco.Core.Services.Implement throw new ArgumentOutOfRangeException(nameof(matchType)); // causes rollback // causes rollback } - //TODO: Since this is by property value, we need a GetByPropertyQuery on the repo! - //TODO: Since this is by property value, we need a GetByPropertyQuery on the repo! + // TODO: Since this is by property value, we need a GetByPropertyQuery on the repo! + // TODO: Since this is by property value, we need a GetByPropertyQuery on the repo! return _memberRepository.Get(query); } } @@ -1330,8 +1330,8 @@ namespace Umbraco.Core.Services.Implement { scope.WriteLock(Constants.Locks.MemberTree); - //TODO: What about content that has the contenttype as part of its composition? - //TODO: What about content that has the contenttype as part of its composition? + // TODO: What about content that has the contenttype as part of its composition? + // TODO: What about content that has the contenttype as part of its composition? var query = Query().Where(x => x.ContentTypeId == memberTypeId); var members = _memberRepository.Get(query).ToArray(); diff --git a/src/Umbraco.Core/Services/Implement/NotificationService.cs b/src/Umbraco.Core/Services/Implement/NotificationService.cs index 95353715e1..d981809364 100644 --- a/src/Umbraco.Core/Services/Implement/NotificationService.cs +++ b/src/Umbraco.Core/Services/Implement/NotificationService.cs @@ -394,7 +394,7 @@ namespace Umbraco.Core.Services.Implement content.Id.ToString(CultureInfo.InvariantCulture), string.Format("{2}://{0}/{1}", string.Concat(siteUri.Authority), - //TODO: RE-enable this so we can have a nice url + // TODO: RE-enable this so we can have a nice url /*umbraco.library.NiceUrl(documentObject.Id))*/ string.Concat(content.Id, ".aspx"), protocol), diff --git a/src/Umbraco.Core/Services/Implement/UserService.cs b/src/Umbraco.Core/Services/Implement/UserService.cs index e2c64d2f29..0ea77dedcc 100644 --- a/src/Umbraco.Core/Services/Implement/UserService.cs +++ b/src/Umbraco.Core/Services/Implement/UserService.cs @@ -109,7 +109,7 @@ namespace Umbraco.Core.Services.Implement { if (string.IsNullOrWhiteSpace(username)) throw new ArgumentNullOrEmptyException(nameof(username)); - //TODO: PUT lock here!! + // TODO: PUT lock here!! User user; using (var scope = ScopeProvider.CreateScope()) @@ -1218,7 +1218,7 @@ namespace Umbraco.Core.Services.Implement /// public static event TypedEventHandler> DeletedUserGroup; - //TODO: still don't know if we need this yet unless we start caching permissions, but that also means we'll need another + // TODO: still don't know if we need this yet unless we start caching permissions, but that also means we'll need another // event on the ContentService since there's a method there to modify node permissions too, or we can proxy events if needed. internal static event TypedEventHandler> UserGroupPermissionsAssigned; } diff --git a/src/Umbraco.Core/Services/OperationResultType.cs b/src/Umbraco.Core/Services/OperationResultType.cs index 2998692c13..918f1c49fa 100644 --- a/src/Umbraco.Core/Services/OperationResultType.cs +++ b/src/Umbraco.Core/Services/OperationResultType.cs @@ -40,6 +40,6 @@ /// NoOperation = Failed | 6, // TODO: shouldn't it be a success? - //TODO: In the future, we might need to add more operations statuses, potentially like 'FailedByPermissions', etc... + // TODO: In the future, we might need to add more operations statuses, potentially like 'FailedByPermissions', etc... } } diff --git a/src/Umbraco.Core/Strings/IUrlSegmentProvider.cs b/src/Umbraco.Core/Strings/IUrlSegmentProvider.cs index b326a3cda6..12d2ef9a17 100644 --- a/src/Umbraco.Core/Strings/IUrlSegmentProvider.cs +++ b/src/Umbraco.Core/Strings/IUrlSegmentProvider.cs @@ -20,7 +20,7 @@ namespace Umbraco.Core.Strings /// url per culture. string GetUrlSegment(IContentBase content, string culture = null); - //TODO: For the 301 tracking, we need to add another extended interface to this so that + // TODO: For the 301 tracking, we need to add another extended interface to this so that // the RedirectTrackingEventHandler can ask the IUrlSegmentProvider if the URL is changing. // Currently the way it works is very hacky, see notes in: RedirectTrackingEventHandler.ContentService_Publishing } diff --git a/src/Umbraco.Core/Sync/IServerAddress.cs b/src/Umbraco.Core/Sync/IServerAddress.cs index 42567c67c1..be74b8483f 100644 --- a/src/Umbraco.Core/Sync/IServerAddress.cs +++ b/src/Umbraco.Core/Sync/IServerAddress.cs @@ -10,6 +10,6 @@ /// string ServerAddress { get; } - //TODO : Should probably add things like port, protocol, server name, app id + // TODO: Should probably add things like port, protocol, server name, app id } } diff --git a/src/Umbraco.Core/TypeExtensions.cs b/src/Umbraco.Core/TypeExtensions.cs index 56b2026afb..1582b603d3 100644 --- a/src/Umbraco.Core/TypeExtensions.cs +++ b/src/Umbraco.Core/TypeExtensions.cs @@ -55,7 +55,7 @@ namespace Umbraco.Core ? getMember(memberName.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.CamelCase)) : getMember(memberName.ToCleanString(CleanStringType.Ascii | CleanStringType.ConvertCase | CleanStringType.PascalCase)); - //TODO: If this still fails then we should get a list of properties from the object and then compare - doing the above without listing + // TODO: If this still fails then we should get a list of properties from the object and then compare - doing the above without listing // all properties will surely be faster than using reflection to get ALL properties first and then query against them. } diff --git a/src/Umbraco.Core/UdiEntityType.cs b/src/Umbraco.Core/UdiEntityType.cs index 07bde1ba93..86197ce6a8 100644 --- a/src/Umbraco.Core/UdiEntityType.cs +++ b/src/Umbraco.Core/UdiEntityType.cs @@ -78,7 +78,7 @@ namespace Umbraco.Core public const string DocumentType = "document-type"; public const string DocumentTypeContainer = "document-type-container"; - //TODO: What is this? This alias is only used for the blue print tree to render the blueprint's document type, it's not a real udi type + // TODO: What is this? This alias is only used for the blue print tree to render the blueprint's document type, it's not a real udi type public const string DocumentTypeBluePrints = "document-type-blueprints"; public const string MediaType = "media-type"; public const string MediaTypeContainer = "media-type-container"; diff --git a/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs b/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs index afe9831b72..b31fa6a8df 100644 --- a/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs +++ b/src/Umbraco.Core/Xml/UmbracoXPathPathSyntaxParser.cs @@ -31,7 +31,7 @@ namespace Umbraco.Core.Xml Func publishedContentExists) { - //TODO: This should probably support some of the old syntax and token replacements, currently + // TODO: This should probably support some of the old syntax and token replacements, currently // it does not, there is a ticket raised here about it: http://issues.umbraco.org/issue/U4-6364 // previous tokens were: "$currentPage", "$ancestorOrSelf", "$parentPage" and I believe they were // allowed 'inline', not just at the beginning... whether or not we want to support that is up @@ -97,7 +97,7 @@ namespace Umbraco.Core.Xml }); } - //TODO: This used to just replace $root with string.Empty BUT, that would never work + // TODO: This used to just replace $root with string.Empty BUT, that would never work // the root is always "/root . Need to confirm with Per why this was string.Empty before! vars.Add("$root", q => q.Replace("$root", "/root")); diff --git a/src/Umbraco.Core/Xml/XPath/INavigableContent.cs b/src/Umbraco.Core/Xml/XPath/INavigableContent.cs index c48b91893a..eeb7891726 100644 --- a/src/Umbraco.Core/Xml/XPath/INavigableContent.cs +++ b/src/Umbraco.Core/Xml/XPath/INavigableContent.cs @@ -45,7 +45,7 @@ namespace Umbraco.Core.Xml.XPath /// object Value(int index); - // TODO implement the following one + // TODO: implement the following one ///// ///// Gets the value of a field of the navigable content, for a specified language. diff --git a/src/Umbraco.Examine/ContentValueSetBuilder.cs b/src/Umbraco.Examine/ContentValueSetBuilder.cs index a6262c53fc..5e0197765d 100644 --- a/src/Umbraco.Examine/ContentValueSetBuilder.cs +++ b/src/Umbraco.Examine/ContentValueSetBuilder.cs @@ -29,7 +29,7 @@ namespace Umbraco.Examine /// public override IEnumerable GetValueSets(params IContent[] content) { - //TODO: There is a lot of boxing going on here and ultimately all values will be boxed by Lucene anyways + // TODO: There is a lot of boxing going on here and ultimately all values will be boxed by Lucene anyways // but I wonder if there's a way to reduce the boxing that we have to do or if it will matter in the end since // Lucene will do it no matter what? One idea was to create a `FieldValue` struct which would contain `object`, `object[]`, `ValueType` and `ValueType[]` // references and then each array is an array of `FieldValue[]` and values are assigned accordingly. Not sure if it will make a difference or not. diff --git a/src/Umbraco.Examine/ExamineExtensions.cs b/src/Umbraco.Examine/ExamineExtensions.cs index 4fe6c359d7..19171ac6b1 100644 --- a/src/Umbraco.Examine/ExamineExtensions.cs +++ b/src/Umbraco.Examine/ExamineExtensions.cs @@ -48,7 +48,7 @@ namespace Umbraco.Examine internal static bool TryParseLuceneQuery(string query) { - //TODO: I'd assume there would be a more strict way to parse the query but not that i can find yet, for now we'll + // TODO: I'd assume there would be a more strict way to parse the query but not that i can find yet, for now we'll // also do this rudimentary check if (!query.Contains(":")) return false; diff --git a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs index ee2e75cfad..d6dc1f8c73 100644 --- a/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/BulkInsertBenchmarks.cs @@ -22,7 +22,7 @@ namespace Umbraco.Tests.Benchmarks { private static byte[] _initDbBytes; - // fixme - should run on LocalDb same as NPoco tests! + // FIXME: should run on LocalDb same as NPoco tests! private IUmbracoDatabase GetSqlServerDatabase(ILogger logger) { diff --git a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs index 3532a11c63..e9448bd0fc 100644 --- a/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs +++ b/src/Umbraco.Tests/Cache/DistributedCacheBinderTests.cs @@ -32,7 +32,7 @@ namespace Umbraco.Tests.Cache [Test] public void Can_Find_All_Event_Handlers() { - // fixme - cannot work with mocks + // FIXME: cannot work with mocks // because the events are defined on actual static classes, not on the interfaces, so name matching fails // we should really refactor events entirely - in the meantime, let it be an UmbracoTestBase ;( //var testObjects = new TestObjects(null); diff --git a/src/Umbraco.Tests/Clr/ReflectionUtilitiesTests.cs b/src/Umbraco.Tests/Clr/ReflectionUtilitiesTests.cs index f40ca3f500..0431e7d69f 100644 --- a/src/Umbraco.Tests/Clr/ReflectionUtilitiesTests.cs +++ b/src/Umbraco.Tests/Clr/ReflectionUtilitiesTests.cs @@ -309,7 +309,7 @@ namespace Umbraco.Tests.Clr setterInt4(object4, 42); Assert.AreEqual(42, object4.IntValue); - // fixme the code below runs fine with ReSharper test running within VisualStudio + // FIXME: the code below runs fine with ReSharper test running within VisualStudio // but it crashes when running via vstest.console.exe - unless some settings are required? // converting works @@ -552,7 +552,7 @@ namespace Umbraco.Tests.Clr Assert.AreEqual(44, getter3(c)); } - // fixme - missing tests specifying 'returned' on method, property + // FIXME: missing tests specifying 'returned' on method, property [Test] public void DeconstructAnonymousType() diff --git a/src/Umbraco.Tests/Components/ComponentTests.cs b/src/Umbraco.Tests/Components/ComponentTests.cs index a04636f919..390bb018da 100644 --- a/src/Umbraco.Tests/Components/ComponentTests.cs +++ b/src/Umbraco.Tests/Components/ComponentTests.cs @@ -23,7 +23,7 @@ namespace Umbraco.Tests.Components private static IFactory MockFactory(Action> setup = null) { - // fixme use IUmbracoDatabaseFactory vs UmbracoDatabaseFactory, clean it all up! + // FIXME: use IUmbracoDatabaseFactory vs UmbracoDatabaseFactory, clean it all up! var mock = new Mock(); @@ -444,7 +444,7 @@ namespace Umbraco.Tests.Components #region TypeArray - // fixme - move to Testing + // FIXME: move to Testing private static Type[] TypeArray() { diff --git a/src/Umbraco.Tests/Composing/ContainerConformingTests.cs b/src/Umbraco.Tests/Composing/ContainerConformingTests.cs index 21ea961636..86226b82e7 100644 --- a/src/Umbraco.Tests/Composing/ContainerConformingTests.cs +++ b/src/Umbraco.Tests/Composing/ContainerConformingTests.cs @@ -143,12 +143,11 @@ namespace Umbraco.Tests.Composing } [Test] - public void SingletonServiceIsUnique() // fixme - but what is LightInject actually doing + public void SingletonServiceIsUnique() // FIXME: but what is LightInject actually doing { var register = GetRegister(); - // fixme - // LightInject is 'unique' per serviceType+serviceName + // FIXME: LightInject is 'unique' per serviceType+serviceName // but that's not how all containers work // and we should not rely on it // if we need unique, use RegisterUnique diff --git a/src/Umbraco.Tests/CoreThings/UdiTests.cs b/src/Umbraco.Tests/CoreThings/UdiTests.cs index 35080e8c24..c700b78c4b 100644 --- a/src/Umbraco.Tests/CoreThings/UdiTests.cs +++ b/src/Umbraco.Tests/CoreThings/UdiTests.cs @@ -22,7 +22,7 @@ namespace Umbraco.Tests.CoreThings [SetUp] public void SetUp() { - // fixme - bad in a unit test - but Udi has a static ctor that wants it?! + // FIXME: bad in a unit test - but Udi has a static ctor that wants it?! var container = new Mock(); var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); container.Setup(x => x.GetInstance(typeof(TypeLoader))).Returns( diff --git a/src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs b/src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs index 088ef6b54b..1c0b407ac6 100644 --- a/src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs +++ b/src/Umbraco.Tests/FrontEnd/UmbracoHelperTests.cs @@ -406,7 +406,7 @@ namespace Umbraco.Tests.FrontEnd private void SetUpDependencyContainer() { - // fixme - bad in a unit test - but Udi has a static ctor that wants it?! + // FIXME: bad in a unit test - but Udi has a static ctor that wants it?! var container = new Mock(); var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); diff --git a/src/Umbraco.Tests/IO/FileSystemsTests.cs b/src/Umbraco.Tests/IO/FileSystemsTests.cs index 52de1bbcfa..1f98fd4443 100644 --- a/src/Umbraco.Tests/IO/FileSystemsTests.cs +++ b/src/Umbraco.Tests/IO/FileSystemsTests.cs @@ -122,7 +122,7 @@ namespace Umbraco.Tests.IO } - // fixme - don't make sense anymore + // FIXME: don't make sense anymore /* [Test] public void Cannot_Get_InvalidFileSystem() diff --git a/src/Umbraco.Tests/Logging/LogviewerTests.cs b/src/Umbraco.Tests/Logging/LogviewerTests.cs index 2feac2ae5f..75e2c66a61 100644 --- a/src/Umbraco.Tests/Logging/LogviewerTests.cs +++ b/src/Umbraco.Tests/Logging/LogviewerTests.cs @@ -199,7 +199,7 @@ namespace Umbraco.Tests.Logging Assert.IsNotNull(findItem, "We should have found the saved search, but get no results"); Assert.AreEqual(1, findItem.Count(), "Our list of searches should only contain one result"); - //TODO: Need someone to help me find out why these don't work + // TODO: Need someone to help me find out why these don't work //CollectionAssert.Contains(searches, savedSearch, "Can not find the new search that was saved"); //Assert.That(searches, Contains.Item(savedSearch)); diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index 4e791c0169..051c660c66 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -337,12 +337,12 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 Assert.AreEqual(2, config.Count); Assert.IsTrue(config.ContainsKey("image")); var c = config["image"]; - Assert.IsInstanceOf(c); // fixme - is this what we want? + Assert.IsInstanceOf(c); // FIXME: is this what we want? Assert.IsTrue(config.ContainsKey("link")); c = config["link"]; - Assert.IsInstanceOf(c); // fixme - is this what we want? + Assert.IsInstanceOf(c); // FIXME: is this what we want? - // fixme - should we resolveUrl in configs? + // FIXME: should we resolveUrl in configs? } [Test] diff --git a/src/Umbraco.Tests/Membership/MembershipProviderBaseTests.cs b/src/Umbraco.Tests/Membership/MembershipProviderBaseTests.cs index f1f46133c3..091ea6f9a0 100644 --- a/src/Umbraco.Tests/Membership/MembershipProviderBaseTests.cs +++ b/src/Umbraco.Tests/Membership/MembershipProviderBaseTests.cs @@ -120,8 +120,7 @@ namespace Umbraco.Tests.Membership Assert.Throws(() => provider.GetPassword("test", "test")); } - // fixme - // in v7 this test relies on ApplicationContext.Current being null, which makes little + // FIXME: in v7 this test relies on ApplicationContext.Current being null, which makes little // sense, not going to port the weird code in MembershipProviderBase.ResetPassword, so // what shall we do? [Test] diff --git a/src/Umbraco.Tests/Misc/UriUtilityTests.cs b/src/Umbraco.Tests/Misc/UriUtilityTests.cs index 42c69d3967..3dbd54c3a9 100644 --- a/src/Umbraco.Tests/Misc/UriUtilityTests.cs +++ b/src/Umbraco.Tests/Misc/UriUtilityTests.cs @@ -7,7 +7,7 @@ using Umbraco.Web; namespace Umbraco.Tests.Misc { - // fixme - not testing virtual directory! + // FIXME: not testing virtual directory! [TestFixture] public class UriUtilityTests diff --git a/src/Umbraco.Tests/Models/LightEntityTest.cs b/src/Umbraco.Tests/Models/LightEntityTest.cs index 1ec9f05822..f1752a7681 100644 --- a/src/Umbraco.Tests/Models/LightEntityTest.cs +++ b/src/Umbraco.Tests/Models/LightEntityTest.cs @@ -42,7 +42,7 @@ namespace Umbraco.Tests.Models var result = ss.ToStream(item); var json = result.ResultStream.ToJsonString(); - Debug.Print(json); // fixme compare with v7 + Debug.Print(json); // FIXME: compare with v7 } } } diff --git a/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs index b2d1440010..0de416ed72 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentTypeModelMappingTests.cs @@ -32,7 +32,7 @@ namespace Umbraco.Tests.Models.Mapping { base.SetUp(); - // fixme - are we initializing mappers that... have already been? + // FIXME: are we initializing mappers that... have already been? Mapper.Reset(); Mapper.Initialize(configuration => { @@ -97,7 +97,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(display.Groups.Count(), result.PropertyGroups.Count); for (var i = 0; i < display.Groups.Count(); i++) { @@ -157,7 +157,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(display.Groups.Count(), result.PropertyGroups.Count); for (var i = 0; i < display.Groups.Count(); i++) { @@ -221,7 +221,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(display.CreateDate, result.CreateDate); Assert.AreEqual(display.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(display.Groups.Count(), result.PropertyGroups.Count); for (var i = 0; i < display.Groups.Count(); i++) { @@ -276,7 +276,7 @@ namespace Umbraco.Tests.Models.Mapping //Assert - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(display.Groups.Count(x => x.Inherited == false), result.PropertyGroups.Count); } @@ -303,7 +303,7 @@ namespace Umbraco.Tests.Models.Mapping //Assert - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(display.Groups.Count(x => x.Inherited == false), result.PropertyGroups.Count); } @@ -337,7 +337,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(memberType.CreateDate, result.CreateDate); Assert.AreEqual(memberType.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(memberType.PropertyGroups.Count(), result.Groups.Count()); for (var i = 0; i < memberType.PropertyGroups.Count(); i++) @@ -393,7 +393,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(mediaType.CreateDate, result.CreateDate); Assert.AreEqual(mediaType.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(mediaType.PropertyGroups.Count(), result.Groups.Count()); for (var i = 0; i < mediaType.PropertyGroups.Count(); i++) @@ -447,7 +447,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); Assert.AreEqual(contentType.DefaultTemplate.Alias, result.DefaultTemplate.Alias); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(contentType.PropertyGroups.Count, result.Groups.Count()); for (var i = 0; i < contentType.PropertyGroups.Count; i++) @@ -748,7 +748,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(contentType.CreateDate, result.CreateDate); Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(contentType.CompositionPropertyGroups.Select(x => x.Name).Distinct().Count(), result.Groups.Count(x => x.IsGenericProperties == false)); Assert.AreEqual(1, result.Groups.Count(x => x.IsGenericProperties)); @@ -830,7 +830,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(contentType.UpdateDate, result.UpdateDate); Assert.AreEqual(contentType.DefaultTemplate.Alias, result.DefaultTemplate.Alias); - //TODO: Now we need to assert all of the more complicated parts + // TODO: Now we need to assert all of the more complicated parts Assert.AreEqual(contentType.CompositionPropertyGroups.Select(x => x.Name).Distinct().Count(), result.Groups.Count(x => x.IsGenericProperties == false)); Assert.AreEqual(1, result.Groups.Count(x => x.IsGenericProperties)); diff --git a/src/Umbraco.Tests/Models/Mapping/UserModelMapperTests.cs b/src/Umbraco.Tests/Models/Mapping/UserModelMapperTests.cs index f1dea9b587..bdab736cd1 100644 --- a/src/Umbraco.Tests/Models/Mapping/UserModelMapperTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/UserModelMapperTests.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.Models.Mapping var userGroupSave = JsonConvert.DeserializeObject(json.Replace("@@@ID@@@", userGroup.Id.ToString())); // failed, AutoMapper complained, "Unable to cast object of type 'WhereSelectArrayIterator`2[System.Char,System.String]' to type 'System.Collections.IList'". - // fixmed: added ToList() in UserGroupFactory + // FIXME: added ToList() in UserGroupFactory Mapper.Map(userGroupSave, userGroup); } } diff --git a/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs b/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs index 010572abec..df4071281c 100644 --- a/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs +++ b/src/Umbraco.Tests/Packaging/CreatedPackagesRepositoryTests.cs @@ -137,7 +137,7 @@ namespace Umbraco.Tests.Packaging def = PackageBuilder.GetById(def.Id); Assert.AreEqual("updated", def.Name); Assert.AreEqual(2, def.Files.Count); - //TODO: There's a whole lot more assertions to be done + // TODO: There's a whole lot more assertions to be done } @@ -191,7 +191,7 @@ namespace Umbraco.Tests.Packaging Assert.AreEqual("", xml.Element("umbPackage").Element("Actions").ToString(SaveOptions.DisableFormatting)); - //TODO: There's a whole lot more assertions to be done + // TODO: There's a whole lot more assertions to be done } } } diff --git a/src/Umbraco.Tests/Packaging/PackageInstallationTest.cs b/src/Umbraco.Tests/Packaging/PackageInstallationTest.cs index 4256a66a2d..731ce73d3d 100644 --- a/src/Umbraco.Tests/Packaging/PackageInstallationTest.cs +++ b/src/Umbraco.Tests/Packaging/PackageInstallationTest.cs @@ -126,7 +126,7 @@ namespace Umbraco.Tests.Packaging Assert.AreEqual(1, preInstallWarnings.FilesReplaced.Count()); Assert.AreEqual("bin\\Auros.DocumentTypePicker.dll", preInstallWarnings.FilesReplaced.First()); - //TODO: More Asserts + // TODO: More Asserts } [Test] diff --git a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs index 32689fe192..c276dc35ca 100644 --- a/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs +++ b/src/Umbraco.Tests/Persistence/DatabaseContextTests.cs @@ -54,7 +54,7 @@ namespace Umbraco.Tests.Persistence } [Test] - public void CreateDatabase() // fixme - move to DatabaseBuilderTest! + public void CreateDatabase() // FIXME: move to DatabaseBuilderTest! { var path = TestHelper.CurrentAssemblyDirectory; AppDomain.CurrentDomain.SetData("DataDirectory", path); diff --git a/src/Umbraco.Tests/Persistence/NPocoTests/NPocoBulkInsertTests.cs b/src/Umbraco.Tests/Persistence/NPocoTests/NPocoBulkInsertTests.cs index 3503318888..2a6c1f4e12 100644 --- a/src/Umbraco.Tests/Persistence/NPocoTests/NPocoBulkInsertTests.cs +++ b/src/Umbraco.Tests/Persistence/NPocoTests/NPocoBulkInsertTests.cs @@ -12,7 +12,7 @@ using Umbraco.Tests.Testing; namespace Umbraco.Tests.Persistence.NPocoTests { - // fixme.npoco - is this still appropriate? + // FIXME: npoco - is this still appropriate? // [TestFixture] [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] diff --git a/src/Umbraco.Tests/Persistence/NPocoTests/NPocoFetchTests.cs b/src/Umbraco.Tests/Persistence/NPocoTests/NPocoFetchTests.cs index 64bc825c3e..9ee50d1230 100644 --- a/src/Umbraco.Tests/Persistence/NPocoTests/NPocoFetchTests.cs +++ b/src/Umbraco.Tests/Persistence/NPocoTests/NPocoFetchTests.cs @@ -370,7 +370,7 @@ namespace Umbraco.Tests.Persistence.NPocoTests var sql = scope.SqlContext.Sql() .Select() - .Append(", COUNT(zbThing2Group.groupId) AS groupCount") // fixme + .Append(", COUNT(zbThing2Group.groupId) AS groupCount") // FIXME: .From() .InnerJoin().On((t, t2g) => t.Id == t2g.ThingId) .GroupBy(x => x.Id, x => x.Name); diff --git a/src/Umbraco.Tests/Persistence/NPocoTests/PetaPocoCachesTest.cs b/src/Umbraco.Tests/Persistence/NPocoTests/PetaPocoCachesTest.cs index db3b02bacf..f558a64499 100644 --- a/src/Umbraco.Tests/Persistence/NPocoTests/PetaPocoCachesTest.cs +++ b/src/Umbraco.Tests/Persistence/NPocoTests/PetaPocoCachesTest.cs @@ -15,7 +15,7 @@ using Umbraco.Tests.Testing; namespace Umbraco.Tests.Persistence.NPocoTests { - // fixme.npoco - what shall we do with those tests? + // FIXME: npoco - what shall we do with those tests? // [TestFixture, Ignore("fixme - ignored test")] [UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)] diff --git a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs index 03701dd3b5..96809c7bf6 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/ContentTypeRepositoryTest.cs @@ -59,7 +59,7 @@ namespace Umbraco.Tests.Persistence.Repositories return new EntityContainerRepository(scopeAccessor, AppCaches.Disabled, Logger, containerEntityType); } - //TODO Add test to verify SetDefaultTemplates updates both AllowedTemplates and DefaultTemplate(id). + // TODO: Add test to verify SetDefaultTemplates updates both AllowedTemplates and DefaultTemplate(id). [Test] public void Maps_Templates_Correctly() diff --git a/src/Umbraco.Tests/Persistence/Repositories/PublicAccessRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/PublicAccessRepositoryTest.cs index b7f354a2fb..b140aa078e 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/PublicAccessRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/PublicAccessRepositoryTest.cs @@ -230,7 +230,7 @@ namespace Umbraco.Tests.Persistence.Repositories //now remove a few rules from a few of the items and then add some more, this will put things 'out of order' which //we need to verify our sort order is working for the relator - // fixme - no "relator" in v8?! + // FIXME: no "relator" in v8?! for (int i = 0; i < allEntries.Count; i++) { //all the even ones diff --git a/src/Umbraco.Tests/Persistence/Repositories/RedirectUrlRepositoryTests.cs b/src/Umbraco.Tests/Persistence/Repositories/RedirectUrlRepositoryTests.cs index 66f6655c77..652209b65b 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/RedirectUrlRepositoryTests.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/RedirectUrlRepositoryTests.cs @@ -73,7 +73,7 @@ namespace Umbraco.Tests.Persistence.Repositories Assert.AreNotEqual(0, rurl.Id); - // fixme - too fast = same date = key violation? + // FIXME: too fast = same date = key violation? // and... can that happen in real life? // we don't really *care* about the IX, only supposed to make things faster... // BUT in realife we AddOrUpdate in a trx so it should be safe, always @@ -119,7 +119,7 @@ namespace Umbraco.Tests.Persistence.Repositories Assert.AreNotEqual(0, rurl.Id); - // fixme - goes too fast and bam, errors, first is blah + // FIXME: goes too fast and bam, errors, first is blah rurl = new RedirectUrl { diff --git a/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs index b927d23740..6acd63b2b3 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/TagRepositoryTest.cs @@ -454,7 +454,7 @@ namespace Umbraco.Tests.Persistence.Repositories contentType.PropertyTypes.First().Id, tags, false); - //TODO: This would be nice to be able to map the ids back but unfortunately we are not doing this + // TODO: This would be nice to be able to map the ids back but unfortunately we are not doing this //var result = repository.GetAll(new[] {tags[0].Id, tags[1].Id, tags[2].Id}); var all = repository.GetMany().ToArray(); diff --git a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs index 4ee6ecf9e3..779ec45a35 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/UserRepositoryTest.cs @@ -234,8 +234,7 @@ namespace Umbraco.Tests.Persistence.Repositories // Act var updatedItem = repository.Get(user.Id); - // fixme - // this test cannot work, user has 2 sections but the way it's created, + // FIXME: this test cannot work, user has 2 sections but the way it's created, // they don't show, so the comparison with updatedItem fails - fix! // Assert diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs index 42703f9bae..ac1c57d409 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentLanguageVariantTests.cs @@ -335,7 +335,7 @@ namespace Umbraco.Tests.PublishedContent { var content = UmbracoContext.Current.ContentCache.GetAtRoot().First().Children.First(); - // hack the value, pretend the converter would return something + // HACK: the value, pretend the converter would return something var prop = content.GetProperty("welcomeText") as SolidPublishedPropertyWithLanguageVariants; Assert.IsNotNull(prop); prop.SetValue("nl", "nope"); // HasValue false but getting value returns this diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs index d18c6b6668..c5bcd29589 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestBase.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests.PublishedContent { base.Compose(); - // fixme - what about the if (PropertyValueConvertersResolver.HasCurrent == false) ?? + // FIXME: what about the if (PropertyValueConvertersResolver.HasCurrent == false) ?? // can we risk double - registering and then, what happens? Composition.WithCollectionBuilder() diff --git a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs index 2d14aa1c08..0b98ec64b6 100644 --- a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs +++ b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.Publishing [Test] public void Can_Publish_And_Update_Xml_Cache() { - //TODO Create new test + // TODO: Create new test } public IEnumerable CreateTestData() diff --git a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs index 4059cb1858..2aa01916fb 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByAliasTests.cs @@ -9,7 +9,7 @@ using Umbraco.Web.Routing; namespace Umbraco.Tests.Routing { - //TODO: We should be able to decouple this from the base db tests since we're just mocking the services now + // TODO: We should be able to decouple this from the base db tests since we're just mocking the services now [TestFixture] public class ContentFinderByAliasTests : UrlRoutingTestBase diff --git a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs index 8bbd7c6679..c1abb5a3a5 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByPageIdQueryTests.cs @@ -10,9 +10,9 @@ namespace Umbraco.Tests.Routing { [TestCase("/?umbPageId=1046", 1046)] [TestCase("/?UMBPAGEID=1046", 1046)] - [TestCase("/default.aspx?umbPageId=1046", 1046)] //TODO: Should this match?? - [TestCase("/some/other/page?umbPageId=1046", 1046)] //TODO: Should this match?? - [TestCase("/some/other/page.aspx?umbPageId=1046", 1046)] //TODO: Should this match?? + [TestCase("/default.aspx?umbPageId=1046", 1046)] // TODO: Should this match?? + [TestCase("/some/other/page?umbPageId=1046", 1046)] // TODO: Should this match?? + [TestCase("/some/other/page.aspx?umbPageId=1046", 1046)] // TODO: Should this match?? public void Lookup_By_Page_Id(string urlAsString, int nodeMatch) { var umbracoContext = GetUmbracoContext(urlAsString); diff --git a/src/Umbraco.Tests/Routing/ContentFinderByUrlTests.cs b/src/Umbraco.Tests/Routing/ContentFinderByUrlTests.cs index fa8beea2c2..85168e4490 100644 --- a/src/Umbraco.Tests/Routing/ContentFinderByUrlTests.cs +++ b/src/Umbraco.Tests/Routing/ContentFinderByUrlTests.cs @@ -39,7 +39,7 @@ namespace Umbraco.Tests.Routing Assert.IsTrue(Current.Configs.Global().HideTopLevelNodeFromPath); - // fixme debugging - going further down, the routes cache is NOT empty?! + // FIXME: debugging - going further down, the routes cache is NOT empty?! if (urlString == "/home/sub1") System.Diagnostics.Debugger.Break(); diff --git a/src/Umbraco.Tests/Routing/GetContentUrlsTests.cs b/src/Umbraco.Tests/Routing/GetContentUrlsTests.cs index 8e9e52258c..46b10929cf 100644 --- a/src/Umbraco.Tests/Routing/GetContentUrlsTests.cs +++ b/src/Umbraco.Tests/Routing/GetContentUrlsTests.cs @@ -45,7 +45,7 @@ namespace Umbraco.Tests.Routing { var contentType = MockedContentTypes.CreateBasicContentType(); var content = MockedContent.CreateBasicContent(contentType); - content.Id = 1046; //fixme: we are using this ID only because it's built into the test XML published cache + content.Id = 1046; // FIXME: we are using this ID only because it's built into the test XML published cache content.Path = "-1,1046"; var umbContext = GetUmbracoContext("http://localhost:8000"); @@ -66,7 +66,7 @@ namespace Umbraco.Tests.Routing { var contentType = MockedContentTypes.CreateBasicContentType(); var content = MockedContent.CreateBasicContent(contentType); - content.Id = 1046; //fixme: we are using this ID only because it's built into the test XML published cache + content.Id = 1046; // FIXME: we are using this ID only because it's built into the test XML published cache content.Path = "-1,1046"; content.Published = true; @@ -92,13 +92,13 @@ namespace Umbraco.Tests.Routing { var contentType = MockedContentTypes.CreateBasicContentType(); var parent = MockedContent.CreateBasicContent(contentType); - parent.Id = 1046; //fixme: we are using this ID only because it's built into the test XML published cache + parent.Id = 1046; // FIXME: we are using this ID only because it's built into the test XML published cache parent.Name = "home"; parent.Path = "-1,1046"; parent.Published = true; var child = MockedContent.CreateBasicContent(contentType); child.Name = "sub1"; - child.Id = 1173; //fixme: we are using this ID only because it's built into the test XML published cache + child.Id = 1173; // FIXME: we are using this ID only because it's built into the test XML published cache child.Path = "-1,1046,1173"; child.Published = true; @@ -119,7 +119,7 @@ namespace Umbraco.Tests.Routing Assert.IsTrue(urls[0].IsUrl); } - //TODO: We need a lot of tests here, the above was just to get started with being able to unit test this method + // TODO: We need a lot of tests here, the above was just to get started with being able to unit test this method // * variant URLs without domains assigned, what happens? // * variant URLs with domains assigned, but also having more languages installed than there are domains/cultures assigned // * variant URLs with an ancestor culture unpublished diff --git a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs index e681c8556d..569f5382e8 100644 --- a/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs +++ b/src/Umbraco.Tests/Routing/RenderRouteHandlerTests.cs @@ -57,7 +57,7 @@ namespace Umbraco.Tests.Routing base.Compose(); // set the default RenderMvcController - Current.DefaultRenderMvcControllerType = typeof(RenderMvcController); // fixme WRONG! + Current.DefaultRenderMvcControllerType = typeof(RenderMvcController); // FIXME: Wrong! var surfaceControllerTypes = new SurfaceControllerTypeCollection(Composition.TypeLoader.GetSurfaceControllers()); Composition.RegisterUnique(surfaceControllerTypes); @@ -110,7 +110,7 @@ namespace Umbraco.Tests.Routing //test all template name styles to match the ActionName - //[TestCase("home-\\234^^*32page")] //TODO: This fails! + //[TestCase("home-\\234^^*32page")] // TODO: This fails! [TestCase("home-page")] [TestCase("home-page")] [TestCase("home-page")] diff --git a/src/Umbraco.Tests/Routing/RoutesCacheTests.cs b/src/Umbraco.Tests/Routing/RoutesCacheTests.cs index 68e80076dd..76c2a45ab2 100644 --- a/src/Umbraco.Tests/Routing/RoutesCacheTests.cs +++ b/src/Umbraco.Tests/Routing/RoutesCacheTests.cs @@ -22,7 +22,7 @@ namespace Umbraco.Tests.Routing var cache = umbracoContext.PublishedSnapshot.Content as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); - // fixme not sure? + // FIXME: not sure? //PublishedContentCache.UnitTesting = false; // else does not write to routes cache //Assert.IsFalse(PublishedContentCache.UnitTesting); diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index c87a02f43a..6d7668ceab 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -28,7 +28,7 @@ namespace Umbraco.Tests.Routing { base.SetUp(); - // fixme - be able to get the UmbracoModule from the container. any reason settings were from testobjects? + // FIXME: be able to get the UmbracoModule from the container. any reason settings were from testobjects? //create the module var logger = Mock.Of(); var globalSettings = TestObjects.GetGlobalSettings(); @@ -44,7 +44,7 @@ namespace Umbraco.Tests.Routing new UrlProviderCollection(new IUrlProvider[0]), runtime, logger, - null, // fixme - PublishedRouter complexities... + null, // FIXME: PublishedRouter complexities... Mock.Of() ); diff --git a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs index c894659865..ee3bca42e9 100644 --- a/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs +++ b/src/Umbraco.Tests/Runtimes/CoreRuntimeTests.cs @@ -110,7 +110,7 @@ namespace Umbraco.Tests.Runtimes return configs; } - // fixme so how the f* should we do it now? + // FIXME: so how the f* should we do it now? /* // pretend we have the proper migration // else BootFailedException because our mock IUmbracoDatabaseFactory does not provide databases diff --git a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs index 3a52eea17c..3790a49cfc 100644 --- a/src/Umbraco.Tests/Runtimes/StandaloneTests.cs +++ b/src/Umbraco.Tests/Runtimes/StandaloneTests.cs @@ -53,13 +53,13 @@ namespace Umbraco.Tests.Runtimes // settings // reset the current version to 0.0.0, clear connection strings ConfigurationManager.AppSettings["umbracoConfigurationStatus"] = ""; - // fixme we need a better management of settings here (and, true config files?) + // FIXME: we need a better management of settings here (and, true config files?) // create the very basic and essential things we need var logger = new ConsoleLogger(); var profiler = new LogProfiler(logger); var profilingLogger = new ProfilingLogger(logger, profiler); - var appCaches = new AppCaches(); // fixme has HttpRuntime stuff? + var appCaches = new AppCaches(); // FIXME: has HttpRuntime stuff? var databaseFactory = new UmbracoDatabaseFactory(logger, new Lazy(() => factory.GetInstance())); var typeLoader = new TypeLoader(appCaches.RuntimeCache, LocalTempStorage.Default, profilingLogger); var mainDom = new SimpleMainDom(); @@ -87,7 +87,7 @@ namespace Umbraco.Tests.Runtimes composers.Compose(); // must registers stuff that WebRuntimeComponent would register otherwise - // fixme UmbracoContext creates a snapshot that it does not register with the accessor + // FIXME: UmbracoContext creates a snapshot that it does not register with the accessor // and so, we have to use the UmbracoContextPublishedSnapshotAccessor // the UmbracoContext does not know about the accessor // else that would be a catch-22 where they both know about each other? @@ -177,7 +177,7 @@ namespace Umbraco.Tests.Runtimes Assert.AreEqual("test", content.Name); // need an UmbracoCOntext to access the cache - // fixme - not exactly pretty, should not depend on HttpContext + // FIXME: not exactly pretty, should not depend on HttpContext var httpContext = Mock.Of(); var withUmbracoContext = UmbracoContext.EnsureContext(httpContext); var umbracoContext = Umbraco.Web.Composing.Current.UmbracoContext; diff --git a/src/Umbraco.Tests/Scoping/PassThroughEventDispatcherTests.cs b/src/Umbraco.Tests/Scoping/PassThroughEventDispatcherTests.cs index 68e69f4cd6..c955f88f67 100644 --- a/src/Umbraco.Tests/Scoping/PassThroughEventDispatcherTests.cs +++ b/src/Umbraco.Tests/Scoping/PassThroughEventDispatcherTests.cs @@ -11,7 +11,7 @@ namespace Umbraco.Tests.Scoping [NUnit.Framework.Ignore("Cannot dispatch events on NoScope!")] public class PassThroughEventDispatcherTests { - // fixme so... should we remove, or enable, these tests? + // FIXME: so... should we remove, or enable, these tests? // [Test] // public void TriggersCancelableEvents() diff --git a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs index e8f3463ca7..d70b736bc2 100644 --- a/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedNuCacheTests.cs @@ -43,7 +43,7 @@ namespace Umbraco.Tests.Scoping // the cache refresher component needs to trigger to refresh caches // but then, it requires a lot of plumbing ;( - // fixme - and we cannot inject a DistributedCache yet + // FIXME: and we cannot inject a DistributedCache yet // so doing all this mess Composition.RegisterUnique(); Composition.RegisterUnique(f => Mock.Of()); diff --git a/src/Umbraco.Tests/Scoping/ScopedRepositoryTests.cs b/src/Umbraco.Tests/Scoping/ScopedRepositoryTests.cs index dee7a99ad0..b85a79f326 100644 --- a/src/Umbraco.Tests/Scoping/ScopedRepositoryTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedRepositoryTests.cs @@ -29,7 +29,7 @@ namespace Umbraco.Tests.Scoping // the cache refresher component needs to trigger to refresh caches // but then, it requires a lot of plumbing ;( - // fixme - and we cannot inject a DistributedCache yet + // FIXME: and we cannot inject a DistributedCache yet // so doing all this mess Composition.RegisterUnique(); Composition.RegisterUnique(f => Mock.Of()); diff --git a/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs b/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs index 568bafa4e6..11479ea3eb 100644 --- a/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs +++ b/src/Umbraco.Tests/Scoping/ScopedXmlTests.cs @@ -32,7 +32,7 @@ namespace Umbraco.Tests.Scoping // the cache refresher component needs to trigger to refresh caches // but then, it requires a lot of plumbing ;( - // fixme - and we cannot inject a DistributedCache yet + // FIXME: and we cannot inject a DistributedCache yet // so doing all this mess Composition.RegisterUnique(); Composition.RegisterUnique(f => Mock.Of()); diff --git a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs index 23e5e472a3..f0409d8928 100644 --- a/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs +++ b/src/Umbraco.Tests/Security/BackOfficeCookieManagerTests.cs @@ -69,6 +69,6 @@ namespace Umbraco.Tests.Security Assert.IsTrue(result); } - //TODO : Write remaining tests for `ShouldAuthenticateRequest` + // TODO: Write remaining tests for `ShouldAuthenticateRequest` } } diff --git a/src/Umbraco.Tests/Services/ContentServiceTagsTests.cs b/src/Umbraco.Tests/Services/ContentServiceTagsTests.cs index 62a3526af5..5e97bea2c1 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTagsTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTagsTests.cs @@ -35,7 +35,7 @@ namespace Umbraco.Tests.Services { base.Compose(); - // fixme - do it differently + // FIXME: do it differently Composition.Register(factory => factory.GetInstance().TextService); } @@ -392,11 +392,11 @@ namespace Umbraco.Tests.Services propertyType.Variations = ContentVariation.Nothing; contentTypeService.Save(contentType); - //fixme: This throws due to index violations + // FIXME: This throws due to index violations propertyType.Variations = ContentVariation.Culture; contentTypeService.Save(contentType); - //TODO: Assert results + // TODO: Assert results } [Test] @@ -526,7 +526,7 @@ namespace Umbraco.Tests.Services tags = tagService.GetTagsForEntity(content1.Id); Assert.AreEqual(5, tags.Count()); - // fixme tag & tree issue + // FIXME: tag & tree issue // when we publish, we 'just' publish the top one and not the ones below = fails // what we should do is... NOT clear tags when unpublishing or trashing or... // and just update the tag service to NOT return anything related to trashed or @@ -593,7 +593,7 @@ namespace Umbraco.Tests.Services var tags = tagService.GetTagsForEntity(content1.Id); Assert.AreEqual(0, tags.Count()); - // fixme tag & tree issue + // FIXME: tag & tree issue // when we (un)publish, we 'just' publish the top one and not the ones below = fails // see similar note above tags = tagService.GetTagsForEntity(content2.Id); diff --git a/src/Umbraco.Tests/Services/ContentServiceTests.cs b/src/Umbraco.Tests/Services/ContentServiceTests.cs index 039bcaed24..75eb01e0e3 100644 --- a/src/Umbraco.Tests/Services/ContentServiceTests.cs +++ b/src/Umbraco.Tests/Services/ContentServiceTests.cs @@ -38,8 +38,8 @@ namespace Umbraco.Tests.Services Logger = UmbracoTestOptions.Logger.Console)] public class ContentServiceTests : TestWithSomeContentBase { - //TODO Add test to verify there is only ONE newest document/content in {Constants.DatabaseSchema.Tables.Document} table after updating. - //TODO Add test to delete specific version (with and without deleting prior versions) and versions by date. + // TODO: Add test to verify there is only ONE newest document/content in {Constants.DatabaseSchema.Tables.Document} table after updating. + // TODO: Add test to delete specific version (with and without deleting prior versions) and versions by date. public override void SetUp() { @@ -2422,13 +2422,13 @@ namespace Umbraco.Tests.Services Assert.IsFalse(content.Published); Assert.IsTrue(content.Edited); - // fixme - depending on 1 line in ContentBaseFactory.BuildEntity + // FIXME: depending on 1 line in ContentBaseFactory.BuildEntity // the published infos can be gone or not // if gone, it's not consistent with above Assert.AreEqual(vpk, ((Content) content).VersionId); Assert.AreEqual(ppk, ((Content) content).PublishedVersionId); // still there - // fixme - depending on 1 line in ContentRepository.MapDtoToContent + // FIXME: depending on 1 line in ContentRepository.MapDtoToContent // the published values can be null or not // if null, it's not consistent with above //Assert.IsNull(content.GetValue("title", published: true)); @@ -2444,7 +2444,7 @@ namespace Umbraco.Tests.Services // //contentService.SaveAndPublish(content); - // fixme - what shall we do of all this? + // FIXME: what shall we do of all this? /* // this basically republishes a content // what if it never was published? @@ -2455,11 +2455,11 @@ namespace Umbraco.Tests.Services Assert.IsTrue(content.Published); Assert.IsFalse(content.Edited); - // fixme - should it be 2 or 3 + // FIXME: should it be 2 or 3 versions = contentService.GetVersions(content.Id); Assert.AreEqual(2, versions.Count()); - // fixme - now test rollbacks + // FIXME: now test rollbacks var version = contentService.GetByVersion(content.Id); // test that it gets a version - should be GetVersion var previousVersion = contentService.GetVersions(content.Id).Skip(1).FirstOrDefault(); // need an optimized way to do this content.CopyValues(version); // copies the edited value - always @@ -2498,7 +2498,7 @@ namespace Umbraco.Tests.Services //the name will be set to the default culture variant name Assert.AreEqual("name-us", content.Name); - //fixme - should we always sync the invariant name even on update? see EnsureInvariantNameValues + // FIXME: should we always sync the invariant name even on update? see EnsureInvariantNameValues ////updating the default culture variant name should also update the invariant name so they stay in sync //content.SetName("name-us-2", langUk.IsoCode); //contentService.Save(content); @@ -2663,7 +2663,7 @@ namespace Umbraco.Tests.Services var contentType = contentTypeService.Get("umbTextpage"); contentType.Variations = ContentVariation.Culture; contentType.AddPropertyType(new PropertyType(Constants.PropertyEditors.Aliases.TextBox, ValueStorageType.Nvarchar, "prop") { Variations = ContentVariation.Culture }); - // fixme add test w/ an invariant prop + // FIXME: add test w/ an invariant prop contentTypeService.Save(contentType); var contentService = ServiceContext.ContentService; diff --git a/src/Umbraco.Tests/Services/MemberServiceTests.cs b/src/Umbraco.Tests/Services/MemberServiceTests.cs index 13cde1c659..0c9c543b0d 100644 --- a/src/Umbraco.Tests/Services/MemberServiceTests.cs +++ b/src/Umbraco.Tests/Services/MemberServiceTests.cs @@ -33,7 +33,7 @@ namespace Umbraco.Tests.Services { base.SetUp(); - //hack! but we have no choice until we remove the SavePassword method from IMemberService + // HACK: but we have no choice until we remove the SavePassword method from IMemberService var providerMock = new Mock(ServiceContext.MemberService, ServiceContext.MemberTypeService) { CallBase = true }; providerMock.Setup(@base => @base.AllowManuallyChangingPassword).Returns(false); providerMock.Setup(@base => @base.PasswordFormat).Returns(MembershipPasswordFormat.Hashed); diff --git a/src/Umbraco.Tests/Services/PerformanceTests.cs b/src/Umbraco.Tests/Services/PerformanceTests.cs index 09743b350f..7d73d95e74 100644 --- a/src/Umbraco.Tests/Services/PerformanceTests.cs +++ b/src/Umbraco.Tests/Services/PerformanceTests.cs @@ -31,7 +31,7 @@ namespace Umbraco.Tests.Services [NUnit.Framework.Ignore("These should not be run by the server, only directly as they are only benchmark tests")] public class PerformanceTests : TestWithDatabaseBase { - // fixme probably making little sense in places due to scope creating a transaction?! + // FIXME: probably making little sense in places due to scope creating a transaction?! protected override string GetDbConnectionString() { diff --git a/src/Umbraco.Tests/Services/SectionServiceTests.cs b/src/Umbraco.Tests/Services/SectionServiceTests.cs index 84eb0d1cbc..d6bf26184b 100644 --- a/src/Umbraco.Tests/Services/SectionServiceTests.cs +++ b/src/Umbraco.Tests/Services/SectionServiceTests.cs @@ -48,7 +48,7 @@ namespace Umbraco.Tests.Services }; userGroupA.AddAllowedSection("media"); userGroupA.AddAllowedSection("settings"); - //TODO: This is failing the test + // TODO: This is failing the test ServiceContext.UserService.Save(userGroupA, new[] { user.Id }, false); var userGroupB = new UserGroup diff --git a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs index 0d39fcc9e5..5fd5710a79 100644 --- a/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs +++ b/src/Umbraco.Tests/Strings/DefaultShortStringHelperTests.cs @@ -68,7 +68,7 @@ namespace Umbraco.Tests.Strings BreakTermsOnUpper = true })); - // fixme - move to a "compose" thing? + // FIXME: move to a "compose" thing? Composition.RegisterUnique(f => _helper); } @@ -337,8 +337,8 @@ namespace Umbraco.Tests.Strings })); Assert.AreEqual("house*2", helper.CleanString("house (2)", CleanStringType.Alias)); - // FIXME but for a filename we want to keep them! - // FIXME and what about a url? + // FIXME: but for a filename we want to keep them! + // FIXME: and what about a url? } [Test] @@ -442,8 +442,8 @@ namespace Umbraco.Tests.Strings // E is a word (too short to be an acronym) // FF is an acronym - // FIXME "C" can't be an acronym - // FIXME "DBXreview" = acronym?! + // FIXME: "C" can't be an acronym + // FIXME: "DBXreview" = acronym?! Assert.AreEqual("aaa BBB CCc Ddd E FF", helper.CleanString("aaa BBB CCc Ddd E FF", CleanStringType.Alias)); // unchanged Assert.AreEqual("aaa Bbb Ccc Ddd E FF", helper.CleanString("aaa BBB CCc Ddd E FF", CleanStringType.Alias | CleanStringType.CamelCase)); diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs index 5978820601..602b5907d8 100644 --- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs +++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestControllerActivatorBase.cs @@ -64,7 +64,7 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting var globalSettings = SettingsForTests.GenerateMockGlobalSettings(); - // fixme v8? + // FIXME: v8? ////new app context //var dbCtx = new Mock(Mock.Of(), Mock.Of(), Mock.Of(), "test"); ////ensure these are set so that the appctx is 'Configured' diff --git a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestStartup.cs b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestStartup.cs index 6ba6b672db..95b5a3bfeb 100644 --- a/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestStartup.cs +++ b/src/Umbraco.Tests/TestHelpers/ControllerTesting/TestStartup.cs @@ -29,7 +29,7 @@ namespace Umbraco.Tests.TestHelpers.ControllerTesting { var httpConfig = new HttpConfiguration(); - //TODO: Enable this if you can't see the errors produced + // TODO: Enable this if you can't see the errors produced //var traceWriter = httpConfig.EnableSystemDiagnosticsTracing(); //traceWriter.IsVerbose = true; //traceWriter.MinimumLevel = TraceLevel.Debug; diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index cfd935cd82..37be4aea6d 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -129,7 +129,7 @@ namespace Umbraco.Tests.TestHelpers { if (_defaultUmbracoSettings == null) { - //TODO: Just make this mocks instead of reading from the config + // TODO: Just make this mocks instead of reading from the config var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/UmbracoSettings/web.config")); diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index b6f597bf46..dc692af36a 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -98,7 +98,7 @@ namespace Umbraco.Tests.TestHelpers File.Delete(umbracoSettingsFile); } - // fixme obsolete the dateTimeFormat thing and replace with dateDelta + // FIXME: obsolete the dateTimeFormat thing and replace with dateDelta public static void AssertPropertyValuesAreEqual(object actual, object expected, string dateTimeFormat = null, Func sorter = null, string[] ignoreProperties = null) { const int dateDeltaMilliseconds = 500; // .5s diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs index c56eae9cd8..660d0f201e 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects-Mocks.cs @@ -55,7 +55,7 @@ namespace Umbraco.Tests.TestHelpers /// A ServiceContext. public ServiceContext GetServiceContextMock(IFactory container = null) { - // fixme - else some tests break - figure it out + // FIXME: else some tests break - figure it out container = null; return ServiceContext.CreatePartial( @@ -125,8 +125,8 @@ namespace Umbraco.Tests.TestHelpers public IUmbracoSettingsSection GetUmbracoSettings() { - //fixme Why not use the SettingsForTest.GenerateMock ... ? - //fixme Shouldn't we use the default ones so they are the same instance for each test? + // FIXME: Why not use the SettingsForTest.GenerateMock ... ? + // FIXME: Shouldn't we use the default ones so they are the same instance for each test? var umbracoSettingsMock = new Mock(); var webRoutingSectionMock = new Mock(); diff --git a/src/Umbraco.Tests/TestHelpers/TestObjects.cs b/src/Umbraco.Tests/TestHelpers/TestObjects.cs index 109860146c..7a9702031b 100644 --- a/src/Umbraco.Tests/TestHelpers/TestObjects.cs +++ b/src/Umbraco.Tests/TestHelpers/TestObjects.cs @@ -236,9 +236,9 @@ namespace Umbraco.Tests.TestHelpers { if (databaseFactory == null) { - //var mappersBuilder = new MapperCollectionBuilder(Current.Container); // fixme - //mappersBuilder.AddCore(); - //var mappers = mappersBuilder.CreateCollection(); + // var mappersBuilder = new MapperCollectionBuilder(Current.Container); // FIXME: + // mappersBuilder.AddCore(); + // var mappers = mappersBuilder.CreateCollection(); var mappers = Current.Factory.GetInstance(); databaseFactory = new UmbracoDatabaseFactory(Constants.System.UmbracoConnectionName, logger, new Lazy(() => mappers)); } diff --git a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs index 2deb30bbdd..35085ddd85 100644 --- a/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs +++ b/src/Umbraco.Tests/TestHelpers/TestWithDatabaseBase.cs @@ -102,10 +102,10 @@ namespace Umbraco.Tests.TestHelpers public override void TearDown() { var profilingLogger = Factory.TryGetInstance(); - var timer = profilingLogger?.TraceDuration("teardown"); // fixme move that one up + var timer = profilingLogger?.TraceDuration("teardown"); // FIXME: move that one up try { - // fixme - should we first kill all scopes? + // FIXME: should we first kill all scopes? if (Options.Database == UmbracoTestOptions.Database.NewSchemaPerTest) RemoveDatabaseFile(); @@ -127,7 +127,7 @@ namespace Umbraco.Tests.TestHelpers { using (ProfilingLogger.TraceDuration("Create database.")) { - CreateSqlCeDatabase(); // todo faster! + CreateSqlCeDatabase(); // TODO: faster! } // ensure the configuration matches the current version for tests @@ -136,7 +136,7 @@ namespace Umbraco.Tests.TestHelpers using (ProfilingLogger.TraceDuration("Initialize database.")) { - InitializeDatabase(); // todo faster! + InitializeDatabase(); // TODO: faster! } } @@ -229,7 +229,7 @@ namespace Umbraco.Tests.TestHelpers protected IPublishedSnapshotService PublishedSnapshotService { get; set; } - protected override void Initialize() // fixme - should NOT be here! + protected override void Initialize() // FIXME: should NOT be here! { base.Initialize(); @@ -313,7 +313,7 @@ namespace Umbraco.Tests.TestHelpers } } - // fixme is this needed? + // FIXME: is this needed? private void CloseDbConnections(IUmbracoDatabase database) { //Ensure that any database connections from a previous test is disposed. diff --git a/src/Umbraco.Tests/Testing/UmbracoTestAttribute.cs b/src/Umbraco.Tests/Testing/UmbracoTestAttribute.cs index 2bf4ba2716..4013d93cd3 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestAttribute.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestAttribute.cs @@ -24,8 +24,9 @@ namespace Umbraco.Tests.Testing public bool AutoMapper { get => _autoMapper.ValueOrDefault(WithApplication); set => _autoMapper.Set(value); } private readonly Settable _autoMapper = new Settable(); + // FIXME: to be completed /// - /// Gets or sets a value indicating ... FIXME to be completed + /// Gets or sets a value indicating ... /// public bool PublishedRepositoryEvents { get => _publishedRepositoryEvents.ValueOrDefault(false); set => _publishedRepositoryEvents.Set(value); } private readonly Settable _publishedRepositoryEvents = new Settable(); diff --git a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs index 7cd7be240b..9616a26891 100644 --- a/src/Umbraco.Tests/Testing/UmbracoTestBase.cs +++ b/src/Umbraco.Tests/Testing/UmbracoTestBase.cs @@ -123,7 +123,7 @@ namespace Umbraco.Tests.Testing // get/merge the attributes marking the method and/or the classes Options = TestOptionAttributeBase.GetTestOptions(); - // fixme - align to runtimes & components - don't redo everything here + // FIXME: align to runtimes & components - don't redo everything here var (logger, profiler) = GetLoggers(Options.Logger); var proflogger = new ProfilingLogger(logger, profiler); @@ -427,7 +427,7 @@ namespace Umbraco.Tests.Testing // reset all other static things that should not be static ;( UriUtility.ResetAppDomainAppVirtualPath(); - SettingsForTests.Reset(); // fixme - should it be optional? + SettingsForTests.Reset(); // FIXME: should it be optional? Mapper.Reset(); diff --git a/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataContentService.cs b/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataContentService.cs index 5bc1fbfdaa..2c71d1fe3e 100644 --- a/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataContentService.cs +++ b/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataContentService.cs @@ -9,7 +9,7 @@ using Umbraco.Examine; namespace Umbraco.Tests.UmbracoExamine { - //TODO: This is ultra hack and still left over from legacy but still works for testing atm + // TODO: This is ultra hack and still left over from legacy but still works for testing atm public class ExamineDemoDataContentService { public const int ProtectedNode = 1142; diff --git a/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataMediaService.cs b/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataMediaService.cs index 8dcb170816..035a31b240 100644 --- a/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataMediaService.cs +++ b/src/Umbraco.Tests/UmbracoExamine/ExamineDemoDataMediaService.cs @@ -7,7 +7,7 @@ using System.Xml.XPath; namespace Umbraco.Tests.UmbracoExamine { - //TODO: This is ultra hack and still left over from legacy but still works for testing atm + // TODO: This is ultra hack and still left over from legacy but still works for testing atm internal class ExamineDemoDataMediaService { public ExamineDemoDataMediaService() diff --git a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs index 7bd47bed66..cf0bf689a1 100644 --- a/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs +++ b/src/Umbraco.Tests/Web/Controllers/ContentControllerTests.cs @@ -393,7 +393,7 @@ namespace Umbraco.Tests.Web.Controllers Assert.IsTrue(display.Errors.ContainsKey("_content_variant_en-US_")); } - //TODO: There are SOOOOO many more tests we should write - a lot of them to do with validation + // TODO: There are SOOOOO many more tests we should write - a lot of them to do with validation } } diff --git a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs index e95ae7b785..4bcad4f4d3 100644 --- a/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs +++ b/src/Umbraco.Tests/Web/TemplateUtilitiesTests.cs @@ -30,13 +30,13 @@ namespace Umbraco.Tests.Web { Current.Reset(); - // fixme - now UrlProvider depends on EntityService for GetUrl(guid) - this is bad + // FIXME: now UrlProvider depends on EntityService for GetUrl(guid) - this is bad // should not depend on more than IdkMap maybe - fix this! var entityService = new Mock(); entityService.Setup(x => x.GetId(It.IsAny(), It.IsAny())).Returns(Attempt.Fail()); var serviceContext = ServiceContext.CreatePartial(entityService: entityService.Object); - // fixme - bad in a unit test - but Udi has a static ctor that wants it?! + // FIXME: bad in a unit test - but Udi has a static ctor that wants it?! var factory = new Mock(); factory.Setup(x => x.GetInstance(typeof(TypeLoader))).Returns( new TypeLoader(NoAppCache.Instance, LocalTempStorage.Default, new ProfilingLogger(Mock.Of(), Mock.Of()))); diff --git a/src/Umbraco.Web.UI.Client/lib/bootstrap/less/forms.less b/src/Umbraco.Web.UI.Client/lib/bootstrap/less/forms.less index 9f4ef4b8f9..6bbbacd1e3 100644 --- a/src/Umbraco.Web.UI.Client/lib/bootstrap/less/forms.less +++ b/src/Umbraco.Web.UI.Client/lib/bootstrap/less/forms.less @@ -239,7 +239,7 @@ textarea { } // Radios and checkboxes on same line -// TODO v3: Convert .inline to .control-inline +// TODO: v3: Convert .inline to .control-inline .radio.inline, .checkbox.inline { display: inline-block; diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacySpeechBubble.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacySpeechBubble.js index f973cbac49..05568354e6 100644 --- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacySpeechBubble.js +++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacySpeechBubble.js @@ -1,5 +1,5 @@  -//TODO: WE NEED TO CONVERT ALL OF THESE METHODS TO PROXY TO OUR APPLICATION SINCE MANY CUSTOM APPS USE THIS! +// TODO: WE NEED TO CONVERT ALL OF THESE METHODS TO PROXY TO OUR APPLICATION SINCE MANY CUSTOM APPS USE THIS! Umbraco.Sys.registerNamespace("Umbraco.Application"); diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js index b92f8c0807..891e8f0e7b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js @@ -178,7 +178,7 @@ function loginSubmit(login, password) { - //TODO: Do validation properly like in the invite password update + // TODO: Do validation properly like in the invite password update //if the login and password are not empty we need to automatically // validate them - this is because if there are validation errors on the server @@ -242,7 +242,7 @@ function requestPasswordResetSubmit(email) { - //TODO: Do validation properly like in the invite password update + // TODO: Do validation properly like in the invite password update if (email && email.length > 0) { vm.requestPasswordResetForm.email.$setValidity('auth', true); @@ -286,7 +286,7 @@ return; } - //TODO: All of this logic can/should be shared! We should do validation the nice way instead of all of this manual stuff, see: inviteSavePassword + // TODO: All of this logic can/should be shared! We should do validation the nice way instead of all of this manual stuff, see: inviteSavePassword authResource.performSetPassword(vm.resetPasswordCodeInfo.resetCodeModel.userId, password, confirmPassword, vm.resetPasswordCodeInfo.resetCodeModel.resetCode) .then(function () { vm.showSetPasswordConfirmation = true; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbbutton.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbbutton.directive.js index 923cac80f5..8ad71226ba 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbbutton.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/buttons/umbbutton.directive.js @@ -99,7 +99,7 @@ Use this directive to render an umbraco button. The directive can be used to gen } }); - //TODO: This doesn't seem necessary? + // TODO: This doesn't seem necessary? UmbButtonController.$inject = ['$timeout', 'localizationService']; function UmbButtonController($timeout, localizationService) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js index af07925021..addbb3b11b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/content/umbvariantcontenteditors.directive.js @@ -8,7 +8,7 @@ templateUrl: 'views/components/content/umb-variant-content-editors.html', bindings: { page: "<", - content: "<", //TODO: Not sure if this should be = since we are changing the 'active' property of a variant + content: "<", // TODO: Not sure if this should be = since we are changing the 'active' property of a variant culture: "<", onSelectApp: "&?" }, @@ -243,7 +243,7 @@ } } - //TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular + // TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular editor.collapsed = true; editor.loading = true; $timeout(function () { @@ -255,7 +255,7 @@ /** Closes the split view */ function closeSplitView(editorIndex) { - //TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular + // TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular var editor = vm.editors[editorIndex]; editor.loading = true; editor.collapsed = true; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontainer.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontainer.directive.js index d4b0fb158e..b7bcfa9eb4 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontainer.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorcontainer.directive.js @@ -46,7 +46,7 @@ Use this directive to construct a main content area inside the main editor windo scope.numberOfOverlays = 0; - //TODO: this shouldn't be a watch, this should be based on an event handler + // TODO: this shouldn't be a watch, this should be based on an event handler scope.$watch(function () { return overlayHelper.getNumberOfOverlays(); }, function (newValue) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index 372fb472fa..0a8846f975 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -10,7 +10,7 @@ angular.module("umbraco.directives") replace: true, link: function (scope, element, attrs) { - //TODO: A lot of the code below should be shared between the grid rte and the normal rte + // TODO: A lot of the code below should be shared between the grid rte and the normal rte var promises = []; @@ -73,7 +73,7 @@ angular.module("umbraco.directives") }); - //TODO: Perhaps we should pin the toolbar for the rte always, regardless of if it's in the grid or not? + // TODO: Perhaps we should pin the toolbar for the rte always, regardless of if it's in the grid or not? // this would mean moving this code into the tinyMceService.initializeEditor //when we leave the editor (maybe) @@ -116,7 +116,7 @@ angular.module("umbraco.directives") loadTinyMce(); - //TODO: This should probably be in place for all RTE, not just for the grid, which means + // TODO: This should probably be in place for all RTE, not just for the grid, which means // this code can live in tinyMceService.initializeEditor var tabShownListener = eventsService.on("app.tabChange", function (e, args) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/imaging/umbimagegravity.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/imaging/umbimagegravity.directive.js index a70b8ca33e..5732fa0eac 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/imaging/umbimagegravity.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/imaging/umbimagegravity.directive.js @@ -131,7 +131,7 @@ function onDestroy() { $(window).off('resize.umbImageGravity'); if (htmlOverlay) { - //TODO: This should be destroyed but this will throw an exception: + // TODO: This should be destroyed but this will throw an exception: // "cannot call methods on draggable prior to initialization; attempted to call method 'destroy'" // I've tried lots of things and cannot get this to work, we weren't destroying before so hopefully // there's no mem leaks? diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlaybackdrop.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlaybackdrop.directive.js index 927481952a..6c5fb86134 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlaybackdrop.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/overlays/umboverlaybackdrop.directive.js @@ -7,7 +7,7 @@ scope.numberOfOverlays = 0; - //TODO: this shouldn't be a watch, this should be based on an event handler + // TODO: this shouldn't be a watch, this should be based on an event handler scope.$watch(function () { return overlayHelper.getNumberOfOverlays(); }, function (newValue) { diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js index 052f497ee9..c3243993c1 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js @@ -80,7 +80,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use // entire tree again since we already still have it in memory. Of course if the section is different we will // reload it. This saves a lot on processing if someone is navigating in and out of the same section many times // since it saves on data retreival and DOM processing. - //TODO: This isn't used!? + // TODO: This isn't used!? var lastSection = ""; /** Helper function to emit tree events */ @@ -92,7 +92,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use } } - //TODO: This isn't used!? + // TODO: This isn't used!? function clearCache(section) { treeService.clearCache({ section: section }); } @@ -300,7 +300,7 @@ function umbTreeDirective($q, $rootScope, treeService, notificationsService, use return ''; } - //TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time + // TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time // it would be better if we could cache the processing. The problem is that some of these things are dynamic. var css = []; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js index 4440ceeb4b..19ecdaf8d9 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtreeitem.directive.js @@ -61,7 +61,7 @@ angular.module("umbraco.directives") return ''; } - //TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time + // TODO: This is called constantly because as a method in a template it's re-evaluated pretty much all the time // it would be better if we could cache the processing. The problem is that some of these things are dynamic. var css = []; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js index 11c94d04c0..15f5a1d46a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbgroupsbuilder.directive.js @@ -301,7 +301,7 @@ //based on the selection, we need to filter the available composite types list filterAvailableCompositions(selectedContentType, newSelection).then(function () { - //TODO: Here we could probably re-enable selection if we previously showed a throbber or something + // TODO: Here we could probably re-enable selection if we previously showed a throbber or something }); }); } @@ -311,7 +311,7 @@ //based on the selection, we need to filter the available composite types list filterAvailableCompositions(selectedContentType, newSelection).then(function () { - //TODO: Here we could probably re-enable selection if we previously showed a throbber or something + // TODO: Here we could probably re-enable selection if we previously showed a throbber or something }); } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/upload/umbpropertyfileupload.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/upload/umbpropertyfileupload.directive.js index 7ace23a988..e5bdd3ca78 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/upload/umbpropertyfileupload.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/upload/umbpropertyfileupload.directive.js @@ -92,7 +92,7 @@ vm.culture = null; } - //TODO: need to figure out what we can do for things like Nested Content + // TODO: need to figure out what we can do for things like Nested Content var existingClientFiles = checkPendingClientFiles(); //create the property to show the list of files currently saved diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js index 7cc109a5c0..f8dbefa5d7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js @@ -135,7 +135,7 @@ !$scope.config.enablePasswordRetrieval && !$scope.showReset; }; - //TODO: I don't think we need this or the cancel button, this can be up to the editor rendering this directive + // TODO: I don't think we need this or the cancel button, this can be up to the editor rendering this directive $scope.showCancelBtn = function () { return $scope.config.disableToggle !== true && $scope.config.hasPassword; }; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js index 5568b4b276..9ee83dc2ba 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valpropertymsg.directive.js @@ -42,12 +42,12 @@ function valPropertyMsg(serverValidationManager) { return err.errorMsg; } else { - //TODO: localize + // TODO: localize return scope.currentProperty.propertyErrorMessage ? scope.currentProperty.propertyErrorMessage : "Property has errors"; } } - //TODO: localize + // TODO: localize return "Property has errors"; } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valsubview.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valsubview.directive.js index d5a21e0ba6..524b5f7efe 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/validation/valsubview.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/validation/valsubview.directive.js @@ -15,7 +15,7 @@ return { valStatusChanged: function (args) { - //TODO: Verify this is correct, does $scope.model ever exist? + // TODO: Verify this is correct, does $scope.model ever exist? if ($scope.model) { if (!args.form.$valid) { var subViewContent = $element.find(".ng-invalid"); diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/dashboard.mocks.js b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/dashboard.mocks.js index 7582db6740..e19fabfe61 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/resources/dashboard.mocks.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/resources/dashboard.mocks.js @@ -8,7 +8,7 @@ angular.module('umbraco.mocks'). return [401, null, null]; } else { - //TODO: return real mocked data + // TODO: return real mocked data return [200, [], null]; } } diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js index 4f9b9a21f8..678cffe42e 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/auth.resource.js @@ -130,7 +130,7 @@ function authResource($q, $http, umbRequestHelper, angularHelper) { }); } - //TODO: This validation shouldn't really be done here, the validation on the login dialog + // TODO: This validation shouldn't really be done here, the validation on the login dialog // is pretty hacky which is why this is here, ideally validation on the login dialog would // be done properly. var emailRegex = /\S+@\S+\.\S+/; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js b/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js index 86d5510ca4..9b1d92f2b0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js @@ -358,7 +358,7 @@ angular.module('umbraco.services').factory("editorState", function() { } }; - //TODO: This shouldn't be removed! use getCurrent() method instead of a hacked readonly property which is confusing. + // TODO: This shouldn't be removed! use getCurrent() method instead of a hacked readonly property which is confusing. //create a get/set property but don't allow setting Object.defineProperty(state, "current", { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js index 1258ec4099..b9bc4eb499 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/contenteditinghelper.service.js @@ -35,7 +35,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica return { /** Used by the content editor and mini content editor to perform saving operations */ - //TODO: Make this a more helpful/reusable method for other form operations! we can simplify this form most forms + // TODO: Make this a more helpful/reusable method for other form operations! we can simplify this form most forms // = this is already done in the formhelper service contentEditorPerformSave: function (args) { if (!angular.isObject(args)) { @@ -421,7 +421,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica */ reBindChangedProperties: function (origContent, savedContent) { - //TODO: We should probably split out this logic to deal with media/members separately to content + // TODO: We should probably split out this logic to deal with media/members separately to content //a method to ignore built-in prop changes var shouldIgnore = function (propName) { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/formhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/formhelper.service.js index 191e0a22c0..b6bcafbddf 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/formhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/formhelper.service.js @@ -121,7 +121,7 @@ function formHelper(angularHelper, serverValidationManager, notificationsService } else { - //TODO: All YSOD handling should be done with an interceptor + // TODO: All YSOD handling should be done with an interceptor overlayService.ysod(err); } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/iconhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/iconhelper.service.js index a57fd606aa..0fa2d0df1a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/iconhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/iconhelper.service.js @@ -56,7 +56,7 @@ function iconHelper($q, $timeout) { { oldIcon: ".sprTreeSettingDataType", newIcon: "icon-autofill" }, - //TODO: + // TODO: Something needs to be done with the old tree icons that are commented out. /* { oldIcon: ".sprTreeSettingAgent", newIcon: "" }, { oldIcon: ".sprTreeSettingCss", newIcon: "" }, diff --git a/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js b/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js index 1b7a6da764..2a9afdfa94 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js @@ -24,7 +24,7 @@ angular.module('umbraco.services') .factory('localizationService', function ($http, $q, eventsService, $window, $filter, userService) { - //TODO: This should be injected as server vars + // TODO: This should be injected as server vars var url = "LocalizedText"; var resourceFileLoadStatus = "none"; var resourceLoadingPromise = []; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js index 5db9e9c77e..16c5b38a79 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/mediahelper.service.js @@ -66,7 +66,7 @@ function mediaHelper(umbRequestHelper) { }); //for now we'll just return the first image in the collection. - //TODO: we should enable returning many to be displayed in the picker if the uploader supports many. + // TODO: we should enable returning many to be displayed in the picker if the uploader supports many. if (mediaVal.length && mediaVal.length > 0) { if (!options.imageOnly || (options.imageOnly === true && mediaVal[0].isImage)) { return mediaVal[0].file; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/mediatypehelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/mediatypehelper.service.js index 7e0e1db24f..a347279fdb 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/mediatypehelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/mediatypehelper.service.js @@ -22,7 +22,7 @@ function mediaTypeHelper(mediaTypeResource, $q) { getAllowedImagetypes: function (mediaId){ - //TODO: This is horribly inneficient - why make one request per type!? + // TODO: This is horribly inneficient - why make one request per type!? //This should make a call to c# to get exactly what it's looking for instead of returning every single media type and doing //some filtering on the client side. //This is also called multiple times when it's not needed! Example, when launching the media picker, this will be called twice diff --git a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js index f0a3239602..04c431767c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js @@ -151,7 +151,7 @@ angular.module('umbraco.services') }, - //TODO: This doesn't do anything! + // TODO: This doesn't do anything! setCurrent: function (sectionAlias) { var currentSection = sectionAlias; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 97d939bac1..ffb9fe0f36 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -680,7 +680,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s //supported keys to move to the next or prev element (13-enter, 27-esc, 38-up, 40-down, 39-right, 37-left) //supported keys to remove the macro (8-backspace, 46-delete) - //TODO: Should we make the enter key insert a line break before or leave it as moving to the next element? + // TODO: Should we make the enter key insert a line break before or leave it as moving to the next element? if ($.inArray(e.keyCode, [13, 40, 39]) !== -1) { //move to next element moveSibling(macroElement, true); @@ -1358,7 +1358,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s self.createAceCodeEditor(args.editor, function () { - //TODO: CHECK TO SEE WHAT WE NEED TO DO WIT MACROS (See code block?) + // TODO: CHECK TO SEE WHAT WE NEED TO DO WIT MACROS (See code block?) /* var html = editor.getContent({source_view: true}); html = html.replace(/]*)>([^<]*)<\/span>/gm, String.fromCharCode(chr)); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tour.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tour.service.js index 28ac7f6485..e102da5d34 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tour.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tour.service.js @@ -114,7 +114,7 @@ * @returns {Object} Returns the current tour */ function getCurrentTour() { - //TODO: This should be reset if a new user logs in + // TODO: This should be reset if a new user logs in return currentTour; } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js index 1e6fc5d643..cbe9b561a0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/umbdataformatter.service.js @@ -66,7 +66,7 @@ 'alias', 'description', 'thumbnail', 'name', 'id', 'icon', 'trashed', 'key', 'parentId', 'alias', 'path', 'allowCultureVariant', 'isElement'); - //TODO: Map these + // TODO: Map these saveModel.allowedTemplates = _.map(displayModel.allowedTemplates, function (t) { return t.alias; }); saveModel.defaultTemplate = displayModel.defaultTemplate ? displayModel.defaultTemplate.alias : null; var realGroups = _.reject(displayModel.groups, function (g) { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js index fb1a1b8d5e..6991c5d386 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js @@ -177,7 +177,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe //show a ysod dialog if (Umbraco.Sys.ServerVariables["isDebuggingEnabled"] === true) { const error = { errorMsg: 'An error occured', data: response.data }; - //TODO: All YSOD handling should be done with an interceptor + // TODO: All YSOD handling should be done with an interceptor overlayService.ysod(error); } else { @@ -270,7 +270,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe formHelper.showNotifications(response.data); } - //TODO: Do we need to pass the result through umbDataFormatter.formatContentGetData? Right now things work so not sure but we should check + // TODO: Do we need to pass the result through umbDataFormatter.formatContentGetData? Right now things work so not sure but we should check //the data returned is the up-to-date data so the UI will refresh return $q.resolve(response.data); @@ -289,7 +289,7 @@ function umbRequestHelper($http, $q, notificationsService, eventsService, formHe else if (Umbraco.Sys.ServerVariables["isDebuggingEnabled"] === true) { //show a ysod dialog const error = { errorMsg: 'An error occured', data: response.data }; - //TODO: All YSOD handling should be done with an interceptor + // TODO: All YSOD handling should be done with an interceptor overlayService.ysod(error); } else { diff --git a/src/Umbraco.Web.UI.Client/src/controllers/navigation.controller.js b/src/Umbraco.Web.UI.Client/src/controllers/navigation.controller.js index e023c6d23c..96f3115185 100644 --- a/src/Umbraco.Web.UI.Client/src/controllers/navigation.controller.js +++ b/src/Umbraco.Web.UI.Client/src/controllers/navigation.controller.js @@ -137,7 +137,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar navigationService.showSearch(); }); - ////TODO: remove this it's not a thing + //// TODO: remove this it's not a thing //$scope.selectedId = navigationService.currentId; var evts = []; @@ -423,7 +423,7 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar var path = treeService.getPath(currNode); promises.push($scope.treeApi.syncTree({ path: path, activate: true })); } - //TODO: If we want to keep all paths expanded ... but we need more testing since we need to deal with unexpanding + // TODO: If we want to keep all paths expanded ... but we need more testing since we need to deal with unexpanding //for (var i = 0; i < expandedPaths.length; i++) { // promises.push($scope.treeApi.syncTree({ path: expandedPaths[i], activate: false, forceReload: true })); //} @@ -441,16 +441,16 @@ function NavigationController($scope, $rootScope, $location, $log, $q, $routePar }; //this reacts to the options item in the tree - //TODO: migrate to nav service - //TODO: is this used? + // TODO: migrate to nav service + // TODO: is this used? $scope.searchShowMenu = function (ev, args) { //always skip default args.skipDefault = true; navigationService.showMenu(args); }; - //TODO: migrate to nav service - //TODO: is this used? + // TODO: migrate to nav service + // TODO: is this used? $scope.searchHide = function () { navigationService.hideSearch(); }; diff --git a/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js b/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js index cdf5f8c980..3dbc4e119b 100644 --- a/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js +++ b/src/Umbraco.Web.UI.Client/src/installer/installer.controller.js @@ -1,7 +1,7 @@ angular.module("umbraco.install").controller("Umbraco.InstallerController", function ($scope, installerService) { - //TODO: Decouple the service from the controller - the controller should be responsible + // TODO: Decouple the service from the controller - the controller should be responsible // for the model (state) and the service should be responsible for helping the controller, // the controller should be passing the model into it's methods for manipulation and not hold // state. We should not be assigning properties from a service to a controller's scope. diff --git a/src/Umbraco.Web.UI.Client/src/less/components/tree/umb-tree.less b/src/Umbraco.Web.UI.Client/src/less/components/tree/umb-tree.less index bd493cf0d3..38860e6d22 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/tree/umb-tree.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/tree/umb-tree.less @@ -15,7 +15,7 @@ outline: none; text-decoration: none; - // TODO => confirm not in use + // TODO: => confirm not in use // &.noSpr { // background-position: 0 // } diff --git a/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less b/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less index a4c744bf7f..9dc6aa1906 100644 --- a/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less +++ b/src/Umbraco.Web.UI.Client/src/less/components/umb-grid.less @@ -1,4 +1,4 @@ -// TODO General cleanup in !important (Round 2) +// TODO: General cleanup in !important (Round 2) // Gridview // ------------------------- diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less index e3350b4956..f9bb860b5e 100644 --- a/src/Umbraco.Web.UI.Client/src/less/forms.less +++ b/src/Umbraco.Web.UI.Client/src/less/forms.less @@ -368,7 +368,7 @@ textarea { } // Radios and checkboxes on same line -// TODO v3: Convert .inline to .control-inline +// TODO: v3: Convert .inline to .control-inline .radio.inline, .checkbox.inline { display: inline-block; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js index 346bddf00f..4a43c340db 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/treepicker/treepicker.controller.js @@ -63,7 +63,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController", function initDialogTree() { vm.dialogTreeApi.callbacks.treeLoaded(treeLoadedHandler); - //TODO: Also deal with unexpanding!! + // TODO: Also deal with unexpanding!! vm.dialogTreeApi.callbacks.treeNodeExpanded(nodeExpandedHandler); vm.dialogTreeApi.callbacks.treeNodeSelect(nodeSelectHandler); } @@ -111,7 +111,7 @@ angular.module("umbraco").controller("Umbraco.Editors.TreePickerController", } } - //TODO: Seems odd this logic is here, i don't think it needs to be and should just exist on the property editor using this + // TODO: Seems odd this logic is here, i don't think it needs to be and should just exist on the property editor using this if ($scope.model.minNumber) { $scope.model.minNumber = parseInt($scope.model.minNumber, 10); } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/apps/content/content.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/apps/content/content.controller.js index 2bde680bf4..2a3f67a7e3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/apps/content/content.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/apps/content/content.controller.js @@ -26,7 +26,7 @@ if (newVal !== oldVal) { vm.loading = true; - //TODO: Can we minimize the flicker? + // TODO: Can we minimize the flicker? $timeout(function () { onInit(); }, 100); diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.delete.controller.js index e594bae2f4..56ce67a0dc 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.delete.controller.js @@ -65,7 +65,7 @@ function ContentDeleteController($scope, $timeout, contentResource, treeService, //check if response is ysod if (err.status && err.status >= 500) { - //TODO: All YSOD handling should be done with an interceptor + // TODO: All YSOD handling should be done with an interceptor overlayService.ysod(err); } }); diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.controller.js index 9074834ee6..82432ba78d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publish.controller.js @@ -27,7 +27,7 @@ //and it's not publishable or not selected to be published //then we cannot continue - //TODO: Show a message when this occurs + // TODO: Show a message when this occurs return false; } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js index c2ffbced04..0ca2fe65c9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/publishdescendants.controller.js @@ -69,7 +69,7 @@ //and not flagged for saving //then we cannot continue - //TODO: Show a message when this occurs + // TODO: Show a message when this occurs return false; } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js index 6991a7b509..d97bfc77b1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/overlays/schedule.controller.js @@ -333,7 +333,7 @@ //and it's not publishable or not selected to be published //then we cannot continue - //TODO: Show a message when this occurs + // TODO: Show a message when this occurs return false; } diff --git a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/delete.controller.js index cc5e4b32a9..80c716732e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/contentblueprints/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/contentblueprints/delete.controller.js @@ -18,7 +18,7 @@ function ContentBlueprintDeleteController($scope, contentResource, treeService, $scope.currentNode.loading = false; //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/content/redirecturls.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/content/redirecturls.controller.js index 9cef913e79..8206d0a114 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/content/redirecturls.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/content/redirecturls.controller.js @@ -2,12 +2,11 @@ "use strict"; function RedirectUrlsController($scope, redirectUrlsResource, notificationsService, localizationService, $q) { - //...todo - //search by url or url part - //search by domain - //display domain in dashboard results? + // TODO: search by url or url part + // TODO: search by domain + // TODO: display domain in dashboard results? - //used to cancel any request in progress if another one needs to take it's place + // used to cancel any request in progress if another one needs to take it's place var vm = this; var canceler = null; diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js index a5e4125742..10037db166 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/settings/examinemanagement.controller.js @@ -148,8 +148,8 @@ function ExamineManagementController($scope, umbRequestHelper, $http, $q, $timeo 'Failed to rebuild index') .then(function() { - //rebuilding has started, nothing is returned accept a 200 status code. - //lets poll to see if it is done. + // rebuilding has started, nothing is returned accept a 200 status code. + // lets poll to see if it is done. $timeout(() => { checkProcessing(index, "PostCheckRebuildIndex"), 1000 }); }); @@ -157,7 +157,7 @@ function ExamineManagementController($scope, umbRequestHelper, $http, $q, $timeo } function init() { - //go get the data + // go get the data //combine two promises and execute when they are both done $q.all([ diff --git a/src/Umbraco.Web.UI.Client/src/views/datatypes/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/datatypes/create.controller.js index 6cce37943e..15e1a9402e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/datatypes/create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/datatypes/create.controller.js @@ -32,7 +32,7 @@ function DataTypeCreateController($scope, $location, navigationService, dataType }, function(err) { - //TODO: Handle errors + // TODO: Handle errors }); }; } diff --git a/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.delete.controller.js index 101d74b16b..470e9b5f1e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/datatypes/datatype.delete.controller.js @@ -18,7 +18,7 @@ function DataTypeDeleteController($scope, dataTypeResource, treeService, navigat //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); @@ -35,7 +35,7 @@ function DataTypeDeleteController($scope, dataTypeResource, treeService, navigat //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/delete.controller.js index c920e05480..d7d8082048 100644 --- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/delete.controller.js @@ -18,7 +18,7 @@ function DocumentTypesDeleteController($scope, dataTypeResource, contentTypeReso //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); @@ -35,7 +35,7 @@ function DocumentTypesDeleteController($scope, dataTypeResource, contentTypeReso //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js index 70b5120ebe..ab057f87a4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/media.delete.controller.js @@ -59,7 +59,7 @@ function MediaDeleteController($scope, mediaResource, treeService, navigationSer //check if response is ysod if (err.status && err.status >= 500) { - //TODO: All YSOD handling should be done with an interceptor + // TODO: All YSOD handling should be done with an interceptor overlayService.ysod(err); } diff --git a/src/Umbraco.Web.UI.Client/src/views/mediatypes/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/mediatypes/delete.controller.js index 785550684b..f4b61d55dd 100644 --- a/src/Umbraco.Web.UI.Client/src/views/mediatypes/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/mediatypes/delete.controller.js @@ -18,7 +18,7 @@ function MediaTypesDeleteController($scope, dataTypeResource, mediaTypeResource, //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); @@ -35,7 +35,7 @@ function MediaTypesDeleteController($scope, dataTypeResource, mediaTypeResource, //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/membergroups/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/membergroups/delete.controller.js index 22deb6df4b..7e434b6f3b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/membergroups/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/membergroups/delete.controller.js @@ -18,7 +18,7 @@ function MemberGroupsDeleteController($scope, memberGroupResource, treeService, //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/membertypes/create.controller.js b/src/Umbraco.Web.UI.Client/src/views/membertypes/create.controller.js index af2457d099..adf6cbc8a6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/membertypes/create.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/membertypes/create.controller.js @@ -35,7 +35,7 @@ function MemberTypesCreateController($scope, $location, navigationService, membe }, function(err) { - //TODO: Handle errors + // TODO: Handle errors }); }; } diff --git a/src/Umbraco.Web.UI.Client/src/views/membertypes/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/membertypes/delete.controller.js index c0cd0c8598..8b8c966790 100644 --- a/src/Umbraco.Web.UI.Client/src/views/membertypes/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/membertypes/delete.controller.js @@ -18,7 +18,7 @@ function MemberTypesDeleteController($scope, memberTypeResource, treeService, na //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/delete.controller.js index 02b89dd279..17e7fa1bd9 100644 --- a/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/partialviewmacros/delete.controller.js @@ -18,7 +18,7 @@ function PartialViewMacrosDeleteController($scope, codefileResource, treeService $scope.currentNode.loading = false; //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/partialviews/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/partialviews/delete.controller.js index 1e615ad0d4..a848b77a82 100644 --- a/src/Umbraco.Web.UI.Client/src/views/partialviews/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/partialviews/delete.controller.js @@ -21,7 +21,7 @@ function PartialViewsDeleteController($scope, codefileResource, treeService, nav $scope.currentNode.loading = false; //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }, function (err) { diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js index 79ae34ea21..d6fe709962 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/colorpicker/colorpicker.controller.js @@ -12,7 +12,7 @@ function ColorPickerController($scope) { //map back to the model $scope.model.config = config; - //TODO: This isn't used + // TODO: This isn't used function convertArrayToDictionaryArray(model) { //now we need to format the items in the dictionary because we always want to have an array var newItems = []; @@ -23,7 +23,7 @@ function ColorPickerController($scope) { return newItems; } - //TODO: This isn't used + // TODO: This isn't used function convertObjectToDictionaryArray(model) { //now we need to format the items in the dictionary because we always want to have an array var newItems = []; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 1e7e3fa0ed..a3fc33d2ea 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -766,7 +766,7 @@ function listViewController($scope, $routeParams, $injector, $timeout, currentUs case "published": return "content_isPublished"; case "contentTypeAlias": - //TODO: Check for members + // TODO: Check for members return $scope.entityType === "content" ? "content_documentType" : "content_mediatype"; case "email": return "general_email"; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js index 67a5630909..f05b1e31d8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/markdowneditor/markdowneditor.controller.js @@ -69,7 +69,7 @@ function MarkdownEditorController($scope, $element, assetsService, editorService }, 200); }); - //load the seperat css for the editor to avoid it blocking our js loading TEMP HACK + // HACK: load the separate css for the editor to avoid it blocking our js loading TEMP HACK assetsService.loadCss("lib/markdown/markdown.css", $scope); }) } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js index d6cc35bacd..884b661beb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/nestedcontent/nestedcontent.controller.js @@ -300,7 +300,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop function (property) { if (_.find(notSupported, function (x) { return x === property.editor; })) { property.notSupported = true; - //TODO: Not supported message to be replaced with 'content_nestedContentEditorNotSupported' dictionary key. Currently not possible due to async/timing quirk. + // TODO: Not supported message to be replaced with 'content_nestedContentEditorNotSupported' dictionary key. Currently not possible due to async/timing quirk. property.notSupportedMessage = "Property " + property.label + " uses editor " + property.editor + " which is not supported by Nested Content."; } }); @@ -433,7 +433,7 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.NestedContent.Prop unsubscribe(); }); - //TODO: Move this into a shared location? + // TODO: Move this into a shared location? var UUID = (function () { var self = {}; var lut = []; for (var i = 0; i < 256; i++) { lut[i] = (i < 16 ? '0' : '') + (i).toString(16); } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js index b795c49855..f455e99fe7 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js @@ -32,7 +32,7 @@ // set default title if(!$scope.model.title) { - // TODO localize + // TODO: localize $scope.model.title = "Edit source code"; } } diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index 2181361470..960e66edfe 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -2,7 +2,7 @@ angular.module("umbraco") .controller("Umbraco.PropertyEditors.RTEController", function ($scope, $q, assetsService, $timeout, tinyMceService, angularHelper, editorService, macroService, editorState) { - //TODO: A lot of the code below should be shared between the grid rte and the normal rte + // TODO: A lot of the code below should be shared between the grid rte and the normal rte $scope.isLoading = true; diff --git a/src/Umbraco.Web.UI.Client/src/views/scripts/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/scripts/delete.controller.js index 82c11a2242..4757399224 100644 --- a/src/Umbraco.Web.UI.Client/src/views/scripts/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/scripts/delete.controller.js @@ -18,7 +18,7 @@ function ScriptsDeleteController($scope, codefileResource, treeService, navigati $scope.currentNode.loading = false; //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js index 62c5ace83a..2ca93fba4c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/scripts/edit.controller.js @@ -145,7 +145,7 @@ //As conflicts with our own tree search shortcut _editor.commands.bindKey("ctrl-space", null); - //TODO: Move all these keybinding config out into some helper/service + // TODO: Move all these keybinding config out into some helper/service _editor.commands.addCommands([ //Disable (alt+shift+K) //Conflicts with our own show shortcuts dialog - this overrides it diff --git a/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js index a05836be06..541d329e05 100644 --- a/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/stylesheets/edit.controller.js @@ -205,7 +205,7 @@ //As conflicts with our own tree search shortcut _editor.commands.bindKey("ctrl-space", null); - //TODO: Move all these keybinding config out into some helper/service + // TODO: Move all these keybinding config out into some helper/service _editor.commands.addCommands([ //Disable (alt+shift+K) //Conflicts with our own show shortcuts dialog - this overrides it diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/delete.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/delete.controller.js index d019a44a10..32e9477133 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/delete.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/delete.controller.js @@ -22,7 +22,7 @@ function TemplatesDeleteController($scope, templateResource , treeService, navig //get the root node before we remove it var rootNode = treeService.getTreeRoot($scope.currentNode); - //TODO: Need to sync tree, etc... + // TODO: Need to sync tree, etc... treeService.removeNode($scope.currentNode); navigationService.hideMenu(); }, function (err) { diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js index 1f6fb8863a..dee2705638 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js @@ -634,7 +634,7 @@ templateCode = templateCode.replace(layoutDefRegex, "$1\"" + newValue + "\"$3"); } else { // Declaration doesn't exist, so prepend to start of doc - //TODO: Maybe insert at the cursor position, rather than just at the top of the doc? + // TODO: Maybe insert at the cursor position, rather than just at the top of the doc? templateCode = "@{\n\tLayout = \"" + newValue + "\";\n}\n" + templateCode; } } else { diff --git a/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js b/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js index e939c25576..ac49709ee4 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/app/templates/template-editor-controller.spec.js @@ -117,7 +117,7 @@ }, 1000); }); - ////TODO: THIS FAILED + //// TODO: THIS FAILED //it("changes layout value when masterpage is selected", function() { // var newTemplate; // ace.clearSelection = nada; diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/directives/val-email.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/directives/val-email.spec.js index 9a6e884ff6..1a1c850b15 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/directives/val-email.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/directives/val-email.spec.js @@ -5,7 +5,7 @@ beforeEach(module('umbraco')); beforeEach(inject(function ($injector) { - //TODO: I have no idea why this doesn't work!!?? it freakin should + // TODO: I have no idea why this doesn't work!!?? it freakin should //valEmailExpression = $injector.get('valEmailExpression'); //in the meantime, i've had to hard code the regex statement here diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/services/server-validation-manager.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/services/server-validation-manager.spec.js index 7510b766a8..3f953fffcd 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/services/server-validation-manager.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/services/server-validation-manager.spec.js @@ -268,7 +268,7 @@ expect(numCalled).toEqual(3); }); - //TODO: Finish testing the rest! + // TODO: Finish testing the rest! }); diff --git a/src/Umbraco.Web/Actions/ActionChangeDocType.cs b/src/Umbraco.Web/Actions/ActionChangeDocType.cs index 56868e9fb0..dcdff94037 100644 --- a/src/Umbraco.Web/Actions/ActionChangeDocType.cs +++ b/src/Umbraco.Web/Actions/ActionChangeDocType.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI.Pages; namespace Umbraco.Web.Actions { - //TODO: Add this back in when we support this functionality again + // TODO: Add this back in when we support this functionality again ///// ///// This action is invoked when the document type of a piece of content is changed ///// diff --git a/src/Umbraco.Web/Cache/ContentCacheRefresher.cs b/src/Umbraco.Web/Cache/ContentCacheRefresher.cs index 944157db9d..99a1e6c803 100644 --- a/src/Umbraco.Web/Cache/ContentCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/ContentCacheRefresher.cs @@ -92,7 +92,7 @@ namespace Umbraco.Web.Cache // content and when the PublishedCachesService is notified of changes it does not see // the new content... - // todo - what about this? + // TODO: what about this? // should rename it, and then, this is only for Deploy, and then, ??? //if (Suspendable.PageCacheRefresher.CanUpdateDocumentCache) // ... diff --git a/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs b/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs index 6916b40f2d..9bd275bc3e 100644 --- a/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs +++ b/src/Umbraco.Web/Cache/DataTypeCacheRefresher.cs @@ -56,7 +56,7 @@ namespace Umbraco.Web.Cache _idkMap.ClearCache(payload.Id); } - // todo - not sure I like these? + // TODO: not sure I like these? TagsValueConverter.ClearCaches(); SliderValueConverter.ClearCaches(); diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs b/src/Umbraco.Web/Cache/DistributedCacheBinder.cs index ce8267dfc8..c64951810a 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheBinder.cs @@ -71,7 +71,7 @@ namespace Umbraco.Web.Cache var handler = FindHandler(e); if (handler == null) { - // todo - should this be fatal (ie, an exception)? + // TODO: should this be fatal (ie, an exception)? var name = e.Sender.GetType().Name + "_" + e.EventName; _logger.Warn("Dropping event {EventName} because no corresponding handler was found.", name); continue; diff --git a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs b/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs index 4f05abc9ee..951b7f79df 100644 --- a/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs +++ b/src/Umbraco.Web/Cache/DistributedCacheBinder_Handlers.cs @@ -196,7 +196,7 @@ namespace Umbraco.Web.Cache _distributedCache.RefreshContentCache(args.Changes.ToArray()); } - // todo our weird events handling wants this for now + // TODO: our weird events handling wants this for now private void ContentService_Deleted(IContentService sender, DeleteEventArgs e) { } private void ContentService_Moved(IContentService sender, MoveEventArgs e) { } private void ContentService_Trashed(IContentService sender, MoveEventArgs e) { } @@ -307,7 +307,7 @@ namespace Umbraco.Web.Cache _distributedCache.RefreshContentTypeCache(args.Changes.ToArray()); } - // todo our weird events handling wants this for now + // TODO: our weird events handling wants this for now private void ContentTypeService_Saved(IContentTypeService sender, SaveEventArgs args) { } private void MediaTypeService_Saved(IMediaTypeService sender, SaveEventArgs args) { } private void MemberTypeService_Saved(IMemberTypeService sender, SaveEventArgs args) { } @@ -321,7 +321,7 @@ namespace Umbraco.Web.Cache private void UserService_UserGroupPermissionsAssigned(IUserService sender, SaveEventArgs e) { - //TODO: Not sure if we need this yet depends if we start caching permissions + // TODO: Not sure if we need this yet depends if we start caching permissions //var groupIds = e.SavedEntities.Select(x => x.UserGroupId).Distinct(); //foreach (var groupId in groupIds) //{ @@ -379,7 +379,7 @@ namespace Umbraco.Web.Cache _distributedCache.RefreshTemplateCache(entity.Id); } - // todo our weird events handling wants this for now + // TODO: our weird events handling wants this for now private void FileService_DeletedStylesheet(IFileService sender, DeleteEventArgs e) { } private void FileService_SavedStylesheet(IFileService sender, SaveEventArgs e) { } @@ -408,7 +408,7 @@ namespace Umbraco.Web.Cache _distributedCache.RefreshMediaCache(args.Changes.ToArray()); } - // todo our weird events handling wants this for now + // TODO: our weird events handling wants this for now private void MediaService_Saved(IMediaService sender, SaveEventArgs e) { } private void MediaService_Deleted(IMediaService sender, DeleteEventArgs e) { } private void MediaService_Moved(IMediaService sender, MoveEventArgs e) { } diff --git a/src/Umbraco.Web/Composing/Composers/InstallerComposer.cs b/src/Umbraco.Web/Composing/Composers/InstallerComposer.cs index b848425736..f73491f1fb 100644 --- a/src/Umbraco.Web/Composing/Composers/InstallerComposer.cs +++ b/src/Umbraco.Web/Composing/Composers/InstallerComposer.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.Composing.Composers composition.Register(Lifetime.Scope); composition.Register(Lifetime.Scope); - //TODO: Add these back once we have a compatible starter kit + // TODO: Add these back once we have a compatible starter kit //container.Register(Lifetime.Scope); //container.Register(Lifetime.Scope); //container.Register(Lifetime.Scope); diff --git a/src/Umbraco.Web/Composing/Current.cs b/src/Umbraco.Web/Composing/Current.cs index bd0e3d02dc..70b0927c43 100644 --- a/src/Umbraco.Web/Composing/Current.cs +++ b/src/Umbraco.Web/Composing/Current.cs @@ -63,7 +63,7 @@ namespace Umbraco.Web.Composing #region Temp & Special - // todo - have to keep this until tests are refactored + // TODO: have to keep this until tests are refactored // but then, it should all be managed properly in the container public static IUmbracoContextAccessor UmbracoContextAccessor { diff --git a/src/Umbraco.Web/Controllers/UmbRegisterController.cs b/src/Umbraco.Web/Controllers/UmbRegisterController.cs index 66c8a8143c..726797c26a 100644 --- a/src/Umbraco.Web/Controllers/UmbRegisterController.cs +++ b/src/Umbraco.Web/Controllers/UmbRegisterController.cs @@ -64,7 +64,7 @@ namespace Umbraco.Web.Controllers break; case MembershipCreateStatus.InvalidQuestion: case MembershipCreateStatus.InvalidAnswer: - //TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 + // TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 throw new NotImplementedException(status.ToString()); case MembershipCreateStatus.InvalidEmail: ModelState.AddModelError("registerModel.Email", "Email is invalid"); diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 7e45797107..2665105120 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -390,7 +390,7 @@ namespace Umbraco.Web.Editors var user = await UserManager.FindAsync(loginInfo.Login); if (user != null) { - //TODO: It might be worth keeping some of the claims associated with the ExternalLoginInfo, in which case we + // TODO: It might be worth keeping some of the claims associated with the ExternalLoginInfo, in which case we // wouldn't necessarily sign the user in here with the standard login, instead we'd update the // UseUmbracoBackOfficeExternalCookieAuthentication extension method to have the correct provider and claims factory, // ticket format, etc.. to create our back office user including the claims assigned and in this method we'd just ensure diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 66289a3c7c..c499749591 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -87,7 +87,7 @@ namespace Umbraco.Web.Editors } } - //TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address + // TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address // so based on compat and how things are currently working we need to replace the serverVarsJs one ((Dictionary)defaults["umbracoUrls"])["serverVarsJs"] = _urlHelper.Action("ServerVariables", "BackOffice"); @@ -105,7 +105,7 @@ namespace Umbraco.Web.Editors { "umbracoUrls", new Dictionary { - //TODO: Add 'umbracoApiControllerBaseUrl' which people can use in JS + // TODO: Add 'umbracoApiControllerBaseUrl' which people can use in JS // to prepend their URL. We could then also use this in our own resources instead of // having each url defined here explicitly - we can do that in v8! for now // for umbraco services we'll stick to explicitly defining the endpoints. @@ -114,7 +114,7 @@ namespace Umbraco.Web.Editors {"externalLinkLoginsUrl", _urlHelper.Action("LinkLogin", "BackOffice")}, {"manifestAssetList", _urlHelper.Action("GetManifestAssetList", "BackOffice")}, {"gridConfig", _urlHelper.Action("GetGridConfig", "BackOffice")}, - //TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address + // TODO: This is ultra confusing! this same key is used for different things, when returning the full app when authenticated it is this URL but when not auth'd it's actually the ServerVariables address {"serverVarsJs", _urlHelper.Action("Application", "BackOffice")}, //API URLs { @@ -370,7 +370,7 @@ namespace Umbraco.Web.Editors .Select(p => new { authType = p.AuthenticationType, caption = p.Caption, - //TODO: Need to see if this exposes any sensitive data! + // TODO: Need to see if this exposes any sensitive data! properties = p.Properties }) .ToArray() @@ -429,7 +429,7 @@ namespace Umbraco.Web.Editors /// it's resolving which is unnecessary and annoying. /// private static readonly Lazy> TreeControllerTypes - = new Lazy>(() => Current.TypeLoader.GetAttributedTreeControllers().ToArray()); // todo inject + = new Lazy>(() => Current.TypeLoader.GetAttributedTreeControllers().ToArray()); // TODO: inject /// /// Returns the server variables regarding the application state diff --git a/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs b/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs index dd6d22a967..6fc0e123a5 100644 --- a/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs +++ b/src/Umbraco.Web/Editors/Binders/ContentModelBinderHelper.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.Editors.Binders } } - //TODO: anything after 3 parts we can put in metadata + // TODO: anything after 3 parts we can put in metadata var fileName = file.Headers.ContentDisposition.FileName.Trim('\"'); diff --git a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs index f54fd12c30..393fab98a9 100644 --- a/src/Umbraco.Web/Editors/Binders/MemberBinder.cs +++ b/src/Umbraco.Web/Editors/Binders/MemberBinder.cs @@ -82,7 +82,7 @@ namespace Umbraco.Web.Editors.Binders throw new InvalidOperationException("Could not find member with key " + model.Key); } - //TODO: Support this scenario! + // TODO: Support this scenario! //if (scenario == MembershipScenario.CustomProviderWithUmbracoLink) //{ // //if there's a 'Member' type then we should be able to just go get it from the db since it was created with a link diff --git a/src/Umbraco.Web/Editors/CodeFileController.cs b/src/Umbraco.Web/Editors/CodeFileController.cs index 6db0c6a8f9..63b6c173b5 100644 --- a/src/Umbraco.Web/Editors/CodeFileController.cs +++ b/src/Umbraco.Web/Editors/CodeFileController.cs @@ -23,7 +23,7 @@ using StylesheetRule = Umbraco.Web.Models.ContentEditing.StylesheetRule; namespace Umbraco.Web.Editors { - //TODO: Put some exception filters in our webapi to return 404 instead of 500 when we throw ArgumentNullException + // TODO: Put some exception filters in our webapi to return 404 instead of 500 when we throw ArgumentNullException // ref: https://www.exceptionnotfound.net/the-asp-net-web-api-exception-handling-pipeline-a-guided-tour/ [PluginController("UmbracoApi")] [PrefixlessBodyModelValidator] diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 841c60938a..0fba76e84b 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -175,7 +175,7 @@ namespace Umbraco.Web.Editors var content = Services.ContentService.GetById(contentId); if (content == null) throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); - //TODO: Should non-admins be able to see detailed permissions? + // TODO: Should non-admins be able to see detailed permissions? var allUserGroups = Services.UserService.GetAllUserGroups(); @@ -271,7 +271,7 @@ namespace Umbraco.Web.Editors content.AllowedActions = new[] { "A" }; content.IsBlueprint = true; - //todo - exclude the content apps here + // TODO: exclude the content apps here //var excludeProps = new[] { "_umb_urls", "_umb_releasedate", "_umb_expiredate", "_umb_template" }; //var propsTab = content.Tabs.Last(); //propsTab.Properties = propsTab.Properties @@ -433,7 +433,7 @@ namespace Umbraco.Web.Editors [FilterAllowedOutgoingContent(typeof(IEnumerable>), "Items")] public PagedResult> GetChildren( int id, - int pageNumber = 0, //TODO: This should be '1' as it's not the index + int pageNumber = 0, // TODO: This should be '1' as it's not the index int pageSize = 0, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, @@ -1091,7 +1091,7 @@ namespace Umbraco.Web.Editors { //its invariant, proceed normally var publishStatus = Services.ContentService.SaveAndPublishBranch(contentItem.PersistedContent, force, userId: Security.CurrentUser.Id); - //TODO: Deal with multiple cancellations + // TODO: Deal with multiple cancellations wasCancelled = publishStatus.Any(x => x.Result == PublishResultType.FailedPublishCancelledByEvent); successfulCultures = Array.Empty(); return publishStatus; @@ -1124,7 +1124,7 @@ namespace Umbraco.Web.Editors { //proceed to publish if all validation still succeeds var publishStatus = Services.ContentService.SaveAndPublishBranch(contentItem.PersistedContent, force, culturesToPublish, Security.CurrentUser.Id); - //TODO: Deal with multiple cancellations + // TODO: Deal with multiple cancellations wasCancelled = publishStatus.Any(x => x.Result == PublishResultType.FailedPublishCancelledByEvent); successfulCultures = contentItem.Variants.Where(x => x.Publish).Select(x => x.Culture).ToArray(); return publishStatus; @@ -1431,7 +1431,7 @@ namespace Umbraco.Web.Editors if (!sortResult.Success) { Logger.Warn("Content sorting failed, this was probably caused by an event being cancelled"); - //TODO: Now you can cancel sorting, does the event messages bubble up automatically? + // TODO: Now you can cancel sorting, does the event messages bubble up automatically? return Request.CreateValidationErrorResponse("Content sorting failed, this was probably caused by an event being cancelled"); } @@ -1907,7 +1907,7 @@ namespace Umbraco.Web.Editors { case PublishResultType.SuccessPublishAlready: { - //TODO: Here we should have messaging for when there are release dates specified like https://github.com/umbraco/Umbraco-CMS/pull/3507 + // TODO: Here we should have messaging for when there are release dates specified like https://github.com/umbraco/Umbraco-CMS/pull/3507 // but this will take a bit of effort because we need to deal with variants, different messaging, etc... A quick attempt was made here: // http://github.com/umbraco/Umbraco-CMS/commit/9b3de7b655e07c612c824699b48a533c0448131a @@ -1938,7 +1938,7 @@ namespace Umbraco.Web.Editors break; case PublishResultType.SuccessPublish: { - //TODO: Here we should have messaging for when there are release dates specified like https://github.com/umbraco/Umbraco-CMS/pull/3507 + // TODO: Here we should have messaging for when there are release dates specified like https://github.com/umbraco/Umbraco-CMS/pull/3507 // but this will take a bit of effort because we need to deal with variants, different messaging, etc... A quick attempt was made here: // http://github.com/umbraco/Umbraco-CMS/commit/9b3de7b655e07c612c824699b48a533c0448131a @@ -2148,7 +2148,7 @@ namespace Umbraco.Web.Editors default: notificationModel.AddErrorNotification( Services.TextService.Localize("speechBubbles/operationFailedHeader"), - null); //TODO: There is no specific failed to save error message AFAIK + null); // TODO: There is no specific failed to save error message AFAIK break; case OperationResultType.FailedCancelledByEvent: notificationModel.AddErrorNotification( diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index 904e6911c9..d7c4d4f7f7 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -148,7 +148,7 @@ namespace Umbraco.Web.Editors string[] messageParams = null) { //if there's already a default event message, don't add our default one - //todo inject + // TODO: inject var msgs = Current.EventMessages; if (msgs != null && msgs.GetAll().Any(x => x.IsDefaultEventMessage)) return; diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index d5a72a7378..3800871f88 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -35,7 +35,7 @@ using Notification = Umbraco.Web.Models.ContentEditing.Notification; namespace Umbraco.Web.Editors { - //TODO: We'll need to be careful about the security on this controller, when we start implementing + // TODO: We'll need to be careful about the security on this controller, when we start implementing // methods to modify content types we'll need to enforce security on the individual methods, we // cannot put security on the whole controller because things like // GetAllowedChildren, GetPropertyTypeScaffold, GetAllPropertyTypeAliases are required for content editing. diff --git a/src/Umbraco.Web/Editors/CurrentUserController.cs b/src/Umbraco.Web/Editors/CurrentUserController.cs index f759a9e604..30f3a431ad 100644 --- a/src/Umbraco.Web/Editors/CurrentUserController.cs +++ b/src/Umbraco.Web/Editors/CurrentUserController.cs @@ -177,7 +177,7 @@ namespace Umbraco.Web.Editors var userMgr = this.TryGetOwinContext().Result.GetBackOfficeUserManager(); //raise the reset event - //TODO: I don't think this is required anymore since from 7.7 we no longer display the reset password checkbox since that didn't make sense. + // TODO: I don't think this is required anymore since from 7.7 we no longer display the reset password checkbox since that didn't make sense. if (data.Reset.HasValue && data.Reset.Value) { userMgr.RaisePasswordResetEvent(Security.CurrentUser.Id); diff --git a/src/Umbraco.Web/Editors/DashboardSecurity.cs b/src/Umbraco.Web/Editors/DashboardSecurity.cs index fdbf5af7d9..2e3fc4123b 100644 --- a/src/Umbraco.Web/Editors/DashboardSecurity.cs +++ b/src/Umbraco.Web/Editors/DashboardSecurity.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Editors /// internal class DashboardSecurity { - //TODO: Unit test all this!!! :/ + // TODO: Unit test all this!!! :/ public static bool AuthorizeAccess(ISection dashboardSection, IUser user, ISectionService sectionService) { diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs index 0af3a1cfe7..4446373cd3 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -204,7 +204,7 @@ namespace Umbraco.Web.Editors { //If we've made it here, then everything has been wired up and validated by the attribute - //TODO: Check if the property editor has changed, if it has ensure we don't pass the + // TODO: Check if the property editor has changed, if it has ensure we don't pass the // existing values to the new property editor! // get the current configuration, diff --git a/src/Umbraco.Web/Editors/EditorValidator.cs b/src/Umbraco.Web/Editors/EditorValidator.cs index 537ae834d3..af355206a5 100644 --- a/src/Umbraco.Web/Editors/EditorValidator.cs +++ b/src/Umbraco.Web/Editors/EditorValidator.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.Editors { var modelType = model.GetType(); - var validationResults = Current.EditorValidators // todo inject + var validationResults = Current.EditorValidators // TODO: inject .Where(x => x.ModelType == modelType) .SelectMany(x => x.Validate(model)) .Where(x => !string.IsNullOrWhiteSpace(x.ErrorMessage) && x.MemberNames.Any()); diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs index 6fcf5b0e2d..5cf248d2a6 100644 --- a/src/Umbraco.Web/Editors/EntityController.cs +++ b/src/Umbraco.Web/Editors/EntityController.cs @@ -107,7 +107,7 @@ namespace Umbraco.Web.Editors [HttpGet] public IEnumerable Search(string query, UmbracoEntityTypes type, string searchFrom = null) { - //TODO: Should we restrict search results based on what app the user has access to? + // TODO: Should we restrict search results based on what app the user has access to? // - Theoretically you shouldn't be able to see member data if you don't have access to members right? if (string.IsNullOrEmpty(query)) @@ -252,7 +252,7 @@ namespace Umbraco.Web.Editors /// public EntityBasic GetByQuery(string query, int nodeContextId, UmbracoEntityTypes type) { - //TODO: Rename this!!! It's misleading, it should be GetByXPath + // TODO: Rename this!!! It's misleading, it should be GetByXPath if (type != UmbracoEntityTypes.Document) @@ -628,7 +628,7 @@ namespace Umbraco.Web.Editors var objectType = ConvertToObjectType(entityType); if (objectType.HasValue) { - //TODO: Need to check for Object types that support hierarchic here, some might not. + // TODO: Need to check for Object types that support hierarchic here, some might not. return Services.EntityService.GetChildren(id, objectType.Value) .WhereNotNull() @@ -651,7 +651,7 @@ namespace Umbraco.Web.Editors var objectType = ConvertToObjectType(entityType); if (objectType.HasValue) { - //TODO: Need to check for Object types that support hierarchic here, some might not. + // TODO: Need to check for Object types that support hierarchic here, some might not. var ids = Services.EntityService.Get(id).Path.Split(',').Select(int.Parse).Distinct().ToArray(); @@ -880,7 +880,7 @@ namespace Umbraco.Web.Editors var objectType = ConvertToObjectType(entityType); if (objectType.HasValue) { - //TODO: Should we order this by something ? + // TODO: Should we order this by something ? var entities = Services.EntityService.GetAll(objectType.Value).WhereNotNull().Select(Mapper.Map); return ExecutePostFilter(entities, postFilter, postFilterParams); } @@ -957,7 +957,7 @@ namespace Umbraco.Web.Editors // if a post filter is assigned then try to execute it if (postFilter.IsNullOrWhiteSpace() == false) { - // fixme/task/critical - trouble is, we've killed the dynamic Where thing! + // FIXME: task/critical - trouble is, we've killed the dynamic Where thing! throw new NotImplementedException("oops"); //return postFilterParams == null // ? entities.AsQueryable().Where(postFilter).ToArray() diff --git a/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs b/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs index e54bb3ef71..eacc904d9b 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentItemValidationHelper.cs @@ -96,7 +96,7 @@ namespace Umbraco.Web.Editors.Filters { if (persistedProperties.Any(property => property.Alias == p.Alias) == false) { - //TODO: Do we return errors here ? If someone deletes a property whilst their editing then should we just + // TODO: Do we return errors here ? If someone deletes a property whilst their editing then should we just //save the property data that remains? Or inform them they need to reload... not sure. This problem exists currently too i think. var message = $"property with alias: {p.Alias} was not found"; diff --git a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs index 64e1c76417..a0565c1d2f 100644 --- a/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/ContentSaveValidationAttribute.cs @@ -152,7 +152,7 @@ namespace Umbraco.Web.Editors.Filters case ContentSaveAction.PublishWithDescendantsNew: case ContentSaveAction.PublishWithDescendantsForceNew: //Publish new requires both ActionNew AND ActionPublish - //TODO: Shouldn't publish also require ActionUpdate since it will definitely perform an update to publish but maybe that's just implied + // TODO: Shouldn't publish also require ActionUpdate since it will definitely perform an update to publish but maybe that's just implied permissionToCheck.Add(ActionNew.ActionLetter); permissionToCheck.Add(ActionPublish.ActionLetter); diff --git a/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs b/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs index 3481c754d3..fe6a049768 100644 --- a/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs +++ b/src/Umbraco.Web/Editors/Filters/UserGroupValidateAttribute.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Editors.Filters _userService = userService; } - private IUserService UserService => _userService ?? Current.Services.UserService; // todo inject + private IUserService UserService => _userService ?? Current.Services.UserService; // TODO: inject public override void OnActionExecuting(HttpActionContext actionContext) { @@ -70,7 +70,7 @@ namespace Umbraco.Web.Editors.Filters actionContext.ModelState.AddModelError("Alias", "A user group with this alias already exists"); } - //TODO: Validate the name is unique? + // TODO: Validate the name is unique? if (actionContext.ModelState.IsValid == false) { diff --git a/src/Umbraco.Web/Editors/MediaController.cs b/src/Umbraco.Web/Editors/MediaController.cs index fe081c1cb4..5441b80264 100644 --- a/src/Umbraco.Web/Editors/MediaController.cs +++ b/src/Umbraco.Web/Editors/MediaController.cs @@ -227,7 +227,7 @@ namespace Umbraco.Web.Editors [FilterAllowedOutgoingMedia(typeof(IEnumerable>))] public IEnumerable> GetRootMedia() { - //TODO: Add permissions check! + // TODO: Add permissions check! return Services.MediaService.GetRootMedia() .Select(Mapper.Map>); diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs index dd1f53f8af..bb126ed1dd 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -24,7 +24,7 @@ using Umbraco.Web.Composing; namespace Umbraco.Web.Editors { - //TODO: We'll need to be careful about the security on this controller, when we start implementing + // TODO: We'll need to be careful about the security on this controller, when we start implementing // methods to modify content types we'll need to enforce security on the individual methods, we // cannot put security on the whole controller because things like GetAllowedChildren are required for content editing. diff --git a/src/Umbraco.Web/Editors/MemberController.cs b/src/Umbraco.Web/Editors/MemberController.cs index 2211bea76b..f4a8dfbd56 100644 --- a/src/Umbraco.Web/Editors/MemberController.cs +++ b/src/Umbraco.Web/Editors/MemberController.cs @@ -179,7 +179,7 @@ namespace Umbraco.Web.Editors return Mapper.Map(foundMember); case MembershipScenario.CustomProviderWithUmbracoLink: - //TODO: Support editing custom properties for members with a custom membership provider here. + // TODO: Support editing custom properties for members with a custom membership provider here. //foundMember = Services.MemberService.GetByKey(key); //if (foundMember == null) @@ -238,7 +238,7 @@ namespace Umbraco.Web.Editors emptyContent.AdditionalData["NewPassword"] = Membership.GeneratePassword(provider.MinRequiredPasswordLength, provider.MinRequiredNonAlphanumericCharacters); return Mapper.Map(emptyContent); case MembershipScenario.CustomProviderWithUmbracoLink: - //TODO: Support editing custom properties for members with a custom membership provider here. + // TODO: Support editing custom properties for members with a custom membership provider here. case MembershipScenario.StandaloneCustomProvider: default: @@ -275,7 +275,7 @@ namespace Umbraco.Web.Editors { ModelState.Remove("ContentTypeAlias"); - //TODO: We're removing this because we are not displaying it but when we support the CustomProviderWithUmbracoLink scenario + // TODO: We're removing this because we are not displaying it but when we support the CustomProviderWithUmbracoLink scenario // we will be able to have a real name associated so do not remove this state once that is implemented! ModelState.Remove("Name"); } @@ -291,7 +291,7 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(Request.CreateValidationErrorResponse(forDisplay)); } - //TODO: WE need to support this! - requires UI updates, etc... + // TODO: WE need to support this! - requires UI updates, etc... if (_provider.RequiresQuestionAndAnswer) { throw new NotSupportedException("Currently the member editor does not support providers that have RequiresQuestionAndAnswer specified"); @@ -334,7 +334,7 @@ namespace Umbraco.Web.Editors } //save the IMember - - //TODO: When we support the CustomProviderWithUmbracoLink scenario, we'll need to save the custom properties for that here too + // TODO: When we support the CustomProviderWithUmbracoLink scenario, we'll need to save the custom properties for that here too if (MembershipScenario == MembershipScenario.NativeUmbraco) { //save the item @@ -584,7 +584,7 @@ namespace Umbraco.Web.Editors UpdateName(contentItem); - //re-assign the mapped values that are not part of the membership provider properties. + // re-assign the mapped values that are not part of the membership provider properties. var builtInAliases = Constants.Conventions.Member.GetStandardPropertyTypeStubs().Select(x => x.Key).ToArray(); foreach (var p in contentItem.PersistedContent.Properties) { @@ -593,10 +593,10 @@ namespace Umbraco.Web.Editors { p.SetValue(valueMapped.GetValue()); - // fixme/task - ok, I give up, at that point tags are dead here, until we figure it out - //p.TagChanges.Behavior = valueMapped.TagChanges.Behavior; - //p.TagChanges.Enable = valueMapped.TagChanges.Enable; - //p.TagChanges.Tags = valueMapped.TagChanges.Tags; + // FIXME: /task - ok, I give up, at that point tags are dead here, until we figure it out + // p.TagChanges.Behavior = valueMapped.TagChanges.Behavior; + // p.TagChanges.Enable = valueMapped.TagChanges.Enable; + // p.TagChanges.Tags = valueMapped.TagChanges.Tags; } } } @@ -652,7 +652,7 @@ namespace Umbraco.Web.Editors case MembershipScenario.NativeUmbraco: //We are using the umbraco membership provider, create the member using the membership provider first. var umbracoMembershipProvider = (UmbracoMembershipProviderBase)_provider; - //TODO: We are not supporting q/a - passing in empty here + // TODO: We are not supporting q/a - passing in empty here membershipUser = umbracoMembershipProvider.CreateUser( contentItem.ContentTypeAlias, contentItem.Username, contentItem.Password.NewPassword, @@ -668,7 +668,7 @@ namespace Umbraco.Web.Editors //create it - this persisted item has already been set in the MemberBinder based on the 'Member' member type: Services.MemberService.Save(contentItem.PersistedContent); - //TODO: We are not supporting q/a - passing in empty here + // TODO: We are not supporting q/a - passing in empty here membershipUser = _provider.CreateUser( contentItem.Username, contentItem.Password.NewPassword, @@ -685,7 +685,7 @@ namespace Umbraco.Web.Editors // link back to the umbraco data var newKey = Guid.NewGuid(); - //TODO: We are not supporting q/a - passing in empty here + // TODO: We are not supporting q/a - passing in empty here membershipUser = _provider.CreateUser( contentItem.Username, contentItem.Password.NewPassword, @@ -701,7 +701,7 @@ namespace Umbraco.Web.Editors throw new ArgumentOutOfRangeException(); } - //TODO: Localize these! + // TODO: Localize these! switch (status) { case MembershipCreateStatus.Success: diff --git a/src/Umbraco.Web/HealthCheck/Checks/Config/ConfigurationService.cs b/src/Umbraco.Web/HealthCheck/Checks/Config/ConfigurationService.cs index 8b080af88c..95b458b142 100644 --- a/src/Umbraco.Web/HealthCheck/Checks/Config/ConfigurationService.cs +++ b/src/Umbraco.Web/HealthCheck/Checks/Config/ConfigurationService.cs @@ -7,7 +7,7 @@ using Umbraco.Web.Composing; namespace Umbraco.Web.HealthCheck.Checks.Config { - //TODO: Add config transform for when config with specified XPath is not found + // TODO: Add config transform for when config with specified XPath is not found public class ConfigurationService { diff --git a/src/Umbraco.Web/HealthCheck/HealthCheck.cs b/src/Umbraco.Web/HealthCheck/HealthCheck.cs index 2c8b0c3c84..81aa1e47d4 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheck.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheck.cs @@ -50,6 +50,6 @@ namespace Umbraco.Web.HealthCheck /// public abstract HealthCheckStatus ExecuteAction(HealthCheckAction action); - //TODO: What else? + // TODO: What else? } } diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckAttribute.cs b/src/Umbraco.Web/HealthCheck/HealthCheckAttribute.cs index 35a8e022fb..fe206f3186 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckAttribute.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckAttribute.cs @@ -21,6 +21,6 @@ namespace Umbraco.Web.HealthCheck public Guid Id { get; private set; } - //TODO: Do we need more metadata? + // TODO: Do we need more metadata? } } diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs index da906c30f9..61028699f0 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckResults.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.HealthCheck private readonly Dictionary> _results; public readonly bool AllChecksSuccessful; - private ILogger Logger => Current.Logger; // todo inject + private ILogger Logger => Current.Logger; // TODO: inject public HealthCheckResults(IEnumerable checks) { diff --git a/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs b/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs index 2db0b1f2e7..1d06f352c0 100644 --- a/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs +++ b/src/Umbraco.Web/HealthCheck/HealthCheckStatus.cs @@ -49,6 +49,6 @@ namespace Umbraco.Web.HealthCheck [DataMember(Name = "actions")] public IEnumerable Actions { get; set; } - //TODO: What else? + // TODO: What else? } } diff --git a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs index bf371bacf0..dc315c571a 100644 --- a/src/Umbraco.Web/Install/Controllers/InstallApiController.cs +++ b/src/Umbraco.Web/Install/Controllers/InstallApiController.cs @@ -52,7 +52,7 @@ namespace Umbraco.Web.Install.Controllers { var setup = new InstallSetup(); - //TODO: Check for user/site token + // TODO: Check for user/site token var steps = new List(); diff --git a/src/Umbraco.Web/Install/InstallStepCollection.cs b/src/Umbraco.Web/Install/InstallStepCollection.cs index d5c32d0ce6..fd8f248325 100644 --- a/src/Umbraco.Web/Install/InstallStepCollection.cs +++ b/src/Umbraco.Web/Install/InstallStepCollection.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.Install { _installHelper = installHelper; - // todo this is ugly but I have a branch where it's nicely refactored - for now we just want to manage ordering + // TODO: this is ugly but I have a branch where it's nicely refactored - for now we just want to manage ordering var a = installerSteps.ToArray(); _orderedInstallerSteps = new InstallSetupStep[] { @@ -26,7 +26,7 @@ namespace Umbraco.Web.Install a.OfType().First(), a.OfType().First(), - //TODO: Add these back once we have a compatible starter kit + // TODO: Add these back once we have a compatible starter kit //orderedInstallerSteps.OfType().First(), //orderedInstallerSteps.OfType().First(), //orderedInstallerSteps.OfType().First(), diff --git a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs index 7b53ecb966..151265f394 100644 --- a/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.Install.InstallSteps _globalSettings = globalSettings; } - //TODO: Change all logic in this step to use ASP.NET Identity NOT MembershipProviders + // TODO: Change all logic in this step to use ASP.NET Identity NOT MembershipProviders private MembershipProvider CurrentProvider { get diff --git a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs index 3ddc675405..6b90ff0a78 100644 --- a/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/StarterKitCleanupStep.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.Install.InstallSteps { packageFile = HttpUtility.UrlDecode(packageFile); - //todo: When does the zip file get deleted? + // TODO: When does the zip file get deleted? } public override bool RequiresExecution(object model) diff --git a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs index 1477105797..3cab550a87 100644 --- a/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs +++ b/src/Umbraco.Web/Install/InstallSteps/UpgradeStep.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.Install.InstallSteps { get { - // todo- if UmbracoVersion.Local is null? + // TODO: if UmbracoVersion.Local is null? // it means that there is a database but the web.config version is cleared // that was a "normal" way to force the upgrader to execute, and we would detect the current // version via the DB like DatabaseSchemaResult.DetermineInstalledVersion - magic, do we really @@ -37,7 +37,7 @@ namespace Umbraco.Web.Install.InstallSteps return value; } - var state = Current.RuntimeState; // todo inject + var state = Current.RuntimeState; // TODO: inject var currentState = FormatGuidState(state.CurrentMigrationState); var newState = FormatGuidState(state.FinalMigrationState); diff --git a/src/Umbraco.Web/Install/Models/InstallPackageModel.cs b/src/Umbraco.Web/Install/Models/InstallPackageModel.cs index 10335c48fc..0c7d270033 100644 --- a/src/Umbraco.Web/Install/Models/InstallPackageModel.cs +++ b/src/Umbraco.Web/Install/Models/InstallPackageModel.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace Umbraco.Web.Install.Models { - //todo : do we need this? + // TODO: do we need this? [Obsolete("This is only used for the obsolete controller InstallPackageController")] [DataContract(Name = "installPackage", Namespace = "")] public class InstallPackageModel diff --git a/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs b/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs index 921036c75a..c73e732268 100644 --- a/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs +++ b/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs @@ -10,7 +10,7 @@ using Umbraco.Core.Media; namespace Umbraco.Web.Media.EmbedProviders { - //TODO: Make all Http calls async + // TODO: Make all Http calls async public abstract class AbstractOEmbedProvider : IEmbedProvider { diff --git a/src/Umbraco.Web/MembershipProviderExtensions.cs b/src/Umbraco.Web/MembershipProviderExtensions.cs index b833028850..133e886e1f 100644 --- a/src/Umbraco.Web/MembershipProviderExtensions.cs +++ b/src/Umbraco.Web/MembershipProviderExtensions.cs @@ -30,7 +30,7 @@ namespace Umbraco.Web {"requiresQuestionAnswer", membershipProvider.RequiresQuestionAndAnswer}, {"allowManuallyChangingPassword", baseProvider != null && baseProvider.AllowManuallyChangingPassword}, {"minNonAlphaNumericChars", membershipProvider.MinRequiredNonAlphanumericCharacters} - //TODO: Inject the other parameters in here to change the behavior of this control - based on the membership provider settings. + // TODO: Inject the other parameters in here to change the behavior of this control - based on the membership provider settings. }; } diff --git a/src/Umbraco.Web/Models/ContentEditing/MemberSave.cs b/src/Umbraco.Web/Models/ContentEditing/MemberSave.cs index b25a210083..5132dbc3ec 100644 --- a/src/Umbraco.Web/Models/ContentEditing/MemberSave.cs +++ b/src/Umbraco.Web/Models/ContentEditing/MemberSave.cs @@ -37,6 +37,6 @@ namespace Umbraco.Web.Models.ContentEditing public bool IsApproved { get; set; } - //TODO: Need to add question / answer support + // TODO: Need to add question / answer support } } diff --git a/src/Umbraco.Web/Models/ContentEditing/UserGroupPermissionsSave.cs b/src/Umbraco.Web/Models/ContentEditing/UserGroupPermissionsSave.cs index e61f9debfa..4c9a751573 100644 --- a/src/Umbraco.Web/Models/ContentEditing/UserGroupPermissionsSave.cs +++ b/src/Umbraco.Web/Models/ContentEditing/UserGroupPermissionsSave.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.Models.ContentEditing AssignedPermissions = new Dictionary>(); } - //TODO: we should have an option to clear the permissions assigned to this node and instead just have them inherit - yes once we actually have inheritance! + // TODO: we should have an option to clear the permissions assigned to this node and instead just have them inherit - yes once we actually have inheritance! [DataMember(Name = "contentId", IsRequired = true)] [Required] diff --git a/src/Umbraco.Web/Models/Mapping/ActionButtonsResolver.cs b/src/Umbraco.Web/Models/Mapping/ActionButtonsResolver.cs index 6de0e704d5..c2f7abd487 100644 --- a/src/Umbraco.Web/Models/Mapping/ActionButtonsResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ActionButtonsResolver.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web.Models.Mapping path = parent == null ? "-1" : parent.Path; } - //TODO: This is certainly not ideal usage here - perhaps the best way to deal with this in the future is + // TODO: This is certainly not ideal usage here - perhaps the best way to deal with this in the future is // with the IUmbracoContextAccessor. In the meantime, if used outside of a web app this will throw a null // reference exception :( return UserService.GetPermissionsForPath(UmbracoContext.Current.Security.CurrentUser, path).GetAllPermissions(); diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs index 3c2dd01c9c..84eaabf52b 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyDisplayConverter.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Models.Mapping var config = DataTypeService.GetDataType(originalProp.PropertyType.DataTypeId).Configuration; - // todo - IDataValueEditor configuration - general issue + // TODO: IDataValueEditor configuration - general issue // GetValueEditor() returns a non-configured IDataValueEditor // - for richtext and nested, configuration determines HideLabel, so we need to configure the value editor // - could configuration also determines ValueType, everywhere? diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeBasicResolver.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeBasicResolver.cs index 01ff458bd5..cb745096ab 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeBasicResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeBasicResolver.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.Models.Mapping { public ContentTypeBasic Resolve(TSource source, TDestination destination, ContentTypeBasic destMember, ResolutionContext context) { - //TODO: We can resolve the UmbracoContext from the IValueResolver options! + // TODO: We can resolve the UmbracoContext from the IValueResolver options! // OMG if (HttpContext.Current != null && UmbracoContext.Current != null && UmbracoContext.Current.Security.CurrentUser != null && UmbracoContext.Current.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings))) diff --git a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs index 257a53cf1a..0181fc25be 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentTypeProfileExtensions.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Models.Mapping where TPropertyTypeBasic : PropertyTypeBasic { return mapping - .ConstructUsing(x => new PropertyGroup(false)) // todo - we have NO idea of isPublishing here = wtf? + .ConstructUsing(x => new PropertyGroup(false)) // TODO: we have NO idea of isPublishing here = wtf? .IgnoreEntityCommonProperties() .ForMember(dest => dest.Id, map => map.Condition(src => src.Id > 0)) .ForMember(dest => dest.Key, map => map.Ignore()) @@ -66,7 +66,7 @@ namespace Umbraco.Web.Models.Mapping foreach (var a in add) { - //TODO: Remove N+1 lookup + // TODO: Remove N+1 lookup var addCt = contentTypeService.Get(a); if (addCt != null) dest.AddContentType(addCt); @@ -91,7 +91,7 @@ namespace Umbraco.Web.Models.Mapping foreach (var a in add) { - //TODO: Remove N+1 lookup + // TODO: Remove N+1 lookup var addCt = mediaTypeService.Get(a); if (addCt != null) dest.AddContentType(addCt); @@ -160,7 +160,7 @@ namespace Umbraco.Web.Models.Mapping where TDestination : IContentTypeComposition where TSourcePropertyType : PropertyTypeBasic { - // todo not so clean really + // TODO: not so clean really var isPublishing = typeof(IContentType).IsAssignableFrom(typeof(TDestination)); mapping = mapping diff --git a/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs b/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs index c8fc9ea4b2..35702719dc 100644 --- a/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.Models.Mapping if (!Current.PropertyEditors.TryGet(source.EditorAlias, out var editor)) throw new InvalidOperationException($"Could not find property editor \"{source.EditorAlias}\"."); - // todo - what about source.PropertyEditor? can we get the configuration here? 'cos it may change the storage type?! + // TODO: what about source.PropertyEditor? can we get the configuration here? 'cos it may change the storage type?! var valueType = editor.GetValueEditor().ValueType; return ValueTypes.ToStorageType(valueType); } diff --git a/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs index 8f99fe03dc..90e98822b1 100644 --- a/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/EntityMapperProfile.cs @@ -124,7 +124,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(dest => dest.AdditionalData, opt => opt.Ignore()) .AfterMap((src, dest) => { - //TODO: Properly map this (not aftermap) + // TODO: Properly map this (not aftermap) //get the icon if there is one dest.Icon = src.Values.ContainsKey(UmbracoExamineIndex.IconFieldName) @@ -204,7 +204,7 @@ namespace Umbraco.Web.Models.Mapping // if there's no culture here, the issue is somewhere else (UI, whatever) - throw! if (culture == null) //throw new InvalidOperationException("Missing culture in mapping options."); - // todo we should throw, but this is used in various places that won't set a culture yet + // TODO: we should throw, but this is used in various places that won't set a culture yet return source.Name; // if we don't have a name for a culture, it means the culture is not available, and diff --git a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs index 1be74ce583..be1bcdefdc 100644 --- a/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MacroMapperProfile.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.Models.Mapping { //map the view and the config // we need to show the deprecated ones for backwards compatibility - var paramEditor = Current.ParameterEditors[property.EditorAlias]; // todo - include/filter deprecated?! + var paramEditor = Current.ParameterEditors[property.EditorAlias]; // TODO: include/filter deprecated?! if (paramEditor == null) { //we'll just map this to a text box diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs b/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs index 62afdd88c7..dbdac1f91f 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberMapperProfile.cs @@ -56,7 +56,7 @@ namespace Umbraco.Web.Models.Mapping .ForMember(dest => dest.FailedPasswordAttempts, opt => opt.Ignore()) .ForMember(dest => dest.DeleteDate, opt => opt.Ignore()) .ForMember(dest => dest.WriterId, opt => opt.Ignore()) - //TODO: Support these eventually + // TODO: Support these eventually .ForMember(dest => dest.PasswordQuestion, opt => opt.Ignore()) .ForMember(dest => dest.RawPasswordAnswerValue, opt => opt.Ignore()); diff --git a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs index c8391abdb4..6134275c76 100644 --- a/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/MemberTabsAndPropertiesResolver.cs @@ -139,7 +139,7 @@ namespace Umbraco.Web.Models.Mapping // only when creating a new member and we want to have a generated password pre-filled. Value = new Dictionary { - // todo why ignoreCase, what are we doing here?! + // TODO: why ignoreCase, what are we doing here?! {"generatedPassword", member.GetAdditionalDataValueIgnoreCase("GeneratedPassword", null)}, {"newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null)}, }, diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 2f2af047f7..e8d7fb38b2 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Models.Mapping IgnoreProperties = ignoreProperties ?? throw new ArgumentNullException(nameof(ignoreProperties)); } - //TODO: This should deserialize to ListViewConfiguration + // TODO: This should deserialize to ListViewConfiguration private static int GetTabNumberFromConfig(IDictionary listViewConfig) { if (!listViewConfig.TryGetValue("displayAtTabNumber", out var displayTabNum)) diff --git a/src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs b/src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs index ae011c01f9..7b467b6d15 100644 --- a/src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs +++ b/src/Umbraco.Web/Models/PublishedContent/PublishedValueFallback.cs @@ -267,8 +267,7 @@ namespace Umbraco.Web.Models.PublishedContent var visited = new HashSet(); - // todo - // _localizationService.GetXxx() is expensive, it deep clones objects + // TODO: _localizationService.GetXxx() is expensive, it deep clones objects // we want _localizationService.GetReadOnlyXxx() returning IReadOnlyLanguage which cannot be saved back = no need to clone var language = _localizationService.GetLanguageByIsoCode(culture); diff --git a/src/Umbraco.Web/Models/PublishedContentBase.cs b/src/Umbraco.Web/Models/PublishedContentBase.cs index c7e38ab7f0..dd6afbd97f 100644 --- a/src/Umbraco.Web/Models/PublishedContentBase.cs +++ b/src/Umbraco.Web/Models/PublishedContentBase.cs @@ -15,7 +15,7 @@ namespace Umbraco.Web.Models [DebuggerDisplay("Content Id: {Id}, Name: {Name}")] public abstract class PublishedContentBase : IPublishedContent { - private string _url; // fixme/task - cannot cache urls, they depends on the current request + private string _url; // FIXME: task - cannot cache urls, they depends on the current request #region ContentType @@ -79,12 +79,12 @@ namespace Umbraco.Web.Models /// The url of documents are computed by the document url providers. The url of medias are, at the moment, /// computed here from the 'umbracoFile' property -- but we should move to media url providers at some point. /// - public virtual string GetUrl(string culture = null) // todo - consider .GetCulture("fr-FR").Url + public virtual string GetUrl(string culture = null) // TODO: consider .GetCulture("fr-FR").Url { switch (ItemType) { case PublishedItemType.Content: - // todo - consider injecting an umbraco context accessor + // TODO: consider injecting an umbraco context accessor if (UmbracoContext.Current == null) throw new InvalidOperationException("Cannot compute Url for a content item when UmbracoContext.Current is null."); if (UmbracoContext.Current.UrlProvider == null) @@ -103,7 +103,7 @@ namespace Umbraco.Web.Models var propType = ContentType.GetPropertyType(Constants.Conventions.Media.File); - // todo - consider implementing media url providers + // TODO: consider implementing media url providers // note: that one does not support variations //This is a hack - since we now have 2 properties that support a URL: upload and cropper, we need to detect this since we always // want to return the normal URL and the cropper stores data as json diff --git a/src/Umbraco.Web/Models/PublishedProperty.cs b/src/Umbraco.Web/Models/PublishedProperty.cs index 05d6b5cfe0..d32612c54c 100644 --- a/src/Umbraco.Web/Models/PublishedProperty.cs +++ b/src/Umbraco.Web/Models/PublishedProperty.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Models var propertyEditors = Current.PropertyEditors; var dataTypeService = Current.Services.DataTypeService; - // todo not dealing with variants + // TODO: not dealing with variants // but the entire thing should die anyways return propertyTypes.Select(x => diff --git a/src/Umbraco.Web/Models/Trees/MenuItem.cs b/src/Umbraco.Web/Models/Trees/MenuItem.cs index 89239f43f7..9dd5524f76 100644 --- a/src/Umbraco.Web/Models/Trees/MenuItem.cs +++ b/src/Umbraco.Web/Models/Trees/MenuItem.cs @@ -106,7 +106,7 @@ namespace Umbraco.Web.Models.Trees /// internal const string ActionUrlKey = "actionUrl"; - //TODO: some action's want to launch a new window like live editing, we support this in the menu item's metadata with + // TODO: some action's want to launch a new window like live editing, we support this in the menu item's metadata with // a key called: "actionUrlMethod" which can be set to either: Dialog, BlankWindow. Normally this is always set to Dialog // if a URL is specified in the "actionUrl" metadata. For now I'm not going to implement launching in a blank window, // though would be v-easy, just not sure we want to ever support that? diff --git a/src/Umbraco.Web/Models/UmbracoProperty.cs b/src/Umbraco.Web/Models/UmbracoProperty.cs index 98ee9fd628..8b41141b95 100644 --- a/src/Umbraco.Web/Models/UmbracoProperty.cs +++ b/src/Umbraco.Web/Models/UmbracoProperty.cs @@ -28,7 +28,7 @@ namespace Umbraco.Web.Models [ReadOnly(true)] public string Name { get; set; } - //TODO: Perhaps one day we'll ship with our own EditorTempates but for now developers can just render their own inside the view + // TODO: Perhaps one day we'll ship with our own EditorTempates but for now developers can just render their own inside the view ///// ///// This can dynamically be set to a custom template name to change diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 10efb54552..e88bab61e5 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -44,7 +44,7 @@ namespace Umbraco.Web.Mvc private UmbracoContext UmbracoContext => _umbracoContext ?? _umbracoContextAccessor.UmbracoContext; - private UmbracoFeatures Features => Current.Factory.GetInstance(); // todo inject + private UmbracoFeatures Features => Current.Factory.GetInstance(); // TODO: inject #region IRouteHandler Members diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs index 806a4bd250..a16f9661aa 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPageOfTModel.cs @@ -41,8 +41,7 @@ namespace Umbraco.Web.Mvc /// public AppCaches AppCaches { get; set; } - // todo - // previously, Services and ApplicationCache would derive from UmbracoContext.Application, which + // TODO: previously, Services and ApplicationCache would derive from UmbracoContext.Application, which // was an ApplicationContext - so that everything derived from UmbracoContext. // UmbracoContext is fetched from the data tokens, thus allowing the view to be rendered with a // custom context and NOT the Current.UmbracoContext - eg outside the normal Umbraco routing diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs index 0c95e1d446..48e16b48d7 100644 --- a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs @@ -11,7 +11,7 @@ namespace Umbraco.Web.Mvc { public abstract class UmbracoVirtualNodeRouteHandler : IRouteHandler { - // TODO: - try lazy property injection? + // TODO: try lazy property injection? private PublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance(); /// @@ -28,7 +28,7 @@ namespace Umbraco.Web.Mvc /// //check if context is null, we know it will be null if we are dealing with a request that /// //has an extension and by default no Umb ctx is created for the request /// if (ctx == null) { - /// //TODO: Here you can EnsureContext , please note that the requestContext is passed in + /// // TODO: Here you can EnsureContext , please note that the requestContext is passed in /// //therefore your should refrain from using other singletons like HttpContext.Current since /// //you will already have a reference to it. Also if you need an ApplicationContext you should /// //pass this in via a ctor instead of using the ApplicationContext.Current singleton. diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs index f36dd6bfa8..81239caec0 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs @@ -108,7 +108,7 @@ namespace Umbraco.Web.PropertyEditors using (var filestream = File.OpenRead(file.TempFilePath)) { - //TODO: Here it would make sense to do the auto-fill properties stuff but the API doesn't allow us to do that right + // TODO: Here it would make sense to do the auto-fill properties stuff but the API doesn't allow us to do that right // since we'd need to be able to return values for other properties from these methods _mediaFileSystem.AddFile(filepath, filestream, true); // must overwrite! diff --git a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs index 8c2f7ac488..e2b46b360d 100644 --- a/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/GridConfiguration.cs @@ -8,11 +8,11 @@ namespace Umbraco.Web.PropertyEditors /// public class GridConfiguration { - //todo: Make these strongly typed, for now this works though + // TODO: Make these strongly typed, for now this works though [ConfigurationField("items", "Grid", "views/propertyeditors/grid/grid.prevalues.html", Description = "Grid configuration")] public JObject Items { get; set; } - //todo: Make these strongly typed, for now this works though + // TODO: Make these strongly typed, for now this works though [ConfigurationField("rte", "Rich text editor", "views/propertyeditors/rte/rte.prevalues.html", Description = "Rich text editor configuration")] public JObject Rte { get; set; } } diff --git a/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs b/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs index 83279ae975..085d66f3c6 100644 --- a/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs +++ b/src/Umbraco.Web/PropertyEditors/GridPropertyIndexValueFactory.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web.PropertyEditors { var controlVal = control.Value; - //TODO: If it's not a string, then it's a json formatted value - + // TODO: If it's not a string, then it's a json formatted value - // we cannot really index this in a smart way since it could be 'anything' if (controlVal.Type == JTokenType.String) { diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs index fff11a28a5..86f3412593 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyEditor.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.PropertyEditors _contentSettings = contentSettings ?? throw new ArgumentNullException(nameof(contentSettings)); _dataTypeService = dataTypeService; - //todo: inject? + // TODO: inject? _autoFillProperties = new UploadAutoFillProperties(_mediaFileSystem, logger, _contentSettings); } diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs index 78f2189829..7bea542521 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs @@ -16,7 +16,7 @@ namespace Umbraco.Web.PropertyEditors /// /// The value editor for the image cropper property editor. /// - internal class ImageCropperPropertyValueEditor : DataValueEditor // todo core vs web? + internal class ImageCropperPropertyValueEditor : DataValueEditor // TODO: core vs web? { private readonly ILogger _logger; private readonly IMediaFileSystem _mediaFileSystem; @@ -151,7 +151,7 @@ namespace Umbraco.Web.PropertyEditors using (var filestream = File.OpenRead(file.TempFilePath)) { - //TODO: Here it would make sense to do the auto-fill properties stuff but the API doesn't allow us to do that right + // TODO: Here it would make sense to do the auto-fill properties stuff but the API doesn't allow us to do that right // since we'd need to be able to return values for other properties from these methods _mediaFileSystem.AddFile(filepath, filestream, true); // must overwrite! diff --git a/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs b/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs index 1b46a7a8a8..6448a3354c 100644 --- a/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/ListViewConfiguration.cs @@ -62,7 +62,7 @@ namespace Umbraco.Web.PropertyEditors [ConfigurationField("bulkActionPermissions", "Bulk Action Permissions", "views/propertyeditors/listview/bulkactionpermissions.prevalues.html", Description = "The bulk actions that are allowed from the list view")] - public BulkActionPermissionSettings BulkActionPermissions { get; set; } = new BulkActionPermissionSettings(); // todomanaging defaults? + public BulkActionPermissionSettings BulkActionPermissions { get; set; } = new BulkActionPermissionSettings(); // TODO: managing defaults? [ConfigurationField("tabName", "Tab Name", "textstring", Description = "The name of the listview tab (default if empty: 'Child Items')")] public string TabName { get; set; } @@ -76,7 +76,7 @@ namespace Umbraco.Web.PropertyEditors public string Header { get; set; } [JsonProperty("isSystem")] - public int IsSystem { get; set; } // todo bool + public int IsSystem { get; set; } // TODO: bool } public class Layout @@ -91,7 +91,7 @@ namespace Umbraco.Web.PropertyEditors public string Icon { get; set; } [JsonProperty("isSystem")] - public int IsSystem { get; set; } // todo bool + public int IsSystem { get; set; } // TODO: bool [JsonProperty("selected")] public bool Selected { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs index 77c5c04985..d4d23da3a4 100644 --- a/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MacroContainerPropertyEditor.cs @@ -4,7 +4,7 @@ using Umbraco.Core.PropertyEditors; namespace Umbraco.Web.PropertyEditors { - // todo - MacroContainerPropertyEditor is deprecated, but what's the alternative? + // TODO: MacroContainerPropertyEditor is deprecated, but what's the alternative? [DataEditor(Constants.PropertyEditors.Aliases.MacroContainer, "(Obsolete) Macro Picker", "macrocontainer", ValueType = ValueTypes.Text, Group="rich content", Icon="icon-settings-alt", IsDeprecated = true)] public class MacroContainerPropertyEditor : DataEditor { diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs index a7d05799d9..e7da4ca113 100644 --- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringConfigurationEditor.cs @@ -34,7 +34,7 @@ namespace Umbraco.Web.PropertyEditors /// public override MultipleTextStringConfiguration FromConfigurationEditor(IDictionary editorValues, MultipleTextStringConfiguration configuration) { - // todo this isn't pretty + // TODO: this isn't pretty //the values from the editor will be min/max fields and we need to format to json in one field // is the editor sending strings or ints or?! var min = (editorValues.ContainsKey("min") ? editorValues["min"].ToString() : "0").TryConvertTo(); diff --git a/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs b/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs index df29687838..13bf269bcd 100644 --- a/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/RichTextConfiguration.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.PropertyEditors /// public class RichTextConfiguration { - //todo: Make these strongly typed, for now this works though + // TODO: Make these strongly typed, for now this works though [ConfigurationField("editor", "Editor", "views/propertyeditors/rte/rte.prevalues.html", HideLabel = true)] public JObject Editor { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs b/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs index 1089f3d5aa..c6b3953e8c 100644 --- a/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs +++ b/src/Umbraco.Web/PropertyEditors/TrueFalseConfiguration.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.PropertyEditors public class TrueFalseConfiguration { [ConfigurationField("default", "Default Value", "boolean")] - public string Default { get; set; } // todo - well, true or false?! + public string Default { get; set; } // TODO: well, true or false?! [ConfigurationField("labelOn", "Write a label text", "textstring")] public string Label { get; set; } diff --git a/src/Umbraco.Web/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs b/src/Umbraco.Web/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs index ca5489ac1f..0f8b75f6b1 100644 --- a/src/Umbraco.Web/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs +++ b/src/Umbraco.Web/PropertyEditors/ValueConverters/MultiNodeTreePickerValueConverter.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters return null; } - //TODO: Inject an UmbracoHelper and create a GetUmbracoHelper method based on either injected or singleton + // TODO: Inject an UmbracoHelper and create a GetUmbracoHelper method based on either injected or singleton if (UmbracoContext.Current != null) { if (propertyType.EditorAlias.Equals(Constants.PropertyEditors.Aliases.MultiNodeTreePicker)) diff --git a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs index 155e59133d..178d34cfa3 100644 --- a/src/Umbraco.Web/PublishedCache/IPublishedCache.cs +++ b/src/Umbraco.Web/PublishedCache/IPublishedCache.cs @@ -209,7 +209,7 @@ namespace Umbraco.Web.PublishedCache /// The alias is case-insensitive. PublishedContentType GetContentType(string alias); - // todo - can we implement this, now? maybe only with NuCache else will throw NotImplemented... + // TODO: can we implement this, now? maybe only with NuCache else will throw NotImplemented... IEnumerable GetByContentType(PublishedContentType contentType); } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs index d983a880cc..cab6e7d759 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.PublishedCache.NuCache #region Constructor - // todo - figure this out + // TODO: figure this out // after the current snapshot has been resync-ed // it's too late for UmbracoContext which has captured previewDefault and stuff into these ctor vars // but, no, UmbracoContext returns snapshot.Content which comes from elements SO a resync should create a new cache diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs index 0cf2c231b5..353ac83eda 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private volatile int _wlocked; private List> _wchanges; - // todo - collection trigger (ok for now) + // TODO: collection trigger (ok for now) // see SnapDictionary notes private const long CollectMinGenDelta = 8; @@ -104,7 +104,7 @@ namespace Umbraco.Web.PublishedCache.NuCache } // gets a scope contextual representing a locked writer to the dictionary - // todo GetScopedWriter? should the dict have a ref onto the scope provider? + // TODO: GetScopedWriter? should the dict have a ref onto the scope provider? public IDisposable GetWriter(IScopeProvider scopeProvider) { return ScopeContextualBase.Get(scopeProvider, _instanceId, scoped => new ContentStoreWriter(this, scoped)); diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfCultureVariationSerializer.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfCultureVariationSerializer.cs index ddf9023d84..107e74b7c3 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfCultureVariationSerializer.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/BTree.DictionaryOfCultureVariationSerializer.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource // write each variation foreach (var (culture, variation) in variations) { - // todo - it's weird we're dealing with cultures here, and languageId in properties + // TODO: it's weird we're dealing with cultures here, and languageId in properties PrimitiveSerializer.String.WriteTo(culture, stream); // should never be null WriteObject(variation.Name, stream); // write an object in case it's null (though... should not happen) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs index 8e9e86b4fc..ca3abcca48 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/DatabaseDataSource.cs @@ -15,7 +15,7 @@ using static Umbraco.Core.Persistence.NPocoSqlExtensions.Statics; namespace Umbraco.Web.PublishedCache.NuCache.DataSource { - // todo - use SqlTemplate for these queries else it's going to be horribly slow! + // TODO: use SqlTemplate for these queries else it's going to be horribly slow! // provides efficient database access for NuCache internal class DatabaseDataSource : IDataSource diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/PropertyData.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/PropertyData.cs index 9e50f50c86..e14426a2e2 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/PropertyData.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/PropertyData.cs @@ -12,14 +12,14 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource public string Culture { get => _culture; - set => _culture = value ?? throw new ArgumentNullException(nameof(value)); // todo or fallback to string.Empty? CANNOT be null + set => _culture = value ?? throw new ArgumentNullException(nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null } [JsonProperty("seg")] public string Segment { get => _segment; - set => _segment = value ?? throw new ArgumentNullException(nameof(value)); // todo or fallback to string.Empty? CANNOT be null + set => _segment = value ?? throw new ArgumentNullException(nameof(value)); // TODO: or fallback to string.Empty? CANNOT be null } [JsonProperty("val")] diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index 889ce72ce0..e1cd1ec764 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -201,7 +201,7 @@ namespace Umbraco.Web.PublishedCache.NuCache private void InitializeRepositoryEvents() { - //todo: The reason these events are in the repository is for legacy, the events should exist at the service + // TODO: The reason these events are in the repository is for legacy, the events should exist at the service // level now since we can fire these events within the transaction... so move the events to service level // plug repository event handlers @@ -584,7 +584,7 @@ namespace Umbraco.Web.PublishedCache.NuCache continue; } - // todo- should we do some RV check here? (later) + // TODO: should we do some RV check here? (later) var capture = payload; using (var scope = _scopeProvider.CreateScope()) @@ -674,7 +674,7 @@ namespace Umbraco.Web.PublishedCache.NuCache continue; } - // todo- should we do some RV checks here? (later) + // TODO: should we do some RV checks here? (later) var capture = payload; using (var scope = _scopeProvider.CreateScope()) @@ -773,7 +773,7 @@ namespace Umbraco.Web.PublishedCache.NuCache using (_contentStore.GetWriter(_scopeProvider)) using (_mediaStore.GetWriter(_scopeProvider)) { - // todo - need to add a datatype lock + // TODO: need to add a datatype lock // this is triggering datatypes reload in the factory, and right after we create some // content types by loading them ... there's a race condition here, which would require // some locking on datatypes diff --git a/src/Umbraco.Web/PublishedCache/PublishedMember.cs b/src/Umbraco.Web/PublishedCache/PublishedMember.cs index cbe2250920..906cc7a4ae 100644 --- a/src/Umbraco.Web/PublishedCache/PublishedMember.cs +++ b/src/Umbraco.Web/PublishedCache/PublishedMember.cs @@ -140,10 +140,10 @@ namespace Umbraco.Web.PublishedCache public override string UrlSegment => throw new NotSupportedException(); - //TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current + // TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current public override string WriterName => _member.GetCreatorProfile().Name; - //TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current + // TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current public override string CreatorName => _member.GetCreatorProfile().Name; public override int WriterId => _member.CreatorId; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index 5521cabe76..a3aad608d5 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -122,7 +122,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia - //TODO: Need to fix examine in LB scenarios! + // TODO: Need to fix examine in LB scenarios! Current.Logger.Error(ex, "Could not load data from Examine index for media"); } else if (ex is AlreadyClosedException) @@ -248,7 +248,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia - //TODO: Need to fix examine in LB scenarios! + // TODO: Need to fix examine in LB scenarios! } catch (NullReferenceException) { @@ -305,7 +305,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache //Currently examine is throwing FileNotFound exceptions when we have a load balanced filestore and a node is published in umbraco //See this thread: http://examine.cdodeplex.com/discussions/264341 //Catch the exception here for the time being, and just fallback to GetMedia - //TODO: Need to fix examine in LB scenarios! + // TODO: Need to fix examine in LB scenarios! Current.Logger.Error(ex, "Could not load data from Examine index for media"); } else if (ex is AlreadyClosedException) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/SafeXmlReaderWriter.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/SafeXmlReaderWriter.cs index 672aad1e3e..37a6b666d4 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/SafeXmlReaderWriter.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/SafeXmlReaderWriter.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Scoping; namespace Umbraco.Web.PublishedCache.XmlPublishedCache { - // todo should be a ScopeContextualBase + // TODO: should be a ScopeContextualBase internal class SafeXmlReaderWriter : IDisposable { private readonly bool _scoped; diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index c3cf22559d..b1037759dc 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -377,7 +377,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache } catch (InvalidOperationException e) { - // todo - enable! + // TODO: enable! //content.Instance.RefreshContentFromDatabase(); throw new InvalidOperationException($"{e.Message}. This usually indicates that the content cache is corrupt; the content cache has been rebuilt in an attempt to self-fix the issue."); } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs index 0153cca18b..36a8334782 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlStore.cs @@ -69,7 +69,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // internal for unit tests // no file nor db, no config check - // todo - er, we DO have a DB? + // TODO: er, we DO have a DB? internal XmlStore(IContentTypeService contentTypeService, IContentService contentService, IScopeProvider scopeProvider, RoutesCache routesCache, PublishedContentTypeCache contentTypeCache, IPublishedSnapshotAccessor publishedSnapshotAccessor, MainDom mainDom, bool testing, bool enableRepositoryEvents, IDocumentRepository documentRepository, IMediaRepository mediaRepository, IMemberRepository memberRepository, IGlobalSettings globalSettings, IEntityXmlSerializer entitySerializer) @@ -602,7 +602,7 @@ AND (umbracoNode.id=@id)"; // should we have async versions that would do: ? // var releaser = await _xmlLock.LockAsync(); // - // todo - not sure about the "resync current published snapshot" thing here, see 7.6... + // TODO: not sure about the "resync current published snapshot" thing here, see 7.6... // gets a locked safe read access to the main xml private SafeXmlReaderWriter GetSafeXmlReader() @@ -641,7 +641,7 @@ AND (umbracoNode.id=@id)"; public void EnsureFilePermission() { - // todo - but do we really have a store, initialized, at that point? + // TODO: but do we really have a store, initialized, at that point? var filename = _xmlFileName + ".temp"; File.WriteAllText(filename, "TEMP"); File.Delete(filename); @@ -1559,8 +1559,8 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; // need to update the published xml if we're saving the published version, // or having an impact on that version - we update the published xml even when masked - // todo - in the repo... either its 'unpublished' and 'publishing', or 'published' and 'published', this has changed! - // todo - what are we serializing really? which properties? + // TODO: in the repo... either its 'unpublished' and 'publishing', or 'published' and 'published', this has changed! + // TODO: what are we serializing really? which properties? // if not publishing, no change to published xml if (((Content) entity).PublishedState != PublishedState.Publishing) @@ -1669,7 +1669,7 @@ ORDER BY umbracoNode.level, umbracoNode.sortOrder"; // RepositoryCacheMode.Scoped because we do NOT want to use the L2 cache that may be out-of-sync // hopefully this does not cause issues and we're not nested in another scope w/different mode - // todo - well, guess what? + // TODO: well, guess what? // original code made sure the repository used no cache // now we're using the Scoped scope cache mode // and then? @@ -2027,7 +2027,7 @@ AND cmsPreviewXml.nodeId IS NULL OR cmsPreviewXml.xml NOT LIKE '% key=""' { // every non-trashed media item should have a corresponding row in cmsContentXml // and that row should have the key="..." attribute - // todo - where's the trashed test here? + // TODO: where's the trashed test here? var mediaObjectType = Constants.ObjectTypes.Media; var db = scope.Database; diff --git a/src/Umbraco.Web/PublishedContentExtensions.cs b/src/Umbraco.Web/PublishedContentExtensions.cs index c57d0249c1..e1bf60f558 100644 --- a/src/Umbraco.Web/PublishedContentExtensions.cs +++ b/src/Umbraco.Web/PublishedContentExtensions.cs @@ -251,7 +251,7 @@ namespace Umbraco.Web public static IEnumerable SearchDescendants(this IPublishedContent content, string term, string indexName = null) { - //todo inject examine manager + // TODO: inject examine manager indexName = string.IsNullOrEmpty(indexName) ? Constants.UmbracoIndexes.ExternalIndexName : indexName; if (!ExamineManager.Instance.TryGetIndex(indexName, out var index)) @@ -272,7 +272,7 @@ namespace Umbraco.Web public static IEnumerable SearchChildren(this IPublishedContent content, string term, string indexName = null) { - //todo inject examine manager + // TODO: inject examine manager indexName = string.IsNullOrEmpty(indexName) ? Constants.UmbracoIndexes.ExternalIndexName : indexName; if (!ExamineManager.Instance.TryGetIndex(indexName, out var index)) diff --git a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs index ff629609d3..60124a96a2 100644 --- a/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs +++ b/src/Umbraco.Web/Routing/ContentFinderByUrlAlias.cs @@ -95,7 +95,7 @@ namespace Umbraco.Web.Routing return v.InvariantContains(a1) || v.InvariantContains(a2); } - // todo - even with Linq, what happens below has to be horribly slow + // TODO: even with Linq, what happens below has to be horribly slow // but the only solution is to entirely refactor url providers to stop being dynamic if (rootNodeId > 0) diff --git a/src/Umbraco.Web/Routing/CustomRouteUrlProvider.cs b/src/Umbraco.Web/Routing/CustomRouteUrlProvider.cs index ae17ff6258..0c6998e7e1 100644 --- a/src/Umbraco.Web/Routing/CustomRouteUrlProvider.cs +++ b/src/Umbraco.Web/Routing/CustomRouteUrlProvider.cs @@ -25,7 +25,7 @@ namespace Umbraco.Web.Routing //If we get this far, it means it's a custom route with published content assigned, check if the id being requested for is the same id as the assigned published content //NOTE: This looks like it might cause an infinite loop because PublishedContentBase.Url calls into UmbracoContext.Current.UrlProvider.GetUrl which calls back into the IUrlProvider pipeline // but the specific purpose of this is that a developer is using their own IPublishedContent that returns a specific Url and doesn't go back into the UrlProvider pipeline. - //TODO: We could put a try/catch here just in case, else we could do some reflection checking to see if the implementation is PublishedContentBase and the Url property is not overridden. + // TODO: We could put a try/catch here just in case, else we could do some reflection checking to see if the implementation is PublishedContentBase and the Url property is not overridden. return UrlInfo.Url( content.Id == umbracoContext.PublishedRequest.PublishedContent.Id ? umbracoContext.PublishedRequest.PublishedContent.GetUrl(culture) diff --git a/src/Umbraco.Web/Routing/DomainHelper.cs b/src/Umbraco.Web/Routing/DomainHelper.cs index 8ba06363dc..88f2b17814 100644 --- a/src/Umbraco.Web/Routing/DomainHelper.cs +++ b/src/Umbraco.Web/Routing/DomainHelper.cs @@ -107,7 +107,7 @@ namespace Umbraco.Web.Routing /// An optional function to filter the list of domains, if more than one applies. /// The domain and its normalized uri, that best matches the specified uri and cultures. /// - /// todo - must document and explain this all + /// TODO: must document and explain this all /// If is null, pick the first domain that matches , /// else the first that matches , else the first one (ordered by id), else null. /// If is not null, look for domains that would be a base uri of the current uri, @@ -244,7 +244,7 @@ namespace Umbraco.Web.Routing /// The domains and their normalized uris, that match the specified uri. internal static IEnumerable SelectDomains(IEnumerable domains, Uri uri) { - // todo where are we matching ?!!? + // TODO: where are we matching ?!!? return domains .Where(d => d.IsWildcard == false) .Select(d => new DomainAndUri(d, uri)) diff --git a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs b/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs index 1a0e5ef873..38ecb09b2b 100644 --- a/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs +++ b/src/Umbraco.Web/Routing/NotFoundHandlerHelper.cs @@ -74,7 +74,7 @@ namespace Umbraco.Web.Routing if (errorPage.HasContentKey) { //need to get the Id for the GUID - //TODO: When we start storing GUIDs into the IPublishedContent, then we won't have to look this up + // TODO: When we start storing GUIDs into the IPublishedContent, then we won't have to look this up // but until then we need to look it up in the db. For now we've implemented a cached service for // converting Int -> Guid and vice versa. var found = entityService.GetId(errorPage.ContentKey, UmbracoObjectTypes.Document); diff --git a/src/Umbraco.Web/Routing/PublishedRouter.cs b/src/Umbraco.Web/Routing/PublishedRouter.cs index 94980a7a10..63def7a1cd 100644 --- a/src/Umbraco.Web/Routing/PublishedRouter.cs +++ b/src/Umbraco.Web/Routing/PublishedRouter.cs @@ -19,7 +19,7 @@ using RenderingEngine = Umbraco.Core.RenderingEngine; namespace Umbraco.Web.Routing { - // todo - making sense to have an interface? + // TODO: making sense to have an interface? public class PublishedRouter { private readonly IWebRoutingSection _webRoutingSection; @@ -52,8 +52,7 @@ namespace Umbraco.Web.Routing GetRolesForLogin = s => Roles.Provider.GetRolesForUser(s); } - // todo - // in 7.7 this is cached in the PublishedContentRequest, which ... makes little sense + // TODO: in 7.7 this is cached in the PublishedContentRequest, which ... makes little sense // killing it entirely, if we need cache, just implement it properly !! // this is all so weird public Func> GetRolesForLogin { get; } @@ -380,7 +379,7 @@ namespace Umbraco.Web.Routing // NOTE: we could start with what's the current default? - // todo - bad - we probably should be using the appropriate filesystems! + // TODO: bad - we probably should be using the appropriate filesystems! if (FindTemplateRenderingEngineInDirectory(new DirectoryInfo(IOHelper.MapPath(SystemDirectories.MvcViews)), alias, new[] { ".cshtml", ".vbhtml" })) diff --git a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs index 7795543320..4843dd5522 100644 --- a/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs +++ b/src/Umbraco.Web/Routing/RedirectTrackingComponent.cs @@ -182,7 +182,7 @@ namespace Umbraco.Web.Redirects private static void ContentService_Moving(IContentService sender, MoveEventArgs e) { - //TODO: Use the new e.EventState to track state between Moving/Moved events! + // TODO: Use the new e.EventState to track state between Moving/Moved events! Moving = true; } diff --git a/src/Umbraco.Web/Routing/SiteDomainHelper.cs b/src/Umbraco.Web/Routing/SiteDomainHelper.cs index 7879b22402..6173dfb43c 100644 --- a/src/Umbraco.Web/Routing/SiteDomainHelper.cs +++ b/src/Umbraco.Web/Routing/SiteDomainHelper.cs @@ -181,7 +181,7 @@ namespace Umbraco.Web.Routing /// public virtual IEnumerable MapDomains(IReadOnlyCollection domainAndUris, Uri current, bool excludeDefault, string culture, string defaultCulture) { - // todo ignoring cultures entirely? + // TODO: ignoring cultures entirely? var currentAuthority = current.GetLeftPart(UriPartial.Authority); KeyValuePair[] candidateSites = null; @@ -279,7 +279,7 @@ namespace Umbraco.Web.Routing if (domainAndUris == null) throw new ArgumentNullException(nameof(domainAndUris)); if (domainAndUris.Count == 0) throw new ArgumentException("Cannot be empty.", nameof(domainAndUris)); - // todo how shall we deal with cultures? + // TODO: how shall we deal with cultures? // we do our best, but can't do the impossible // get the "default" domain ie the first one for the culture, else the first one (exists, length > 0) diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index 832699b5d7..de30590e92 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -80,7 +80,7 @@ namespace Umbraco.Web.Runtime // we should stop injecting UmbracoContext and always inject IUmbracoContextAccessor, however at the moment // there are tons of places (controllers...) which require UmbracoContext in their ctor - so let's register // a way to inject the UmbracoContext - and register it per-request to be more efficient - //TODO: stop doing this + // TODO: stop doing this composition.Register(factory => factory.GetInstance().UmbracoContext, Lifetime.Request); // register the umbraco helper diff --git a/src/Umbraco.Web/Scheduling/BackgroundTaskRunnerOptions.cs b/src/Umbraco.Web/Scheduling/BackgroundTaskRunnerOptions.cs index 5813799f05..bc0369fee8 100644 --- a/src/Umbraco.Web/Scheduling/BackgroundTaskRunnerOptions.cs +++ b/src/Umbraco.Web/Scheduling/BackgroundTaskRunnerOptions.cs @@ -5,7 +5,7 @@ /// public class BackgroundTaskRunnerOptions { - //TODO: Could add options for using a stack vs queue if required + // TODO: Could add options for using a stack vs queue if required /// /// Initializes a new instance of the class. diff --git a/src/Umbraco.Web/Scheduling/IBackgroundTaskRunner.cs b/src/Umbraco.Web/Scheduling/IBackgroundTaskRunner.cs index b478ed581c..9dd5722592 100644 --- a/src/Umbraco.Web/Scheduling/IBackgroundTaskRunner.cs +++ b/src/Umbraco.Web/Scheduling/IBackgroundTaskRunner.cs @@ -15,6 +15,6 @@ namespace Umbraco.Web.Scheduling void Add(T task); bool TryAdd(T task); - // todo - complete the interface? + // TODO: complete the interface? } } diff --git a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs index 0d533a4da2..4326ac3287 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs +++ b/src/Umbraco.Web/Scheduling/ScheduledPublishing.cs @@ -56,8 +56,7 @@ namespace Umbraco.Web.Scheduling // ensure we run with an UmbracoContext, because this may run in a background task, // yet developers may be using the 'current' UmbracoContext in the event handlers // - // todo - // - or maybe not, CacheRefresherComponent already ensures a context when handling events + // TODO: or maybe not, CacheRefresherComponent already ensures a context when handling events // - UmbracoContext 'current' needs to be refactored and cleaned up // - batched messenger should not depend on a current HttpContext // but then what should be its "scope"? could we attach it to scopes? diff --git a/src/Umbraco.Web/Scheduling/ScheduledTasks.cs b/src/Umbraco.Web/Scheduling/ScheduledTasks.cs index 66037a0456..a26b8b23ac 100644 --- a/src/Umbraco.Web/Scheduling/ScheduledTasks.cs +++ b/src/Umbraco.Web/Scheduling/ScheduledTasks.cs @@ -11,7 +11,7 @@ using Umbraco.Core.Sync; namespace Umbraco.Web.Scheduling { - //TODO: No scheduled task (i.e. URL) would be secured, so if people are actually using these each task + // TODO: No scheduled task (i.e. URL) would be secured, so if people are actually using these each task // would need to be a publicly available task (URL) which isn't really very good :( // We should really be using the AdminTokenAuthorizeAttribute for this stuff @@ -72,7 +72,7 @@ namespace Umbraco.Web.Scheduling var request = new HttpRequestMessage(HttpMethod.Get, url); - //TODO: pass custom the authorization header, currently these aren't really secured! + // TODO: pass custom the authorization header, currently these aren't really secured! //request.Headers.Authorization = AdminTokenAuthorizeAttribute.GetAuthenticationHeaderValue(_appContext); try diff --git a/src/Umbraco.Web/Search/ExamineComponent.cs b/src/Umbraco.Web/Search/ExamineComponent.cs index 871f90a319..0db3f0b65e 100644 --- a/src/Umbraco.Web/Search/ExamineComponent.cs +++ b/src/Umbraco.Web/Search/ExamineComponent.cs @@ -122,7 +122,7 @@ namespace Umbraco.Web.Search EnsureUnlocked(_logger, _examineManager); - //TODO: Instead of waiting 5000 ms, we could add an event handler on to fulfilling the first request, then start? + // TODO: Instead of waiting 5000 ms, we could add an event handler on to fulfilling the first request, then start? RebuildIndexes(_indexRebuilder, _logger, true, 5000); } @@ -138,7 +138,7 @@ namespace Umbraco.Web.Search /// public static void RebuildIndexes(IndexRebuilder indexRebuilder, ILogger logger, bool onlyEmptyIndexes, int waitMilliseconds = 0) { - //TODO: need a way to disable rebuilding on startup + // TODO: need a way to disable rebuilding on startup lock(RebuildLocker) { @@ -213,7 +213,7 @@ namespace Umbraco.Web.Search // just ignore that payload // so what?! - //todo: Rebuild the index at this point? + // TODO: Rebuild the index at this point? } else // RefreshNode or RefreshBranch (maybe trashed) { diff --git a/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs b/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs index 99f4c4b453..5ac5529be5 100644 --- a/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs +++ b/src/Umbraco.Web/Search/UmbracoIndexesCreator.cs @@ -14,7 +14,7 @@ namespace Umbraco.Web.Search /// public class UmbracoIndexesCreator : LuceneIndexCreator, IUmbracoIndexesCreator { - //TODO: we should inject the different IValueSetValidator so devs can just register them instead of overriding this class? + // TODO: we should inject the different IValueSetValidator so devs can just register them instead of overriding this class? public UmbracoIndexesCreator(IProfilingLogger profilingLogger, ILocalizationService languageService, diff --git a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs index a60e5f1d1b..2bb093a659 100644 --- a/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs +++ b/src/Umbraco.Web/Search/UmbracoTreeSearcher.cs @@ -64,7 +64,7 @@ namespace Umbraco.Web.Search var umbracoContext = _umbracoHelper.UmbracoContext; - //TODO: WE should try to allow passing in a lucene raw query, however we will still need to do some manual string + // TODO: WE should try to allow passing in a lucene raw query, however we will still need to do some manual string // manipulation for things like start paths, member types, etc... //if (Examine.ExamineExtensions.TryParseLuceneQuery(query)) //{ diff --git a/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs b/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs index 3ac74bd7c0..5b571f304e 100644 --- a/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs +++ b/src/Umbraco.Web/Security/ActiveDirectoryBackOfficeUserPasswordChecker.cs @@ -6,7 +6,7 @@ using Umbraco.Core.Models.Identity; namespace Umbraco.Web.Security { - //TODO: This relies on an assembly that is not .NET Standard :( + // TODO: This relies on an assembly that is not .NET Standard :( public class ActiveDirectoryBackOfficeUserPasswordChecker : IBackOfficeUserPasswordChecker { public virtual string ActiveDirectoryDomain @@ -27,7 +27,7 @@ namespace Umbraco.Web.Security if (isValid && user.HasIdentity == false) { - //TODO: the user will need to be created locally (i.e. auto-linked) + // TODO: the user will need to be created locally (i.e. auto-linked) throw new NotImplementedException("The user " + user.UserName + " does not exist locally and currently the " + typeof(ActiveDirectoryBackOfficeUserPasswordChecker) + " doesn't support auto-linking, see http://issues.umbraco.org/issue/U4-10181"); } diff --git a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs index 4315d3a762..3ce72852bf 100644 --- a/src/Umbraco.Web/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeSignInManager.cs @@ -14,7 +14,7 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Security { - //TODO: In v8 we need to change this to use an int? nullable TKey instead, see notes against overridden TwoFactorSignInAsync + // TODO: In v8 we need to change this to use an int? nullable TKey instead, see notes against overridden TwoFactorSignInAsync public class BackOfficeSignInManager : SignInManager { private readonly ILogger _logger; diff --git a/src/Umbraco.Web/Security/BackOfficeUserManager.cs b/src/Umbraco.Web/Security/BackOfficeUserManager.cs index a7256b257d..83cf06c6d9 100644 --- a/src/Umbraco.Web/Security/BackOfficeUserManager.cs +++ b/src/Umbraco.Web/Security/BackOfficeUserManager.cs @@ -125,13 +125,13 @@ namespace Umbraco.Web.Security #region What we support do not currently - //TODO: We could support this - but a user claims will mostly just be what is in the auth cookie + // TODO: We could support this - but a user claims will mostly just be what is in the auth cookie public override bool SupportsUserClaim { get { return false; } } - //TODO: Support this + // TODO: Support this public override bool SupportsQueryableUsers { get { return false; } @@ -145,7 +145,7 @@ namespace Umbraco.Web.Security get { return false; } } - //TODO: Support this + // TODO: Support this public override bool SupportsUserPhoneNumber { get { return false; } @@ -618,7 +618,7 @@ namespace Umbraco.Web.Security OnPasswordChanged(new IdentityAuditEventArgs(AuditEvent.PasswordChanged, GetCurrentRequestIpAddress(), affectedUser: userId)); } - //TODO: I don't think this is required anymore since from 7.7 we no longer display the reset password checkbox since that didn't make sense. + // TODO: I don't think this is required anymore since from 7.7 we no longer display the reset password checkbox since that didn't make sense. internal void RaisePasswordResetEvent(int userId) { OnPasswordReset(new IdentityAuditEventArgs(AuditEvent.PasswordReset, GetCurrentRequestIpAddress(), affectedUser: userId)); @@ -702,7 +702,7 @@ namespace Umbraco.Web.Security /// protected virtual string GetCurrentRequestIpAddress() { - //TODO: inject a service to get this value, we should not be relying on the old HttpContext.Current especially in the ASP.NET Identity world. + // TODO: inject a service to get this value, we should not be relying on the old HttpContext.Current especially in the ASP.NET Identity world. var httpContext = HttpContext.Current == null ? (HttpContextBase)null : new HttpContextWrapper(HttpContext.Current); return httpContext.GetCurrentRequestIpAddress(); } diff --git a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs index dba7a8c33a..8da8ad23f8 100644 --- a/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs +++ b/src/Umbraco.Web/Security/GetUserSecondsMiddleWare.cs @@ -84,7 +84,7 @@ namespace Umbraco.Web.Security //if it's time to renew, then do it if (timeRemaining < timeElapsed) { - //TODO: This would probably be simpler just to do: context.OwinContext.Authentication.SignIn(context.Properties, identity); + // TODO: This would probably be simpler just to do: context.OwinContext.Authentication.SignIn(context.Properties, identity); // this will invoke the default Cookie middleware to basically perform this logic for us. ticket.Properties.IssuedUtc = currentUtc; @@ -123,7 +123,7 @@ namespace Umbraco.Web.Security } } - //Hack! we need to suppress the stupid forms authentication module but we can only do that by using non owin stuff + // HACK: we need to suppress the stupid forms authentication module but we can only do that by using non owin stuff if (HttpContext.Current != null && HttpContext.Current.Response != null) { HttpContext.Current.Response.SuppressFormsAuthenticationRedirect = true; diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index 79eb27bc3c..e053617806 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -216,7 +216,7 @@ namespace Umbraco.Web.Security membershipUser = ((UmbracoMembershipProviderBase)provider).CreateUser( model.MemberTypeAlias, model.Username, model.Password, model.Email, - //TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 + // TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 null, null, true, null, out status); @@ -239,7 +239,7 @@ namespace Umbraco.Web.Security else { membershipUser = provider.CreateUser(model.Username, model.Password, model.Email, - //TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 + // TODO: Support q/a http://issues.umbraco.org/issue/U4-3213 null, null, true, null, out status); @@ -326,7 +326,7 @@ namespace Umbraco.Web.Security switch (umbracoType) { case UmbracoObjectTypes.Member: - // todo - need to implement Get(guid)! + // TODO: need to implement Get(guid)! var memberAttempt = entityService.GetId(guidUdi.Guid, umbracoType); if (memberAttempt.Success) return GetById(memberAttempt.Result); @@ -422,7 +422,7 @@ namespace Umbraco.Web.Security } //we can try to look up an associated member by the provider user key - //TODO: Support this at some point! + // TODO: Support this at some point! throw new NotSupportedException("Currently a member profile cannot be edited unless using the built-in Umbraco membership providers"); } @@ -480,7 +480,7 @@ namespace Umbraco.Web.Security Value = value }; - //TODO: Perhaps one day we'll ship with our own EditorTempates but for now developers + // TODO: Perhaps one day we'll ship with our own EditorTempates but for now developers // can just render their own. ////This is a rudimentary check to see what data template we should render diff --git a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs index 413023c27c..1f7e2c8084 100644 --- a/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs +++ b/src/Umbraco.Web/Security/Providers/UmbracoMembershipProvider.cs @@ -414,7 +414,7 @@ namespace Umbraco.Web.Security.Providers /// The new password for the specified user. protected override string PerformResetPassword(string username, string answer, string generatedPassword) { - //TODO: This should be here - but how do we update failure count in this provider?? + // TODO: This should be here - but how do we update failure count in this provider?? //if (answer == null && RequiresQuestionAndAnswer) //{ // UpdateFailureCount(username, "passwordAnswer"); @@ -591,7 +591,7 @@ namespace Umbraco.Web.Security.Providers //don't raise events for this! It just sets the member dates, if we do raise events this will // cause all distributed cache to execute - which will clear out some caches we don't want. // http://issues.umbraco.org/issue/U4-3451 - //TODO: In v8 we aren't going to have an overload to disable events, so we'll need to make a different method + // TODO: In v8 we aren't going to have an overload to disable events, so we'll need to make a different method // for this type of thing (i.e. UpdateLastLogin or similar). // when upgrading from 7.2 to 7.3 trying to save will throw diff --git a/src/Umbraco.Web/Suspendable.cs b/src/Umbraco.Web/Suspendable.cs index 0ca43ff595..86c83120ea 100644 --- a/src/Umbraco.Web/Suspendable.cs +++ b/src/Umbraco.Web/Suspendable.cs @@ -79,7 +79,7 @@ namespace Umbraco.Web if (_tried == false) return; _tried = false; - //TODO: when resuming do we always want a full rebuild of all indexes? + // TODO: when resuming do we always want a full rebuild of all indexes? ExamineComponent.RebuildIndexes(indexRebuilder, logger, false); } } diff --git a/src/Umbraco.Web/Templates/TemplateRenderer.cs b/src/Umbraco.Web/Templates/TemplateRenderer.cs index ff87719b12..60d54d8bcd 100644 --- a/src/Umbraco.Web/Templates/TemplateRenderer.cs +++ b/src/Umbraco.Web/Templates/TemplateRenderer.cs @@ -37,8 +37,8 @@ namespace Umbraco.Web.Templates _umbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext)); } - private IFileService FileService => Current.Services.FileService; // todo inject - private PublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance(); // todo inject + private IFileService FileService => Current.Services.FileService; // TODO: inject + private PublishedRouter PublishedRouter => Core.Composing.Current.Factory.GetInstance(); // TODO: inject /// diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs index b4a91f8ab8..205c38b8a1 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs @@ -298,7 +298,7 @@ namespace Umbraco.Web.Trees if (instance == null) throw new Exception("Failed to create tree " + appTree.TreeControllerType + "."); - //TODO: Shouldn't we be applying the same proxying logic as above so that filters work? seems like an oversight + // TODO: Shouldn't we be applying the same proxying logic as above so that filters work? seems like an oversight instance.ControllerContext = controllerContext; instance.Request = controllerContext.Request; diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index b50f06e14e..1609e966e5 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -307,7 +307,7 @@ namespace Umbraco.Web.Trees entity.Name = "[[" + entity.Id + "]]"; } - //todo: Remove the need for converting to legacy + // TODO: Remove the need for converting to legacy private void AddActionNode(IUmbracoEntity item, MenuItemCollection menu, bool hasSeparator = false, bool convert = false, bool opensDialog = false) where TAction : IAction { diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index 7c0e7c736d..bd35fd665f 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -414,7 +414,7 @@ namespace Umbraco.Web.Trees internal IEnumerable GetAllowedUserMenuItemsForNode(IUmbracoEntity dd) { var permission = Services.UserService.GetPermissions(Security.CurrentUser, dd.Path); - //todo: inject + // TODO: inject var actions = Current.Actions.FromEntityPermission(permission) .ToList(); @@ -437,7 +437,7 @@ namespace Umbraco.Web.Trees /// internal bool CanUserAccessNode(IUmbracoEntity doc, IEnumerable allowedUserOptions, string culture) { - //TODO: At some stage when we implement permissions on languages we'll need to take care of culture + // TODO: At some stage when we implement permissions on languages we'll need to take care of culture return allowedUserOptions.Select(x => x.Action).OfType().Any(); } diff --git a/src/Umbraco.Web/Trees/FileSystemTreeController.cs b/src/Umbraco.Web/Trees/FileSystemTreeController.cs index 11160ab282..9aea6e03dd 100644 --- a/src/Umbraco.Web/Trees/FileSystemTreeController.cs +++ b/src/Umbraco.Web/Trees/FileSystemTreeController.cs @@ -29,7 +29,7 @@ namespace Umbraco.Web.Trees /// /// protected virtual void OnRenderFolderNode(ref TreeNode treeNode) { - //TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. + // TODO: This isn't the best way to ensure a noop process for clicking a node but it works for now. treeNode.AdditionalData["jsClickCallback"] = "javascript:void(0);"; } diff --git a/src/Umbraco.Web/Trees/FilesTreeController.cs b/src/Umbraco.Web/Trees/FilesTreeController.cs index 99c4ade09e..429b08e9ee 100644 --- a/src/Umbraco.Web/Trees/FilesTreeController.cs +++ b/src/Umbraco.Web/Trees/FilesTreeController.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Trees [Tree(Constants.Applications.Settings, "files", "Files", "icon-folder", "icon-folder", sortOrder: 13, initialize: false)] public class FilesTreeController : FileSystemTreeController { - protected override IFileSystem FileSystem => new PhysicalFileSystem("~/"); // todo inject + protected override IFileSystem FileSystem => new PhysicalFileSystem("~/"); // TODO: inject private static readonly string[] ExtensionsStatic = { "*" }; diff --git a/src/Umbraco.Web/Trees/ITree.cs b/src/Umbraco.Web/Trees/ITree.cs index 2821d4bfbb..1125a80fe2 100644 --- a/src/Umbraco.Web/Trees/ITree.cs +++ b/src/Umbraco.Web/Trees/ITree.cs @@ -1,6 +1,6 @@ namespace Umbraco.Web.Trees { - //todo- we don't really use this, it is nice to have the treecontroller, attribute and ApplicationTree streamlined to implement this but it's not used + // TODO: we don't really use this, it is nice to have the treecontroller, attribute and ApplicationTree streamlined to implement this but it's not used //leave as internal for now, maybe we'll use in the future, means we could pass around ITree internal interface ITree { diff --git a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs index 277094d3c6..4936ce6541 100644 --- a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs +++ b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs @@ -12,7 +12,7 @@ namespace Umbraco.Web.Trees /// internal class LegacyTreeDataConverter { - //todo: remove this whole class when everything is angularized + // TODO: remove this whole class when everything is angularized /// /// This will look at the legacy IAction's JsFunctionName and convert it to a confirmation dialog view if possible diff --git a/src/Umbraco.Web/Trees/ScriptsTreeController.cs b/src/Umbraco.Web/Trees/ScriptsTreeController.cs index 2fbeae4f6b..bb7fd80f5b 100644 --- a/src/Umbraco.Web/Trees/ScriptsTreeController.cs +++ b/src/Umbraco.Web/Trees/ScriptsTreeController.cs @@ -9,7 +9,7 @@ namespace Umbraco.Web.Trees [Tree(Constants.Applications.Settings, Constants.Trees.Scripts, "Scripts", "icon-folder", "icon-folder", sortOrder: 10)] public class ScriptsTreeController : FileSystemTreeController { - protected override IFileSystem FileSystem => Current.FileSystems.ScriptsFileSystem; // todo inject + protected override IFileSystem FileSystem => Current.FileSystems.ScriptsFileSystem; // TODO: inject private static readonly string[] ExtensionsStatic = { "js" }; diff --git a/src/Umbraco.Web/Trees/StylesheetsTreeController.cs b/src/Umbraco.Web/Trees/StylesheetsTreeController.cs index f64e9fd752..0b82291919 100644 --- a/src/Umbraco.Web/Trees/StylesheetsTreeController.cs +++ b/src/Umbraco.Web/Trees/StylesheetsTreeController.cs @@ -8,7 +8,7 @@ namespace Umbraco.Web.Trees [Tree(Constants.Applications.Settings, Constants.Trees.Stylesheets, "Stylesheets", "icon-folder", "icon-folder", sortOrder: 9)] public class StylesheetsTreeController : FileSystemTreeController { - protected override IFileSystem FileSystem => Current.FileSystems.StylesheetsFileSystem; // todo inject + protected override IFileSystem FileSystem => Current.FileSystems.StylesheetsFileSystem; // TODO: inject private static readonly string[] ExtensionsStatic = { "css" }; diff --git a/src/Umbraco.Web/Trees/TemplatesTreeController.cs b/src/Umbraco.Web/Trees/TemplatesTreeController.cs index c074f828d4..77102dff45 100644 --- a/src/Umbraco.Web/Trees/TemplatesTreeController.cs +++ b/src/Umbraco.Web/Trees/TemplatesTreeController.cs @@ -50,7 +50,7 @@ namespace Umbraco.Web.Trees nodes.AddRange(found.Select(template => CreateTreeNode( template.Id.ToString(CultureInfo.InvariantCulture), - //TODO: Fix parent ID stuff for templates + // TODO: Fix parent ID stuff for templates "-1", queryStrings, template.Name, @@ -112,7 +112,7 @@ namespace Umbraco.Web.Trees Key = template.Key, Name = template.Name, NodeObjectType = Constants.ObjectTypes.Template, - //TODO: Fix parent/paths on templates + // TODO: Fix parent/paths on templates ParentId = -1, Path = template.Path, UpdateDate = template.UpdateDate diff --git a/src/Umbraco.Web/UI/Controls/UmbracoControl.cs b/src/Umbraco.Web/UI/Controls/UmbracoControl.cs index c56e4fe07f..9e7eed3ae1 100644 --- a/src/Umbraco.Web/UI/Controls/UmbracoControl.cs +++ b/src/Umbraco.Web/UI/Controls/UmbracoControl.cs @@ -20,7 +20,7 @@ namespace Umbraco.Web.UI.Controls UmbracoContext = umbracoContext ?? throw new ArgumentNullException(nameof(umbracoContext)); Umbraco = new UmbracoHelper(umbracoContext, services); - // todo inject somehow + // TODO: inject somehow Logger = Current.Logger; ProfilingLogger = Current.ProfilingLogger; Services = Current.Services; diff --git a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs index f4cd7f1b50..560c6a2660 100644 --- a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs +++ b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs @@ -31,7 +31,7 @@ namespace Umbraco.Web.UI.Controls Umbraco = new UmbracoHelper(umbracoContext, services); Members = Current.Factory.GetInstance(); - // todo inject somehow + // TODO: inject somehow Logger = Current.Logger; ProfilingLogger = Current.ProfilingLogger; Services = Current.Services; diff --git a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs index f223fe5310..51e40b5324 100644 --- a/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs +++ b/src/Umbraco.Web/UI/JavaScript/Resources.Designer.cs @@ -144,7 +144,7 @@ namespace Umbraco.Web.UI.JavaScript } /// - /// Looks up a localized string similar to //TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but + /// Looks up a localized string similar to // TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but ///// how to do that when this is not a regular JS file, it is a server side JS file and RequireJS seems to only want ///// to force load JS files ? /// diff --git a/src/Umbraco.Web/UI/JavaScript/ServerVariables.js b/src/Umbraco.Web/UI/JavaScript/ServerVariables.js index f7f6eb2a09..4a0017550a 100644 --- a/src/Umbraco.Web/UI/JavaScript/ServerVariables.js +++ b/src/Umbraco.Web/UI/JavaScript/ServerVariables.js @@ -1,4 +1,4 @@ -//TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but +// TODO: This would be nicer as an angular module so it can be injected into stuff... that'd be heaps nicer, but // how to do that when this is not a regular JS file, it is a server side JS file and RequireJS seems to only want // to force load JS files ? diff --git a/src/Umbraco.Web/UmbracoComponentRenderer.cs b/src/Umbraco.Web/UmbracoComponentRenderer.cs index 48d0d571ee..a579c0abac 100644 --- a/src/Umbraco.Web/UmbracoComponentRenderer.cs +++ b/src/Umbraco.Web/UmbracoComponentRenderer.cs @@ -128,7 +128,7 @@ namespace Umbraco.Web var macroProps = new Hashtable(); foreach (var i in parameters) { - //TODO: We are doing at ToLower here because for some insane reason the UpdateMacroModel method of macro.cs + // TODO: We are doing at ToLower here because for some insane reason the UpdateMacroModel method of macro.cs // looks for a lower case match. WTF. the whole macro concept needs to be rewritten. diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs index 49a3832483..04a9658ee5 100644 --- a/src/Umbraco.Web/UmbracoContext.cs +++ b/src/Umbraco.Web/UmbracoContext.cs @@ -41,7 +41,7 @@ namespace Umbraco.Web /// A value indicating whether to replace the existing context. /// The "current" UmbracoContext. /// - /// todo - this needs to be clarified + /// TODO: this needs to be clarified /// /// If is true then the "current" UmbracoContext is replaced /// with a new one even if there is one already. See . Has to do with diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 110c3e84d0..9d55299ecc 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -638,10 +638,10 @@ namespace Umbraco.Web public IPublishedContent Media(Guid id) { - //TODO: This is horrible but until the media cache properly supports GUIDs we have no choice here and + // TODO: This is horrible but until the media cache properly supports GUIDs we have no choice here and // currently there won't be any way to add this method correctly to `ITypedPublishedContentQuery` without breaking an interface and adding GUID support for media - var entityService = Current.Services.EntityService; // todo inject + var entityService = Current.Services.EntityService; // TODO: inject var mediaAttempt = entityService.GetId(id, UmbracoObjectTypes.Media); return mediaAttempt.Success ? ContentQuery.Media(mediaAttempt.Result) : null; } diff --git a/src/Umbraco.Web/UmbracoHttpHandler.cs b/src/Umbraco.Web/UmbracoHttpHandler.cs index 009272963c..336b53e9e0 100644 --- a/src/Umbraco.Web/UmbracoHttpHandler.cs +++ b/src/Umbraco.Web/UmbracoHttpHandler.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web UmbracoContext = umbracoContext; Umbraco = new UmbracoHelper(umbracoContext, services); - // todo inject somehow + // TODO: inject somehow Logger = Current.Logger; ProfilingLogger = Current.ProfilingLogger; Services = Current.Services; diff --git a/src/Umbraco.Web/WebApi/Filters/EnableOverrideAuthorizationAttribute.cs b/src/Umbraco.Web/WebApi/Filters/EnableOverrideAuthorizationAttribute.cs index 7828400487..358c9cc3b3 100644 --- a/src/Umbraco.Web/WebApi/Filters/EnableOverrideAuthorizationAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/EnableOverrideAuthorizationAttribute.cs @@ -11,6 +11,6 @@ namespace Umbraco.Web.WebApi.Filters [AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)] public sealed class EnableOverrideAuthorizationAttribute : Attribute { - //todo we should remove this and use the System.Web.Http.OverrideAuthorizationAttribute which uses IOverrideFilter instead + // TODO: we should remove this and use the System.Web.Http.OverrideAuthorizationAttribute which uses IOverrideFilter instead } } diff --git a/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs b/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs index 6604d1c9e7..ae42d54787 100644 --- a/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForContentAttribute.cs @@ -89,13 +89,13 @@ namespace Umbraco.Web.WebApi.Filters } else if (Udi.TryParse(argument, true, out Udi udi)) { - //todo: inject? we can't because this is an attribute but we could provide ctors and empty ctors that pass in the required services + // TODO: inject? we can't because this is an attribute but we could provide ctors and empty ctors that pass in the required services nodeId = Current.Services.EntityService.GetId(udi).Result; } else { Guid.TryParse(argument, out Guid key); - //todo: inject? we can't because this is an attribute but we could provide ctors and empty ctors that pass in the required services + // TODO: inject? we can't because this is an attribute but we could provide ctors and empty ctors that pass in the required services nodeId = Current.Services.EntityService.GetId(key, UmbracoObjectTypes.Document).Result; } } diff --git a/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs b/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs index 866941d41d..026b43a01b 100644 --- a/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/EnsureUserPermissionForMediaAttribute.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.WebApi.Filters _paramName = paramName; } - // todo v8 guess this is not used anymore, source is ignored?! + // TODO: v8 guess this is not used anymore, source is ignored?! public EnsureUserPermissionForMediaAttribute(string paramName, DictionarySource source) { if (string.IsNullOrEmpty(paramName)) throw new ArgumentNullOrEmptyException(nameof(paramName)); diff --git a/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs b/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs index 522c3af8bb..070bb53fb3 100644 --- a/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/OverridableAuthorizationAttribute.cs @@ -5,7 +5,7 @@ using System.Web.Http.Controllers; namespace Umbraco.Web.WebApi.Filters { - //todo remove this since we don't need it, see notes in EnableOverrideAuthorizationAttribute + // TODO: remove this since we don't need it, see notes in EnableOverrideAuthorizationAttribute /// /// Abstract auth filter class that can be used to enable overriding class auth filters at the action level diff --git a/src/Umbraco.Web/WebApi/UmbracoAuthorizeAttribute.cs b/src/Umbraco.Web/WebApi/UmbracoAuthorizeAttribute.cs index 700554e731..49cb75fffb 100644 --- a/src/Umbraco.Web/WebApi/UmbracoAuthorizeAttribute.cs +++ b/src/Umbraco.Web/WebApi/UmbracoAuthorizeAttribute.cs @@ -19,7 +19,7 @@ namespace Umbraco.Web.WebApi /// internal static bool Enable = true; - // todo - inject! + // TODO: inject! private readonly UmbracoContext _umbracoContext; private readonly IRuntimeState _runtimeState; diff --git a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs index 94e1b6e923..c6bbbfa00b 100644 --- a/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs +++ b/src/Umbraco.Web/_Legacy/PackageActions/publishRootDocument.cs @@ -35,7 +35,7 @@ namespace Umbraco.Web._Legacy.PackageActions { if (rootDoc.Name.Trim() == documentName.Trim() && rootDoc.ContentType != null) { - // todo variants? + // TODO: variants? Current.Services.ContentService.SaveAndPublishBranch(rootDoc, true); break; } diff --git a/src/Umbraco.Web/umbraco.presentation/page.cs b/src/Umbraco.Web/umbraco.presentation/page.cs index 3b879c5b02..5c2ff7aa01 100644 --- a/src/Umbraco.Web/umbraco.presentation/page.cs +++ b/src/Umbraco.Web/umbraco.presentation/page.cs @@ -324,7 +324,7 @@ namespace umbraco _id = _inner.Id; _key = _inner.Key; - //TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current + // TODO: ARGH! need to fix this - this is not good because it uses ApplicationContext.Current _creatorName = _inner.GetCreatorProfile().Name; _writerName = _inner.GetWriterProfile().Name; From a185d56ae5eec9a084d55622109a8332e3ca78b3 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 22 Jan 2019 15:57:50 +0100 Subject: [PATCH 65/76] Ensure that element types can't be assigned as allowed children to other content types --- .../views/permissions/permissions.controller.js | 5 ++--- src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.controller.js index 317fe094ae..a3b422e4f3 100644 --- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/views/permissions/permissions.controller.js @@ -38,13 +38,12 @@ }); contentTypeResource.getAll().then(function(contentTypes){ - - vm.contentTypes = contentTypes; + vm.contentTypes = _.where(contentTypes, {isElement: false}); // convert legacy icons iconHelper.formatContentTypeIcons(vm.contentTypes); - vm.selectedChildren = contentTypeHelper.makeObjectArrayFromId($scope.model.allowedContentTypes, vm.contentTypes); + vm.selectedChildren = contentTypeHelper.makeObjectArrayFromId($scope.model.allowedContentTypes, contentTypes); if($scope.model.id === 0) { contentTypeHelper.insertChildNodePlaceholder(vm.contentTypes, $scope.model.name, $scope.model.icon, $scope.model.id); diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs b/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs index 6aca5d8054..56d81a3189 100644 --- a/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs +++ b/src/Umbraco.Web/Models/ContentEditing/ContentTypeBasic.cs @@ -116,5 +116,13 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "blueprints")] [ReadOnly(true)] public IDictionary Blueprints { get; set; } + + [DataMember(Name = "isContainer")] + [ReadOnly(true)] + public bool IsContainer { get; set; } + + [DataMember(Name = "isElement")] + [ReadOnly(true)] + public bool IsElement { get; set; } } } From 647d92775c092407a2734ed0d08b1c5c7292de8f Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 27 Jan 2019 12:02:39 +0100 Subject: [PATCH 66/76] Make right-click menu work in Firefox --- .../src/common/directives/components/events/events.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/events/events.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/events/events.directive.js index 6e75973ae7..77f2ffb54a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/events/events.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/events/events.directive.js @@ -188,7 +188,7 @@ angular.module('umbraco.directives') e.stopPropagation(); var fn = $parse(attrs.onRightClick); scope.$apply(function () { - fn(scope, { $event: event }); + fn(scope, { $event: e }); }); return false; }); From d174499e50f6ab84dba1600374371bb48fd5ad8a Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 27 Jan 2019 13:30:25 +0100 Subject: [PATCH 67/76] Fixes #4260 incorrect permissions required for Notifications sign up --- src/Umbraco.Web/Editors/ContentController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index c77fe04b0d..5f3022b2a9 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -1179,7 +1179,7 @@ namespace Umbraco.Web.Editors return allowed; } - [EnsureUserPermissionForContent("contentId", 'R')] + [EnsureUserPermissionForContent("contentId", 'F')] public IEnumerable GetNotificationOptions(int contentId) { var notifications = new List(); From 7e8c0ed3694a35c131b601f9f06ae30045a57910 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sun, 27 Jan 2019 15:17:08 +0100 Subject: [PATCH 68/76] Apply changes from PR #4197 to v8 too --- src/Umbraco.Web.UI/Umbraco/config/lang/da.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml index 5ece650343..9dceead927 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/da.xml @@ -1328,9 +1328,9 @@ Mange hilsner fra Umbraco robotten Makroer Medietyper Medlemmer - Medlemsgruppe + Medlemsgrupper Roller - Medlemstype + Medlemstyper Dokumenttyper Relationstyper Pakker From 9b01910d44b4a720e065f9ebadcbe4995f490276 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Mon, 28 Jan 2019 08:27:42 +0100 Subject: [PATCH 69/76] Removed isPublished stuff from XmlPublishedContent. --- .../XmlPublishedContentInitBenchmarks.cs | 8 ++++---- .../XmlPublishedCache/XmlPublishedContent.cs | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs index 860dc0ac4b..bc18b97d47 100644 --- a/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs +++ b/src/Umbraco.Tests.Benchmarks/XmlPublishedContentInitBenchmarks.cs @@ -145,7 +145,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml10.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out isPublished, out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out publishedContentType, out properties, GetPublishedContentType); } @@ -155,7 +155,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml100.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, + out createDate, out updateDate, out level, out isDraft, out publishedContentType, out properties, GetPublishedContentType); } @@ -165,7 +165,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml1000.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, + out createDate, out updateDate, out level, out isDraft,out publishedContentType, out properties, GetPublishedContentType); } @@ -175,7 +175,7 @@ namespace Umbraco.Tests.Benchmarks XmlPublishedContent.InitializeNode(null, _xml10000.DocumentElement, false, out id, out key, out template, out sortOrder, out name, out writerName, out urlName, out creatorName, out creatorId, out writerId, out docTypeAlias, out nodeType, out path, - out createDate, out updateDate, out level, out isDraft, out isPublished,out publishedContentType, + out createDate, out updateDate, out level, out isDraft,out publishedContentType, out properties, GetPublishedContentType); } diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs index f601114ffd..3db52616e8 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/XmlPublishedContent.cs @@ -63,7 +63,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache private int _sortOrder; private int _level; private bool _isDraft; - private bool _isPublished; + public override IEnumerable Children { @@ -232,7 +232,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache public override bool IsPublished(string culture = null) { EnsureNodeInitialized(); - return _isPublished; // bah + return true; // Intentionally not implemented, because the XmlPublishedContent should not support this. } public override IEnumerable Properties @@ -287,7 +287,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache InitializeNode(this, _xmlNode, _isPreviewing, out _id, out _key, out _template, out _sortOrder, out _name, out _writerName, out _urlName, out _creatorName, out _creatorId, out _writerId, out _docTypeAlias, out _docTypeId, out _path, - out _createDate, out _updateDate, out _level, out _isDraft, out _isPublished, out _contentType, out _properties, + out _createDate, out _updateDate, out _level, out _isDraft, out _contentType, out _properties, _contentTypeCache.Get); _nodeInitialized = true; @@ -297,7 +297,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache internal static void InitializeNode(XmlPublishedContent node, XmlNode xmlNode, bool isPreviewing, out int id, out Guid key, out int template, out int sortOrder, out string name, out string writerName, out string urlName, out string creatorName, out int creatorId, out int writerId, out string docTypeAlias, out int docTypeId, out string path, - out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft,out bool isPublished, + out DateTime createDate, out DateTime updateDate, out int level, out bool isDraft, out PublishedContentType contentType, out Dictionary properties, Func getPublishedContentType) { @@ -309,7 +309,6 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache name = writerName = urlName = creatorName = docTypeAlias = path = null; createDate = updateDate = default(DateTime); isDraft = false; - isPublished = false; // fixme not implemented? contentType = null; properties = null; From c2a404c02d84dbfeb6f06b366079dd8ac578023a Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 10:34:57 +0100 Subject: [PATCH 70/76] Update ModelsBuilder --- build/NuSpecs/UmbracoCms.nuspec | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index f642b2f4e8..56851700b0 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -22,7 +22,7 @@ not want this to happen as the alpha of the next major is, really, the next major already. --> - + diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 0ff158dadb..4da6e91579 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -106,7 +106,7 @@ - 8.0.0-alpha.33 + 8.0.0-alpha.34 From c675708388083ebae358f941e948494c9c722a69 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 12:20:22 +0100 Subject: [PATCH 71/76] Refactor dashboards --- .../WeightedCollectionBuilderBase.cs | 2 +- src/Umbraco.Core/Dashboards/DashboardSlim.cs | 12 ++ src/Umbraco.Core/Dashboards/IDashboard.cs | 37 ++++++ .../Dashboards/IDashboardSection.cs | 34 ----- src/Umbraco.Core/Dashboards/IDashboardSlim.cs | 22 ++++ ...gnoreDataMemberWhenSerializingAttribute.cs | 15 --- .../Manifest/ManifestContentAppDefinition.cs | 7 +- ...oardDefinition.cs => ManifestDashboard.cs} | 5 +- src/Umbraco.Core/Manifest/ManifestParser.cs | 2 +- src/Umbraco.Core/Manifest/PackageManifest.cs | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 7 +- .../Composing/CollectionBuildersTests.cs | 2 +- .../DashboardSettings/Dashboard.config | 114 ---------------- .../DashboardSettingsTests.cs | 124 ------------------ .../DashboardSettings/web.config | 14 -- .../Manifest/ManifestParserTests.cs | 4 +- src/Umbraco.Tests/Umbraco.Tests.csproj | 9 -- .../Dashboards/ContentDashboard.cs | 2 +- .../Dashboards/DashboardCollection.cs | 4 +- .../Dashboards/DashboardCollectionBuilder.cs | 32 +++-- .../Dashboards/ExamineDashboard.cs | 2 +- src/Umbraco.Web/Dashboards/FormsDashboard.cs | 2 +- .../Dashboards/HealthCheckDashboard.cs | 2 +- src/Umbraco.Web/Dashboards/MediaDashboard.cs | 2 +- .../Dashboards/MembersDashboard.cs | 2 +- .../Dashboards/ModelsBuilderDashboard.cs | 2 +- .../Dashboards/PublishedStatusDashboard.cs | 2 +- .../Dashboards/RedirectUrlDashboard.cs | 2 +- .../Dashboards/SettingsDashboards.cs | 2 +- .../Editors/DashboardController.cs | 19 ++- .../Editors/EditorModelEventManager.cs | 8 +- src/Umbraco.Web/Runtime/WebRuntimeComposer.cs | 5 +- src/Umbraco.Web/Services/DashboardService.cs | 10 +- src/Umbraco.Web/Services/IDashboardService.cs | 4 +- src/Umbraco.Web/Umbraco.Web.csproj | 1 - ...taMemberWhenSerializingContractResolver.cs | 31 ----- .../WebApi/JsonCamelCaseFormatter.cs | 4 +- 37 files changed, 141 insertions(+), 409 deletions(-) create mode 100644 src/Umbraco.Core/Dashboards/DashboardSlim.cs create mode 100644 src/Umbraco.Core/Dashboards/IDashboard.cs delete mode 100644 src/Umbraco.Core/Dashboards/IDashboardSection.cs create mode 100644 src/Umbraco.Core/Dashboards/IDashboardSlim.cs delete mode 100644 src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs rename src/Umbraco.Core/Manifest/{ManifestDashboardDefinition.cs => ManifestDashboard.cs} (86%) delete mode 100644 src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config delete mode 100644 src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs delete mode 100644 src/Umbraco.Tests/Configurations/DashboardSettings/web.config delete mode 100644 src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs diff --git a/src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs b/src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs index f8ecc11d98..88eb61de76 100644 --- a/src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs +++ b/src/Umbraco.Core/Composing/WeightedCollectionBuilderBase.cs @@ -114,7 +114,7 @@ namespace Umbraco.Core.Composing return list; } - protected virtual int DefaultWeight { get; set; } = 10; + public virtual int DefaultWeight { get; set; } = 100; protected virtual int GetWeight(Type type) { diff --git a/src/Umbraco.Core/Dashboards/DashboardSlim.cs b/src/Umbraco.Core/Dashboards/DashboardSlim.cs new file mode 100644 index 0000000000..a2869a90a2 --- /dev/null +++ b/src/Umbraco.Core/Dashboards/DashboardSlim.cs @@ -0,0 +1,12 @@ +using System.Runtime.Serialization; + +namespace Umbraco.Core.Dashboards +{ + [DataContract(IsReference = true)] + public class DashboardSlim : IDashboardSlim + { + public string Alias { get; set; } + + public string View { get; set; } + } +} diff --git a/src/Umbraco.Core/Dashboards/IDashboard.cs b/src/Umbraco.Core/Dashboards/IDashboard.cs new file mode 100644 index 0000000000..eaf6c47c88 --- /dev/null +++ b/src/Umbraco.Core/Dashboards/IDashboard.cs @@ -0,0 +1,37 @@ +using System.Runtime.Serialization; + +namespace Umbraco.Core.Dashboards +{ + /// + /// Represents a dashboard. + /// + public interface IDashboard : IDashboardSlim + { + /// + /// Gets the aliases of sections/applications where this dashboard appears. + /// + /// + /// This field is *not* needed by the UI and therefore we want to exclude + /// it from serialization, but it is deserialized as part of the manifest, + /// therefore we cannot plainly ignore it. + /// So, it has to remain a data member, plus we use our special + /// JsonDontSerialize attribute (see attribute for more details). + /// + [DataMember(Name = "sections")] + string[] Sections { get; } + + + /// + /// Gets the access rule determining the visibility of the dashboard. + /// + /// + /// This field is *not* needed by the UI and therefore we want to exclude + /// it from serialization, but it is deserialized as part of the manifest, + /// therefore we cannot plainly ignore it. + /// So, it has to remain a data member, plus we use our special + /// JsonDontSerialize attribute (see attribute for more details). + /// + [DataMember(Name = "access")] + IAccessRule[] AccessRules { get; } + } +} diff --git a/src/Umbraco.Core/Dashboards/IDashboardSection.cs b/src/Umbraco.Core/Dashboards/IDashboardSection.cs deleted file mode 100644 index 73cf8513f9..0000000000 --- a/src/Umbraco.Core/Dashboards/IDashboardSection.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Runtime.Serialization; -using Umbraco.Core.Manifest; - -namespace Umbraco.Core.Dashboards -{ - public interface IDashboardSection - { - /// - /// Alias to refer to this dashboard via code - /// - [DataMember(Name = "alias")] - string Alias { get; } - - /// - /// A collection of sections/application aliases that this dashboard will appear on - /// - [DataMember(Name = "sections")] - [IgnoreDataMemberWhenSerializing] - string[] Sections { get; } - - /// - /// The HTML view to load for the dashboard - /// - [DataMember(Name = "view")] - string View { get; } - - /// - /// Dashboards can be shown/hidden based on access rights - /// - [DataMember(Name = "access")] - [IgnoreDataMemberWhenSerializing] - IAccessRule[] AccessRules { get; } - } -} diff --git a/src/Umbraco.Core/Dashboards/IDashboardSlim.cs b/src/Umbraco.Core/Dashboards/IDashboardSlim.cs new file mode 100644 index 0000000000..655f56dfd9 --- /dev/null +++ b/src/Umbraco.Core/Dashboards/IDashboardSlim.cs @@ -0,0 +1,22 @@ +using System.Runtime.Serialization; + +namespace Umbraco.Core.Dashboards +{ + /// + /// Represents a dashboard with only minimal data. + /// + public interface IDashboardSlim + { + /// + /// Gets the alias of the dashboard. + /// + [DataMember(Name = "alias")] + string Alias { get; } + + /// + /// Gets the view used to render the dashboard. + /// + [DataMember(Name = "view")] + string View { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs b/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs deleted file mode 100644 index 8486e1b6a9..0000000000 --- a/src/Umbraco.Core/Manifest/IgnoreDataMemberWhenSerializingAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Manifest -{ - /// - /// When applied to the member of a type, specifies that the member is not part of a data contract when - /// serialized but still when deserialized as opposite to . - /// - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] - public class IgnoreDataMemberWhenSerializingAttribute : Attribute - { - - } -} diff --git a/src/Umbraco.Core/Manifest/ManifestContentAppDefinition.cs b/src/Umbraco.Core/Manifest/ManifestContentAppDefinition.cs index 0667f11aab..af66bfc544 100644 --- a/src/Umbraco.Core/Manifest/ManifestContentAppDefinition.cs +++ b/src/Umbraco.Core/Manifest/ManifestContentAppDefinition.cs @@ -1,12 +1,6 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; -using System.Text.RegularExpressions; using Umbraco.Core.IO; -using Umbraco.Core.Models; -using Umbraco.Core.Models.ContentEditing; -using Umbraco.Core.Models.Membership; namespace Umbraco.Core.Manifest { @@ -30,6 +24,7 @@ namespace Umbraco.Core.Manifest /// /// Represents a content app definition, parsed from a manifest. /// + /// Is used to create an actual . [DataContract(Name = "appdef", Namespace = "")] public class ManifestContentAppDefinition { diff --git a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs b/src/Umbraco.Core/Manifest/ManifestDashboard.cs similarity index 86% rename from src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs rename to src/Umbraco.Core/Manifest/ManifestDashboard.cs index 879f78e19c..e790655221 100644 --- a/src/Umbraco.Core/Manifest/ManifestDashboardDefinition.cs +++ b/src/Umbraco.Core/Manifest/ManifestDashboard.cs @@ -6,7 +6,7 @@ using Umbraco.Core.IO; namespace Umbraco.Core.Manifest { - public class ManifestDashboardDefinition : IDashboardSection + public class ManifestDashboard : IDashboard { private string _view; @@ -14,7 +14,7 @@ namespace Umbraco.Core.Manifest public string Alias { get; set; } [JsonProperty("weight", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)] - [DefaultValue(100)] + [DefaultValue(100)] // must be equal to DashboardCollectionBuilder.DefaultWeight public int Weight { get; set; } [JsonProperty("view", Required = Required.Always)] @@ -29,6 +29,5 @@ namespace Umbraco.Core.Manifest [JsonProperty("access")] public IAccessRule[] AccessRules { get; set; } = Array.Empty(); - } } diff --git a/src/Umbraco.Core/Manifest/ManifestParser.cs b/src/Umbraco.Core/Manifest/ManifestParser.cs index 825ffb7314..6ca3b916ea 100644 --- a/src/Umbraco.Core/Manifest/ManifestParser.cs +++ b/src/Umbraco.Core/Manifest/ManifestParser.cs @@ -100,7 +100,7 @@ namespace Umbraco.Core.Manifest var parameterEditors = new List(); var gridEditors = new List(); var contentApps = new List(); - var dashboards = new List(); + var dashboards = new List(); var sections = new List(); foreach (var manifest in manifests) diff --git a/src/Umbraco.Core/Manifest/PackageManifest.cs b/src/Umbraco.Core/Manifest/PackageManifest.cs index b29a28ab06..c272449509 100644 --- a/src/Umbraco.Core/Manifest/PackageManifest.cs +++ b/src/Umbraco.Core/Manifest/PackageManifest.cs @@ -49,7 +49,7 @@ namespace Umbraco.Core.Manifest /// Gets or sets the dashboards listed in the manifest. /// [JsonProperty("dashboards")] - public ManifestDashboardDefinition[] Dashboards { get; set; } = Array.Empty(); + public ManifestDashboard[] Dashboards { get; set; } = Array.Empty(); /// /// Gets or sets the sections listed in the manifest. diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index ebd0e2735b..a4e60bb9a9 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -313,8 +313,10 @@ + - + + @@ -354,11 +356,10 @@ - - + diff --git a/src/Umbraco.Tests/Composing/CollectionBuildersTests.cs b/src/Umbraco.Tests/Composing/CollectionBuildersTests.cs index 4c262fbf82..8ea13fc920 100644 --- a/src/Umbraco.Tests/Composing/CollectionBuildersTests.cs +++ b/src/Umbraco.Tests/Composing/CollectionBuildersTests.cs @@ -453,7 +453,7 @@ namespace Umbraco.Tests.Composing public class Resolved1 : Resolved { } - [Weight(5)] // default is 10 + [Weight(50)] // default is 100 public class Resolved2 : Resolved { } diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config b/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config deleted file mode 100644 index 4c86355a1b..0000000000 --- a/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config +++ /dev/null @@ -1,114 +0,0 @@ - - - -
    - - settings - - - - views/dashboard/settings/settingsdashboardintro.html - - - views/dashboard/settings/settingsdashboardvideos.html - - - - dashboard/ExamineManagement.ascx - -
    - -
    - - developer - - - - views/dashboard/developer/developerdashboardintro.html - - - views/dashboard/developer/developerdashboardvideos.html - - -
    - -
    - - media - - - - views/dashboard/media/mediafolderbrowser.html - - - - - admin - - - views/dashboard/media/mediadashboardintro.html - - - views/dashboard/media/desktopmediauploader.html - - - views/dashboard/media/mediadashboardvideos.html - - -
    - -
    - - translator - hello - world - - - content - - - - admin - - - views/dashboard/default/startupdashboardintro.html - - - views/dashboard/default/startupdashboardkits.html - - editor - writer - - - - views/dashboard/default/startupdashboardvideos.html - - - - dashboard/latestEdits.ascx - - - - views/dashboard/changepassword.html - - -
    - -
    - - default - member - - - - views/dashboard/members/membersdashboardintro.html - - - members/membersearch.ascx - - - views/dashboard/members/membersdashboardvideos.html - - -
    -
    diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs b/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs deleted file mode 100644 index 219e6092d2..0000000000 --- a/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Configuration; -using System.IO; -using System.Linq; -using NUnit.Framework; -using Umbraco.Core.Dashboards; -using Umbraco.Tests.TestHelpers; - -namespace Umbraco.Tests.Configurations.DashboardSettings -{ - //[Obsolete("Dashboard tests not in config/XML", true)] - //[TestFixture] - //public class DashboardSettingsTests - //{ - // [SetUp] - // public void Init() - // { - // var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/DashboardSettings/web.config")); - - // var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; - // var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); - - // SettingsSection = configuration.GetSection("umbracoConfiguration/dashBoard") as DashboardSection; - - // Assert.IsNotNull(SettingsSection); - // } - - // protected IDashboardSection SettingsSection { get; private set; } - - // [Test] - // public void Test_Sections() - // { - // Assert.AreEqual(5, SettingsSection.Sections.Count()); - - // Assert.AreEqual("StartupSettingsDashboardSection", SettingsSection.Sections.ElementAt(0).Alias); - // Assert.AreEqual("StartupDeveloperDashboardSection", SettingsSection.Sections.ElementAt(1).Alias); - // Assert.AreEqual("StartupMediaDashboardSection", SettingsSection.Sections.ElementAt(2).Alias); - // Assert.AreEqual("StartupDashboardSection", SettingsSection.Sections.ElementAt(3).Alias); - // Assert.AreEqual("StartupMemberDashboardSection", SettingsSection.Sections.ElementAt(4).Alias); - // } - - // [Test] - // public void Test_Section_Area() - // { - // Assert.AreEqual("settings", SettingsSection.Sections.ElementAt(0).Areas.First()); - // Assert.AreEqual("developer", SettingsSection.Sections.ElementAt(1).Areas.First()); - // Assert.AreEqual("media", SettingsSection.Sections.ElementAt(2).Areas.First()); - // Assert.AreEqual("content", SettingsSection.Sections.ElementAt(3).Areas.First()); - // Assert.AreEqual("default", SettingsSection.Sections.ElementAt(4).Areas.First()); - // Assert.AreEqual("member", SettingsSection.Sections.ElementAt(4).Areas.Last()); - // } - - // [Test] - // public void Test_Section_Access() - // { - - // Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.Count()); - - // Assert.AreEqual("translator", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Value); - // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Type); - // Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Value); - // Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Type); - // Assert.AreEqual("world", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Value); - // Assert.AreEqual(AccessRuleType.GrantBySection, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Type); - // } - - // [Test] - // public void Test_Section_Tabs() - // { - // //Element 0 Alias "StartupSettingsDashboardSection" - // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.Count()); - - // //Element 1 Alias "StartupDeveloperDashboardSection" - // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(1).Tabs.Count()); - - // //Element 2 Alias "StartupMediaDashboardSection" - // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(2).Tabs.Count()); - - // //Element 3 Alias "StartupDashboardSection" - // Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).Tabs.Count()); - - // //Element 4 Alias "StartupMemberDashboardSection" - // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(4).Tabs.Count()); - - // } - - // [Test] - // public void Test_Tab() - // { - // Assert.AreEqual("Get Started", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Caption); - // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.Count()); - // } - - // [Test] - // public void Test_Tab_Access() - // { - // Assert.AreEqual(1, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.Count()); - // Assert.AreEqual(AccessRuleType.Grant, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); - // Assert.AreEqual("admin", SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); - // } - - // [Test] - // public void Test_Control() - // { - // Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).PanelCaption); - // Assert.AreEqual("views/dashboard/settings/settingsdashboardintro.html", - // SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).ControlPath); - - // Assert.AreEqual("", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).PanelCaption); - // Assert.AreEqual("views/dashboard/settings/settingsdashboardvideos.html", - // SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).ControlPath); - // } - - // [Test] - // public void Test_Control_Access() - // { - // Assert.AreEqual(2, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.Count()); - // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Type); - // Assert.AreEqual("editor", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); - // Assert.AreEqual(AccessRuleType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Type); - // Assert.AreEqual("writer", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Value); - // } - //} -} diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/web.config b/src/Umbraco.Tests/Configurations/DashboardSettings/web.config deleted file mode 100644 index 8cf262cbff..0000000000 --- a/src/Umbraco.Tests/Configurations/DashboardSettings/web.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - -
    - - - - - - - - \ No newline at end of file diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index d78c41f57a..6605bc4546 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -404,7 +404,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 var manifest = _parser.ParseManifest(json); Assert.AreEqual(2, manifest.Dashboards.Length); - Assert.IsInstanceOf(manifest.Dashboards[0]); + Assert.IsInstanceOf(manifest.Dashboards[0]); var db0 = manifest.Dashboards[0]; Assert.AreEqual("something", db0.Alias); Assert.AreEqual(100, db0.Weight); @@ -417,7 +417,7 @@ javascript: ['~/test.js',/*** some note about stuff asd09823-4**09234*/ '~/test2 Assert.AreEqual(AccessRuleType.Deny, db0.AccessRules[1].Type); Assert.AreEqual("foo", db0.AccessRules[1].Value); - Assert.IsInstanceOf(manifest.Dashboards[1]); + Assert.IsInstanceOf(manifest.Dashboards[1]); var db1 = manifest.Dashboards[1]; Assert.AreEqual("something.else", db1.Alias); Assert.AreEqual(-1, db1.Weight); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 11f5527a8c..cd73b2836b 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -292,7 +292,6 @@ - @@ -499,14 +498,6 @@ Designer - - Designer - Always - - - Designer - Always - Designer Always diff --git a/src/Umbraco.Web/Dashboards/ContentDashboard.cs b/src/Umbraco.Web/Dashboards/ContentDashboard.cs index 1ff741b7e4..0cd96f738c 100644 --- a/src/Umbraco.Web/Dashboards/ContentDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ContentDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - public class ContentDashboard : IDashboardSection + public class ContentDashboard : IDashboard { public string Alias => "contentIntro"; diff --git a/src/Umbraco.Web/Dashboards/DashboardCollection.cs b/src/Umbraco.Web/Dashboards/DashboardCollection.cs index 8d3bde622e..616a2cc8cc 100644 --- a/src/Umbraco.Web/Dashboards/DashboardCollection.cs +++ b/src/Umbraco.Web/Dashboards/DashboardCollection.cs @@ -4,9 +4,9 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { - public class DashboardCollection : BuilderCollectionBase + public class DashboardCollection : BuilderCollectionBase { - public DashboardCollection(IEnumerable items) + public DashboardCollection(IEnumerable items) : base(items) { } } diff --git a/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs index 336625c415..36a417e957 100644 --- a/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs +++ b/src/Umbraco.Web/Dashboards/DashboardCollectionBuilder.cs @@ -1,47 +1,45 @@ using System.Collections.Generic; using System.Linq; +using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Dashboards; using Umbraco.Core.Manifest; namespace Umbraco.Web.Dashboards { - public class DashboardCollectionBuilder : WeightedCollectionBuilderBase + public class DashboardCollectionBuilder : WeightedCollectionBuilderBase { protected override DashboardCollectionBuilder This => this; - protected override IEnumerable CreateItems(IFactory factory) + protected override IEnumerable CreateItems(IFactory factory) { // get the manifest parser just-in-time - injecting it in the ctor would mean that // simply getting the builder in order to configure the collection, would require // its dependencies too, and that can create cycles or other oddities var manifestParser = factory.GetInstance(); - var dashboardSections = Merge(base.CreateItems(factory).ToArray(), manifestParser.Manifest.Dashboards); + var dashboardSections = Merge(base.CreateItems(factory), manifestParser.Manifest.Dashboards); return dashboardSections; } - private IEnumerable Merge(IReadOnlyList dashboardsFromCode, IReadOnlyList dashboardFromManifest) + private IEnumerable Merge(IEnumerable dashboardsFromCode, IReadOnlyList dashboardFromManifest) { - var list = dashboardsFromCode.Concat(dashboardFromManifest) - .Where(x=>!string.IsNullOrEmpty(x.Alias)) - .Select(x => (Weight: GetWeight(x), DashboardSection: x)) - .OrderBy(x=>x.Weight); - - return list.Select(x => x.DashboardSection); + return dashboardsFromCode.Concat(dashboardFromManifest) + .Where(x => !string.IsNullOrEmpty(x.Alias)) + .OrderBy(GetWeight); } - private static int GetWeight(IDashboardSection dashboardSection) + private int GetWeight(IDashboard dashboard) { - switch (dashboardSection) + switch (dashboard) { - case ManifestDashboardDefinition danifestDashboardDefinition: - return danifestDashboardDefinition.Weight; + case ManifestDashboard manifestDashboardDefinition: + return manifestDashboardDefinition.Weight; + default: - var weightAttribute = dashboardSection.GetType().GetCustomAttributes(typeof(WeightAttribute), false) - .Cast().FirstOrDefault(); - return weightAttribute.Weight; + var weightAttribute = dashboard.GetType().GetCustomAttribute(false); + return weightAttribute?.Weight ?? DefaultWeight; } } } diff --git a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs index 8363e8079c..47cf97ca3b 100644 --- a/src/Umbraco.Web/Dashboards/ExamineDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ExamineDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(20)] - public class ExamineDashboard : IDashboardSection + public class ExamineDashboard : IDashboard { public string Alias => "settingsExamine"; diff --git a/src/Umbraco.Web/Dashboards/FormsDashboard.cs b/src/Umbraco.Web/Dashboards/FormsDashboard.cs index 0121fcd2c1..a3e1123369 100644 --- a/src/Umbraco.Web/Dashboards/FormsDashboard.cs +++ b/src/Umbraco.Web/Dashboards/FormsDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - public class FormsDashboard : IDashboardSection + public class FormsDashboard : IDashboard { public string Alias => "formsInstall"; diff --git a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs index a8347f1806..746dd04439 100644 --- a/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs +++ b/src/Umbraco.Web/Dashboards/HealthCheckDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(50)] - public class HealthCheckDashboard : IDashboardSection + public class HealthCheckDashboard : IDashboard { public string Alias => "settingsHealthCheck"; diff --git a/src/Umbraco.Web/Dashboards/MediaDashboard.cs b/src/Umbraco.Web/Dashboards/MediaDashboard.cs index ae8f8343ce..c97ae298f3 100644 --- a/src/Umbraco.Web/Dashboards/MediaDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MediaDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - public class MediaDashboard : IDashboardSection + public class MediaDashboard : IDashboard { public string Alias => "mediaFolderBrowser"; diff --git a/src/Umbraco.Web/Dashboards/MembersDashboard.cs b/src/Umbraco.Web/Dashboards/MembersDashboard.cs index 57183ab6a6..473722dce1 100644 --- a/src/Umbraco.Web/Dashboards/MembersDashboard.cs +++ b/src/Umbraco.Web/Dashboards/MembersDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - public class MembersDashboard : IDashboardSection + public class MembersDashboard : IDashboard { public string Alias => "memberIntro"; diff --git a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs index 5e284ee0c2..44bc00cb6f 100644 --- a/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs +++ b/src/Umbraco.Web/Dashboards/ModelsBuilderDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(40)] - public class ModelsBuilderDashboard : IDashboardSection + public class ModelsBuilderDashboard : IDashboard { public string Alias => "settingsModelsBuilder"; diff --git a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs index 17e99bdf5b..66faa20b55 100644 --- a/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs +++ b/src/Umbraco.Web/Dashboards/PublishedStatusDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(30)] - public class PublishedStatusDashboard : IDashboardSection + public class PublishedStatusDashboard : IDashboard { public string Alias => "settingsPublishedStatus"; diff --git a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs index 76cc03202d..f538cbc122 100644 --- a/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs +++ b/src/Umbraco.Web/Dashboards/RedirectUrlDashboard.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(20)] - public class RedirectUrlDashboard : IDashboardSection + public class RedirectUrlDashboard : IDashboard { public string Alias => "contentRedirectManager"; diff --git a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs index 1fd32bee14..5cd92e4c3f 100644 --- a/src/Umbraco.Web/Dashboards/SettingsDashboards.cs +++ b/src/Umbraco.Web/Dashboards/SettingsDashboards.cs @@ -5,7 +5,7 @@ using Umbraco.Core.Dashboards; namespace Umbraco.Web.Dashboards { [Weight(10)] - public class SettingsDashboard : IDashboardSection + public class SettingsDashboard : IDashboard { public string Alias => "settingsWelcome"; diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index b166a8b4bf..1b11b1c4f3 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json.Linq; using System.Threading.Tasks; using System.Net.Http; using System; +using System.Linq; using System.Net; using System.Text; using Umbraco.Core.Cache; @@ -26,7 +27,6 @@ namespace Umbraco.Web.Editors [AngularJsonOnlyConfiguration] [IsBackOffice] [WebApi.UmbracoAuthorize] - [JsonCamelCaseFormatter] public class DashboardController : UmbracoApiController { @@ -133,11 +133,24 @@ namespace Umbraco.Web.Editors }; } + // return IDashboardSlim - we don't need sections nor access rules [ValidateAngularAntiForgeryToken] [OutgoingEditorModelEvent] - public IEnumerable> GetDashboard(string section) + public IEnumerable> GetDashboard(string section) { - return _dashboardService.GetDashboards(section, Security.CurrentUser); + return _dashboardService.GetDashboards(section, Security.CurrentUser).Select(x => new Tab + { + Id = x.Id, + Alias = x.Alias, + Label = x.Label, + Expanded = x.Expanded, + IsActive = x.IsActive, + Properties = x.Properties.Select(y => new DashboardSlim + { + Alias = y.Alias, + View = y.View + }) + }); } } } diff --git a/src/Umbraco.Web/Editors/EditorModelEventManager.cs b/src/Umbraco.Web/Editors/EditorModelEventManager.cs index dd5282d724..c3a7d128ec 100644 --- a/src/Umbraco.Web/Editors/EditorModelEventManager.cs +++ b/src/Umbraco.Web/Editors/EditorModelEventManager.cs @@ -15,9 +15,9 @@ namespace Umbraco.Web.Editors public static event TypedEventHandler> SendingMediaModel; public static event TypedEventHandler> SendingMemberModel; public static event TypedEventHandler> SendingUserModel; - public static event TypedEventHandler>>> SendingDashboardModel; + public static event TypedEventHandler>>> SendingDashboardModel; - private static void OnSendingDashboardModel(HttpActionExecutedContext sender, EditorModelEventArgs>> e) + private static void OnSendingDashboardModel(HttpActionExecutedContext sender, EditorModelEventArgs>> e) { var handler = SendingDashboardModel; handler?.Invoke(sender, e); @@ -66,8 +66,8 @@ namespace Umbraco.Web.Editors if (e.Model is UserDisplay) OnSendingUserModel(sender, new EditorModelEventArgs(e)); - if (e.Model is IEnumerable) - OnSendingDashboardModel(sender, new EditorModelEventArgs>>(e)); + if (e.Model is IEnumerable) + OnSendingDashboardModel(sender, new EditorModelEventArgs>>(e)); } } } diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index c1ae3f15fb..b8a7fee2f7 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -103,7 +103,7 @@ namespace Umbraco.Web.Runtime // configure the container for web composition.ConfigureForWeb(); - + composition .ComposeUmbracoControllers(GetType().Assembly) .SetDefaultRenderMvcController(); // default controller for template views @@ -203,10 +203,9 @@ namespace Umbraco.Web.Runtime .Append() .Append(); - // register core CMS dashboards and 3rd party types - will be ordered by weight attribute & merged with package.manifest dashboards composition.WithCollectionBuilder() - .Add(composition.TypeLoader.GetTypes()); + .Add(composition.TypeLoader.GetTypes()); // register back office trees foreach (var treeControllerType in umbracoApiControllerTypes diff --git a/src/Umbraco.Web/Services/DashboardService.cs b/src/Umbraco.Web/Services/DashboardService.cs index 373c70e6d2..71969df475 100644 --- a/src/Umbraco.Web/Services/DashboardService.cs +++ b/src/Umbraco.Web/Services/DashboardService.cs @@ -32,9 +32,9 @@ namespace Umbraco.Web.Services /// - public IEnumerable> GetDashboards(string section, IUser currentUser) + public IEnumerable> GetDashboards(string section, IUser currentUser) { - var tabs = new List>(); + var tabs = new List>(); var tabId = 0; foreach (var dashboard in _dashboardCollection.Where(x => x.Sections.InvariantContains(section))) @@ -46,8 +46,8 @@ namespace Umbraco.Web.Services if (dashboard.View.InvariantEndsWith(".ascx")) throw new NotSupportedException("Legacy UserControl (.ascx) dashboards are no longer supported."); - var dashboards = new List {dashboard}; - tabs.Add(new Tab + var dashboards = new List {dashboard}; + tabs.Add(new Tab { Id = tabId++, Label = _localizedText.Localize("dashboardTabs", dashboard.Alias), @@ -60,7 +60,7 @@ namespace Umbraco.Web.Services } /// - public IDictionary>> GetDashboards(IUser currentUser) + public IDictionary>> GetDashboards(IUser currentUser) { return _sectionService.GetSections().ToDictionary(x => x.Alias, x => GetDashboards(x.Alias, currentUser)); } diff --git a/src/Umbraco.Web/Services/IDashboardService.cs b/src/Umbraco.Web/Services/IDashboardService.cs index a86715c83d..11ff2728cf 100644 --- a/src/Umbraco.Web/Services/IDashboardService.cs +++ b/src/Umbraco.Web/Services/IDashboardService.cs @@ -14,14 +14,14 @@ namespace Umbraco.Web.Services /// /// /// - IEnumerable> GetDashboards(string section, IUser currentUser); + IEnumerable> GetDashboards(string section, IUser currentUser); /// /// Gets all dashboards, organized by section, for a user. /// /// /// - IDictionary>> GetDashboards(IUser currentUser); + IDictionary>> GetDashboards(IUser currentUser); } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index c3ff7d47da..f81eff75ad 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -262,7 +262,6 @@ - diff --git a/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs b/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs deleted file mode 100644 index 49ab02a12e..0000000000 --- a/src/Umbraco.Web/WebApi/CamelCaseAndDataMemberWhenSerializingContractResolver.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using Newtonsoft.Json.Serialization; -using Umbraco.Core.Manifest; - -namespace Umbraco.Web.WebApi -{ - - public class CamelCaseAndDataMemberWhenSerializingContractResolver : CamelCasePropertyNamesContractResolver - { - /// - protected override List GetSerializableMembers(Type objectType) - { - return base.GetSerializableMembers(objectType) - .Where(HasNotTheIgnoreDataMemberWhenSerializingAttribute) - .ToList(); - } - - private bool HasNotTheIgnoreDataMemberWhenSerializingAttribute(MemberInfo member) - { - if (member.GetCustomAttributes(typeof(IgnoreDataMemberWhenSerializingAttribute), true).Any()) - { - return false; - } - - return true; - } - } -} diff --git a/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs b/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs index 5803afc819..912edc1397 100644 --- a/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs +++ b/src/Umbraco.Web/WebApi/JsonCamelCaseFormatter.cs @@ -2,9 +2,7 @@ using System.Linq; using System.Net.Http.Formatting; using System.Web.Http.Controllers; -using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using Umbraco.Core.Manifest; namespace Umbraco.Web.WebApi { @@ -26,7 +24,7 @@ namespace Umbraco.Web.WebApi { SerializerSettings = { - ContractResolver = new CamelCaseAndDataMemberWhenSerializingContractResolver() + ContractResolver = new CamelCasePropertyNamesContractResolver() } }; controllerSettings.Formatters.Add(jsonFormatter); From 27fd90851752d65c43e0c5a0a2683d492d51fd9a Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 14:04:31 +0100 Subject: [PATCH 72/76] Refactor IPublished --- .../PublishedContent/NuCacheTests.cs | 135 +++++++++++++----- .../NuCache/DataSource/CultureVariation.cs | 3 - .../NuCache/PublishedContent.cs | 28 ++-- .../NuCache/PublishedSnapshotService.cs | 21 +-- 4 files changed, 121 insertions(+), 66 deletions(-) diff --git a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs index ef37a822c1..cd5273cce7 100644 --- a/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs +++ b/src/Umbraco.Tests/PublishedContent/NuCacheTests.cs @@ -20,6 +20,7 @@ using Umbraco.Tests.Testing.Objects; using Umbraco.Tests.Testing.Objects.Accessors; using Umbraco.Web; using Umbraco.Web.Cache; +using Umbraco.Web.PublishedCache; using Umbraco.Web.PublishedCache.NuCache; using Umbraco.Web.PublishedCache.NuCache.DataSource; using Umbraco.Web.Routing; @@ -29,12 +30,13 @@ namespace Umbraco.Tests.PublishedContent [TestFixture] public class NuCacheTests { - [Test] - public void StandaloneVariations() - { - // this test implements a full standalone NuCache (based upon a test IDataSource, does not - // use any local db files, does not rely on any database) - and tests variations + private IPublishedSnapshotService _snapshotService; + private IVariationContextAccessor _variationAccesor; + private ContentType _contentType; + private PropertyType _propertyType; + private void Init() + { Current.Reset(); Current.UnlockConfigs(); Current.Configs.Add(SettingsForTests.GenerateMockUmbracoSettings); @@ -46,20 +48,39 @@ namespace Umbraco.Tests.PublishedContent { ContentTypeId = 2, Node = new ContentNode(1, Guid.NewGuid(), 0, "-1,1", 0, -1, DateTime.Now, 0), - DraftData = new ContentData { Name="It Works2!", Published = false, TemplateId = 0, VersionId = 2, VersionDate = DateTime.Now, WriterId = 0, + DraftData = new ContentData + { + Name = "It Works2!", + Published = false, + TemplateId = 0, + VersionId = 2, + VersionDate = DateTime.Now, + WriterId = 0, Properties = new Dictionary { { "prop", new[] { new PropertyData { Culture = "", Segment = "", Value = "val2" }, new PropertyData { Culture = "fr-FR", Segment = "", Value = "val-fr2" }, - new PropertyData { Culture = "en-UK", Segment = "", Value = "val-uk2" } + new PropertyData { Culture = "en-UK", Segment = "", Value = "val-uk2" }, + new PropertyData { Culture = "dk-DA", Segment = "", Value = "val-da2" }, + new PropertyData { Culture = "de-DE", Segment = "", Value = "val-de2" } } } }, CultureInfos = new Dictionary { - { "fr-FR", new CultureVariation { Name = "name-fr2", Date = new DateTime(2018, 01, 03, 01, 00, 00) } }, - { "en-UK", new CultureVariation { Name = "name-uk2", Date = new DateTime(2018, 01, 04, 01, 00, 00) } } + // draft data = everything, and IsDraft indicates what's edited + { "fr-FR", new CultureVariation { Name = "name-fr2", IsDraft = true, Date = new DateTime(2018, 01, 03, 01, 00, 00) } }, + { "en-UK", new CultureVariation { Name = "name-uk2", IsDraft = true, Date = new DateTime(2018, 01, 04, 01, 00, 00) } }, + { "dk-DA", new CultureVariation { Name = "name-da2", IsDraft = true, Date = new DateTime(2018, 01, 05, 01, 00, 00) } }, + { "de-DE", new CultureVariation { Name = "name-de1", IsDraft = false, Date = new DateTime(2018, 01, 02, 01, 00, 00) } } } }, - PublishedData = new ContentData { Name="It Works1!", Published = true, TemplateId = 0, VersionId = 1, VersionDate = DateTime.Now, WriterId = 0, + PublishedData = new ContentData + { + Name = "It Works1!", + Published = true, + TemplateId = 0, + VersionId = 1, + VersionDate = DateTime.Now, + WriterId = 0, Properties = new Dictionary { { "prop", new[] { new PropertyData { Culture = "", Segment = "", Value = "val1" }, @@ -68,8 +89,10 @@ namespace Umbraco.Tests.PublishedContent } } }, CultureInfos = new Dictionary { - { "fr-FR", new CultureVariation { Name = "name-fr1", Date = new DateTime(2018, 01, 01, 01, 00, 00) } }, - { "en-UK", new CultureVariation { Name = "name-uk1", Date = new DateTime(2018, 01, 02, 01, 00, 00) } } + // published data = only what's actually published, and IsDraft has to be false + { "fr-FR", new CultureVariation { Name = "name-fr1", IsDraft = false, Date = new DateTime(2018, 01, 01, 01, 00, 00) } }, + { "en-UK", new CultureVariation { Name = "name-uk1", IsDraft = false, Date = new DateTime(2018, 01, 02, 01, 00, 00) } }, + { "de-DE", new CultureVariation { Name = "name-de1", IsDraft = false, Date = new DateTime(2018, 01, 02, 01, 00, 00) } } } } }; @@ -88,13 +111,13 @@ namespace Umbraco.Tests.PublishedContent dataType }; - var propertyType = new PropertyType("Umbraco.Void.Editor", ValueStorageType.Nvarchar) { Alias = "prop", DataTypeId = 3, Variations = ContentVariation.Culture }; - var contentType = new ContentType(-1) { Id = 2, Alias = "alias-ct", Variations = ContentVariation.Culture }; - contentType.AddPropertyType(propertyType); + _propertyType = new PropertyType("Umbraco.Void.Editor", ValueStorageType.Nvarchar) { Alias = "prop", DataTypeId = 3, Variations = ContentVariation.Culture }; + _contentType = new ContentType(-1) { Id = 2, Alias = "alias-ct", Variations = ContentVariation.Culture }; + _contentType.AddPropertyType(_propertyType); var contentTypes = new[] { - contentType + _contentType }; var contentTypeService = Mock.Of(); @@ -106,10 +129,10 @@ namespace Umbraco.Tests.PublishedContent // create a service context var serviceContext = ServiceContext.CreatePartial( - dataTypeService : dataTypeService, + dataTypeService: dataTypeService, memberTypeService: Mock.Of(), memberService: Mock.Of(), - contentTypeService : contentTypeService, + contentTypeService: contentTypeService, localizationService: Mock.Of() ); @@ -132,18 +155,18 @@ namespace Umbraco.Tests.PublishedContent dataTypeService); // create a variation accessor - var variationAccessor = new TestVariationContextAccessor(); + _variationAccesor = new TestVariationContextAccessor(); // at last, create the complete NuCache snapshot service! var options = new PublishedSnapshotService.Options { IgnoreLocalDb = true }; - var snapshotService = new PublishedSnapshotService(options, + _snapshotService = new PublishedSnapshotService(options, null, runtime, serviceContext, contentTypeFactory, null, new TestPublishedSnapshotAccessor(), - variationAccessor, + _variationAccesor, Mock.Of(), scopeProvider, Mock.Of(), @@ -155,12 +178,21 @@ namespace Umbraco.Tests.PublishedContent new SiteDomainHelper(), Mock.Of()); - // get a snapshot, get a published content - var snapshot = snapshotService.CreatePublishedSnapshot(previewToken: null); - var publishedContent = snapshot.Content.GetById(1); - // invariant is the current default - variationAccessor.VariationContext = new VariationContext(); + _variationAccesor.VariationContext = new VariationContext(); + } + + [Test] + public void StandaloneVariations() + { + // this test implements a full standalone NuCache (based upon a test IDataSource, does not + // use any local db files, does not rely on any database) - and tests variations + + Init(); + + // get a snapshot, get a published content + var snapshot = _snapshotService.CreatePublishedSnapshot(previewToken: null); + var publishedContent = snapshot.Content.GetById(1); Assert.IsNotNull(publishedContent); Assert.AreEqual("It Works1!", publishedContent.Name); @@ -181,31 +213,31 @@ namespace Umbraco.Tests.PublishedContent Assert.AreEqual("name-uk2", draftContent.GetCulture("en-UK").Name); // now french is default - variationAccessor.VariationContext = new VariationContext("fr-FR"); + _variationAccesor.VariationContext = new VariationContext("fr-FR"); Assert.AreEqual("val-fr1", publishedContent.Value("prop")); Assert.AreEqual("name-fr1", publishedContent.GetCulture().Name); Assert.AreEqual("name-fr1", publishedContent.Name); Assert.AreEqual(new DateTime(2018, 01, 01, 01, 00, 00), publishedContent.GetCulture().Date); // now uk is default - variationAccessor.VariationContext = new VariationContext("en-UK"); + _variationAccesor.VariationContext = new VariationContext("en-UK"); Assert.AreEqual("val-uk1", publishedContent.Value("prop")); Assert.AreEqual("name-uk1", publishedContent.GetCulture().Name); Assert.AreEqual("name-uk1", publishedContent.Name); Assert.AreEqual(new DateTime(2018, 01, 02, 01, 00, 00), publishedContent.GetCulture().Date); - // invariant needs to be retrieved explicitely, when it's not default + // invariant needs to be retrieved explicitly, when it's not default Assert.AreEqual("val1", publishedContent.Value("prop", culture: "")); // but, // if the content type / property type does not vary, then it's all invariant again // modify the content type and property type, notify the snapshot service - contentType.Variations = ContentVariation.Nothing; - propertyType.Variations = ContentVariation.Nothing; - snapshotService.Notify(new[] { new ContentTypeCacheRefresher.JsonPayload("IContentType", publishedContent.ContentType.Id, ContentTypeChangeTypes.RefreshMain) }); + _contentType.Variations = ContentVariation.Nothing; + _propertyType.Variations = ContentVariation.Nothing; + _snapshotService.Notify(new[] { new ContentTypeCacheRefresher.JsonPayload("IContentType", publishedContent.ContentType.Id, ContentTypeChangeTypes.RefreshMain) }); // get a new snapshot (nothing changed in the old one), get the published content again - var anotherSnapshot = snapshotService.CreatePublishedSnapshot(previewToken: null); + var anotherSnapshot = _snapshotService.CreatePublishedSnapshot(previewToken: null); var againContent = anotherSnapshot.Content.GetById(1); Assert.AreEqual(ContentVariation.Nothing, againContent.ContentType.Variations); @@ -215,5 +247,42 @@ namespace Umbraco.Tests.PublishedContent Assert.AreEqual("It Works1!", againContent.Name); Assert.AreEqual("val1", againContent.Value("prop")); } + + [Test] + public void IsDraftIsPublished() + { + Init(); + + // get the published published content + var s = _snapshotService.CreatePublishedSnapshot(null); + var c1 = s.Content.GetById(1); + + // published content = nothing is draft here + Assert.IsFalse(c1.IsDraft("fr-FR")); + Assert.IsFalse(c1.IsDraft("en-UK")); + Assert.IsFalse(c1.IsDraft("dk-DA")); + Assert.IsFalse(c1.IsDraft("de-DE")); + + // and only those with published name, are published + Assert.IsTrue(c1.IsPublished("fr-FR")); + Assert.IsTrue(c1.IsPublished("en-UK")); + Assert.IsFalse(c1.IsDraft("dk-DA")); + Assert.IsTrue(c1.IsPublished("de-DE")); + + // get the draft published content + var c2 = s.Content.GetById(true, 1); + + // draft content = we have drafts + Assert.IsTrue(c2.IsDraft("fr-FR")); + Assert.IsTrue(c2.IsDraft("en-UK")); + Assert.IsTrue(c2.IsDraft("dk-DA")); + Assert.IsFalse(c2.IsDraft("de-DE")); // except for the one that does not + + // and only those with published name, are published + Assert.IsTrue(c2.IsPublished("fr-FR")); + Assert.IsTrue(c2.IsPublished("en-UK")); + Assert.IsFalse(c2.IsPublished("dk-DA")); + Assert.IsTrue(c2.IsPublished("de-DE")); + } } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs index 27bae6bf39..c6e603f5a9 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/DataSource/CultureVariation.cs @@ -16,8 +16,5 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource [JsonProperty("isDraft")] public bool IsDraft { get; set; } - - [JsonProperty("isPublished")] - public bool IsPublished { get; set; } } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index caecb4e053..ced655ab43 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Web.Composing; using Umbraco.Web.Models; @@ -296,27 +295,26 @@ namespace Umbraco.Web.PublishedCache.NuCache /// public override bool IsPublished(string culture = null) { - if (!IsDraft(culture)) - { - return true; - } + // whether we are the 'draft' or 'published' content, need to determine whether + // there is a 'published' version for the specified culture (or at all, for + // invariant content items) + // if there is no 'published' published content, no culture can be published + var hasPublished = _contentNode.Published != null; + if (!hasPublished) + return false; + + // if there is a 'published' published content, and does not vary = published if (!ContentType.VariesByCulture()) - { - return _contentData.Published; - } + return true; // handle context culture if (culture == null) culture = VariationContextAccessor?.VariationContext?.Culture ?? ""; - if (_contentData.CultureInfos.TryGetValue(culture, out var variant)) - { - return variant.IsPublished; - } - - return false; - + // there is a 'published' published content, and varies + // = depends on the culture + return ((PublishedContent) _contentNode.Published)._contentData.CultureInfos.ContainsKey(culture); } #endregion diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs index fbb6ac21e7..e1cd1ec764 100755 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedSnapshotService.cs @@ -1202,25 +1202,16 @@ namespace Umbraco.Web.PublishedCache.NuCache // sanitize - names should be ok but ... never knows if (content.GetContentType().VariesByCulture()) { - - IReadOnlyDictionary infos = content.CultureInfos; - var publishedCultures = new HashSet(); - - if (content is IContent document) - { - if (published) - { - infos = document.PublishCultureInfos; - } - - publishedCultures = new HashSet(document.PublishedCultures); - } - + var infos = content is IContent document + ? (published + ? document.PublishCultureInfos + : document.CultureInfos) + : content.CultureInfos; foreach (var (culture, info) in infos) { var cultureIsDraft = !published && content is IContent d && d.IsCultureEdited(culture); - cultureData[culture] = new CultureVariation { Name = info.Name, Date = content.GetUpdateDate(culture) ?? DateTime.MinValue, IsDraft = cultureIsDraft, IsPublished = publishedCultures.Contains(culture)}; + cultureData[culture] = new CultureVariation { Name = info.Name, Date = content.GetUpdateDate(culture) ?? DateTime.MinValue, IsDraft = cultureIsDraft }; } } From 9b4b8b9d868c5f33c9034185c4018cb89ee75cb7 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 14:15:47 +0100 Subject: [PATCH 73/76] Cleanup NuCache/PublishedContent --- .../PublishedCache/NuCache/ContentCache.cs | 8 ++-- .../PublishedCache/NuCache/ContentNode.cs | 39 +++++++++++-------- .../PublishedCache/NuCache/ContentStore.cs | 2 +- .../PublishedCache/NuCache/MediaCache.cs | 6 +-- .../NuCache/PublishedContent.cs | 4 +- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs index cab6e7d759..74cf960170 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentCache.cs @@ -243,7 +243,7 @@ namespace Umbraco.Web.PublishedCache.NuCache var n = _snapshot.Get(contentId); if (n == null) return false; - return preview || n.Published != null; + return preview || n.PublishedModel != null; } public override IEnumerable GetAtRoot(bool preview) @@ -280,8 +280,8 @@ namespace Umbraco.Web.PublishedCache.NuCache // both .Draft and .Published cannot be null at the same time return preview - ? node.Draft ?? GetPublishedContentAsDraft(node.Published) - : node.Published; + ? node.DraftModel ?? GetPublishedContentAsDraft(node.PublishedModel) + : node.PublishedModel; } // gets a published content as a previewing draft, if preview is true @@ -302,7 +302,7 @@ namespace Umbraco.Web.PublishedCache.NuCache { return preview ? _snapshot.IsEmpty == false - : _snapshot.GetAtRoot().Any(x => x.Published != null); + : _snapshot.GetAtRoot().Any(x => x.PublishedModel != null); } #endregion diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs index 647adaad91..4ce6021801 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs @@ -67,9 +67,9 @@ namespace Umbraco.Web.PublishedCache.NuCache throw new ArgumentException("Both draftData and publishedData cannot be null at the same time."); if (draftData != null) - Draft = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + DraftModel = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); if (publishedData != null) - Published = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + PublishedModel = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); } // clone parent @@ -88,11 +88,11 @@ namespace Umbraco.Web.PublishedCache.NuCache CreateDate = origin.CreateDate; CreatorId = origin.CreatorId; - var originDraft = origin.Draft == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Draft); - var originPublished = origin.Published == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Published); + var originDraft = origin.DraftModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.DraftModel); + var originPublished = origin.PublishedModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.PublishedModel); - Draft = originDraft == null ? null : new PublishedContent(this, originDraft).CreateModel(); - Published = originPublished == null ? null : new PublishedContent(this, originPublished).CreateModel(); + DraftModel = originDraft == null ? null : new PublishedContent(this, originDraft).CreateModel(); + PublishedModel = originPublished == null ? null : new PublishedContent(this, originPublished).CreateModel(); ChildContentIds = new List(origin.ChildContentIds); // needs to be *another* list } @@ -110,11 +110,13 @@ namespace Umbraco.Web.PublishedCache.NuCache CreateDate = origin.CreateDate; CreatorId = origin.CreatorId; - var originDraft = origin.Draft == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Draft); - var originPublished = origin.Published == null ? null : PublishedContent.UnwrapIPublishedContent(origin.Published); + var originDraft = origin.DraftModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.DraftModel); + var originPublished = origin.PublishedModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.PublishedModel); - Draft = originDraft == null ? null : new PublishedContent(this, originDraft._contentData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); - Published = originPublished == null ? null : new PublishedContent(this, originPublished._contentData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + DraftContent = originDraft == null ? null : new PublishedContent(this, originDraft._contentData, publishedSnapshotAccessor, variationContextAccessor); + DraftModel = DraftContent?.CreateModel(); + PublishedContent = originPublished == null ? null : new PublishedContent(this, originPublished._contentData, publishedSnapshotAccessor, variationContextAccessor); + PublishedModel = PublishedContent?.CreateModel(); ChildContentIds = origin.ChildContentIds; // can be the *same* list } @@ -132,10 +134,15 @@ namespace Umbraco.Web.PublishedCache.NuCache public readonly DateTime CreateDate; public readonly int CreatorId; + // draft and published version (either can be null, but not both) + // are the direct PublishedContent instances + public PublishedContent DraftContent; + public PublishedContent PublishedContent; + // draft and published version (either can be null, but not both) // are models not direct PublishedContent instances - public IPublishedContent Draft; - public IPublishedContent Published; + public IPublishedContent DraftModel; + public IPublishedContent PublishedModel; public ContentNode CloneParent(IPublishedSnapshotAccessor publishedSnapshotAccessor) { @@ -144,13 +151,13 @@ namespace Umbraco.Web.PublishedCache.NuCache public ContentNodeKit ToKit() { - var draft = Draft is PublishedContentModel draftModel + var draft = DraftModel is PublishedContentModel draftModel ? (PublishedContent) draftModel.Unwrap() - : (PublishedContent) Draft; + : (PublishedContent) DraftModel; - var published = Published is PublishedContentModel publishedModel + var published = PublishedModel is PublishedContentModel publishedModel ? (PublishedContent) publishedModel.Unwrap() - : (PublishedContent) Published; + : (PublishedContent) PublishedModel; return new ContentNodeKit { diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs index 353ac83eda..b14a8041bd 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs @@ -652,7 +652,7 @@ namespace Umbraco.Web.PublishedCache.NuCache return true; var link = GetParentLink(kit.Node); var node = link?.Value; - return node?.Published != null; + return node?.PublishedModel != null; } private void AddToParentLocked(ContentNode content) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/MediaCache.cs b/src/Umbraco.Web/PublishedCache/NuCache/MediaCache.cs index 28c7c38c36..7a22366165 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/MediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/MediaCache.cs @@ -34,14 +34,14 @@ namespace Umbraco.Web.PublishedCache.NuCache { // ignore preview, there's only draft for media var n = _snapshot.Get(contentId); - return n?.Published; + return n?.PublishedModel; } public override IPublishedContent GetById(bool preview, Guid contentId) { // ignore preview, there's only draft for media var n = _snapshot.Get(contentId); - return n?.Published; + return n?.PublishedModel; } public override bool HasById(bool preview, int contentId) @@ -73,7 +73,7 @@ namespace Umbraco.Web.PublishedCache.NuCache var c = _snapshot.GetAtRoot(); // ignore preview, there's only draft for media - return c.Select(n => n.Published); + return c.Select(n => n.PublishedModel); } public override bool HasContent(bool preview) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index ced655ab43..b9d74e7f15 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -300,7 +300,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // invariant content items) // if there is no 'published' published content, no culture can be published - var hasPublished = _contentNode.Published != null; + var hasPublished = _contentNode.PublishedModel != null; if (!hasPublished) return false; @@ -314,7 +314,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // there is a 'published' published content, and varies // = depends on the culture - return ((PublishedContent) _contentNode.Published)._contentData.CultureInfos.ContainsKey(culture); + return _contentNode.PublishedContent._contentData.CultureInfos.ContainsKey(culture); } #endregion From 9eabc1fb3f7ca0d55af2ea636e0f52fd8f3e9b82 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 16:22:40 +0100 Subject: [PATCH 74/76] More NuCache/PublishedContent cleanup --- .../PublishedCache/NuCache/ContentNode.cs | 8 ++-- .../NuCache/PublishedContent.cs | 37 +++++++++---------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs index 4ce6021801..29749ad51b 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs @@ -113,9 +113,9 @@ namespace Umbraco.Web.PublishedCache.NuCache var originDraft = origin.DraftModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.DraftModel); var originPublished = origin.PublishedModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.PublishedModel); - DraftContent = originDraft == null ? null : new PublishedContent(this, originDraft._contentData, publishedSnapshotAccessor, variationContextAccessor); + DraftContent = originDraft == null ? null : new PublishedContent(this, originDraft.ContentData, publishedSnapshotAccessor, variationContextAccessor); DraftModel = DraftContent?.CreateModel(); - PublishedContent = originPublished == null ? null : new PublishedContent(this, originPublished._contentData, publishedSnapshotAccessor, variationContextAccessor); + PublishedContent = originPublished == null ? null : new PublishedContent(this, originPublished.ContentData, publishedSnapshotAccessor, variationContextAccessor); PublishedModel = PublishedContent?.CreateModel(); ChildContentIds = origin.ChildContentIds; // can be the *same* list @@ -164,8 +164,8 @@ namespace Umbraco.Web.PublishedCache.NuCache Node = this, ContentTypeId = ContentType.Id, - DraftData = draft?._contentData, - PublishedData = published?._contentData + DraftData = draft?.ContentData, + PublishedData = published?.ContentData }; } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index b9d74e7f15..522104c2f9 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -14,9 +14,6 @@ namespace Umbraco.Web.PublishedCache.NuCache { private readonly IPublishedSnapshotAccessor _publishedSnapshotAccessor; private readonly ContentNode _contentNode; - // ReSharper disable once InconsistentNaming - internal readonly ContentData _contentData; // internal for ContentNode cloning - private readonly string _urlSegment; #region Constructors @@ -24,12 +21,12 @@ namespace Umbraco.Web.PublishedCache.NuCache public PublishedContent(ContentNode contentNode, ContentData contentData, IPublishedSnapshotAccessor publishedSnapshotAccessor, IVariationContextAccessor variationContextAccessor) { _contentNode = contentNode; - _contentData = contentData; + ContentData = contentData; _publishedSnapshotAccessor = publishedSnapshotAccessor; VariationContextAccessor = variationContextAccessor; - _urlSegment = _contentData.Name.ToUrlSegment(); - IsPreviewing = _contentData.Published == false; + _urlSegment = ContentData.Name.ToUrlSegment(); + IsPreviewing = ContentData.Published == false; var properties = new List(); foreach (var propertyType in _contentNode.ContentType.PropertyTypes) @@ -70,7 +67,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _contentNode = contentNode; _publishedSnapshotAccessor = origin._publishedSnapshotAccessor; VariationContextAccessor = origin.VariationContextAccessor; - _contentData = origin._contentData; + ContentData = origin.ContentData; _urlSegment = origin._urlSegment; IsPreviewing = origin.IsPreviewing; @@ -87,7 +84,7 @@ namespace Umbraco.Web.PublishedCache.NuCache _publishedSnapshotAccessor = origin._publishedSnapshotAccessor; VariationContextAccessor = origin.VariationContextAccessor; _contentNode = origin._contentNode; - _contentData = origin._contentData; + ContentData = origin.ContentData; _urlSegment = origin._urlSegment; IsPreviewing = true; @@ -169,6 +166,8 @@ namespace Umbraco.Web.PublishedCache.NuCache #region PublishedContent + internal ContentData ContentData { get; } + /// public override int Id => _contentNode.Id; @@ -178,11 +177,11 @@ namespace Umbraco.Web.PublishedCache.NuCache get { if (!ContentType.VariesByCulture()) - return _contentData.Name; + return ContentData.Name; var culture = VariationContextAccessor?.VariationContext?.Culture ?? ""; if (culture == "") - return _contentData.Name; + return ContentData.Name; return Cultures.TryGetValue(culture, out var cultureInfos) ? cultureInfos.Name : null; } @@ -214,7 +213,7 @@ namespace Umbraco.Web.PublishedCache.NuCache public override string Path => _contentNode.Path; /// - public override int? TemplateId => _contentData.TemplateId; + public override int? TemplateId => ContentData.TemplateId; /// public override int CreatorId => _contentNode.CreatorId; @@ -226,13 +225,13 @@ namespace Umbraco.Web.PublishedCache.NuCache public override DateTime CreateDate => _contentNode.CreateDate; /// - public override int WriterId => _contentData.WriterId; + public override int WriterId => ContentData.WriterId; /// - public override string WriterName => GetProfileNameById(_contentData.WriterId); + public override string WriterName => GetProfileNameById(ContentData.WriterId); /// - public override DateTime UpdateDate => _contentData.VersionDate; + public override DateTime UpdateDate => ContentData.VersionDate; private IReadOnlyDictionary _cultureInfos; @@ -262,9 +261,9 @@ namespace Umbraco.Web.PublishedCache.NuCache if (_cultureInfos != null) return _cultureInfos; - if (_contentData.CultureInfos == null) + if (ContentData.CultureInfos == null) throw new Exception("oops: _contentDate.CultureInfos is null."); - return _cultureInfos = _contentData.CultureInfos + return _cultureInfos = ContentData.CultureInfos .ToDictionary(x => x.Key, x => new PublishedCultureInfo(x.Key, x.Value.Name, x.Value.Date), StringComparer.OrdinalIgnoreCase); } } @@ -276,7 +275,7 @@ namespace Umbraco.Web.PublishedCache.NuCache public override bool IsDraft(string culture = null) { // if this is the 'published' published content, nothing can be draft - if (_contentData.Published) + if (ContentData.Published) return false; // not the 'published' published content, and does not vary = must be draft @@ -289,7 +288,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // not the 'published' published content, and varies // = depends on the culture - return _contentData.CultureInfos.TryGetValue(culture, out var cvar) && cvar.IsDraft; + return ContentData.CultureInfos.TryGetValue(culture, out var cvar) && cvar.IsDraft; } /// @@ -314,7 +313,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // there is a 'published' published content, and varies // = depends on the culture - return _contentNode.PublishedContent._contentData.CultureInfos.ContainsKey(culture); + return _contentNode.PublishedContent.ContentData.CultureInfos.ContainsKey(culture); } #endregion From 4a5eca3c6a8a779cb0262dc6a05bfb8ea24880fe Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Mon, 28 Jan 2019 15:39:49 +0000 Subject: [PATCH 75/76] Adds in Composition Extension Methods to allow Setting the LogViewer without having to know the composition.RegisterUnique syntax --- .../Components/CompositionExtensions.cs | 32 +++++++++++++++++++ .../Logging/Viewer/LogViewerComposer.cs | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Components/CompositionExtensions.cs b/src/Umbraco.Core/Components/CompositionExtensions.cs index 2aef865994..4e3e4816e5 100644 --- a/src/Umbraco.Core/Components/CompositionExtensions.cs +++ b/src/Umbraco.Core/Components/CompositionExtensions.cs @@ -10,6 +10,7 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Core.Strings; using Umbraco.Core.Sync; using Umbraco.Core._Legacy.PackageActions; +using Umbraco.Core.Logging.Viewer; namespace Umbraco.Core.Components { @@ -297,6 +298,37 @@ namespace Umbraco.Core.Components public static void SetMediaFileSystem(this Composition composition, Func filesystemFactory) => composition.RegisterUniqueFor(_ => filesystemFactory()); + /// + /// Sets the log viewer. + /// + /// The type of the log viewer. + /// The composition. + public static void SetLogViewer(this Composition composition) + where T : ILogViewer + { + composition.RegisterUnique(); + } + + /// + /// Sets the log viewer. + /// + /// The composition. + /// A function creating a log viewer. + public static void SetLogViewer(this Composition composition, Func factory) + { + composition.RegisterUnique(factory); + } + + /// + /// Sets the log viewer. + /// + /// A composition. + /// A log viewer. + public static void SetLogViewer(this Composition composition, ILogViewer viewer) + { + composition.RegisterUnique(_ => viewer); + } + #endregion } } diff --git a/src/Umbraco.Core/Logging/Viewer/LogViewerComposer.cs b/src/Umbraco.Core/Logging/Viewer/LogViewerComposer.cs index f3d1b5137f..5ddcb01078 100644 --- a/src/Umbraco.Core/Logging/Viewer/LogViewerComposer.cs +++ b/src/Umbraco.Core/Logging/Viewer/LogViewerComposer.cs @@ -8,7 +8,7 @@ namespace Umbraco.Core.Logging.Viewer { public void Compose(Composition composition) { - composition.RegisterUnique(_ => new JsonLogViewer()); + composition.SetLogViewer(_ => new JsonLogViewer()); } } } From c2f51be0a1d492bd129f6aaee337afb6cf0db8d1 Mon Sep 17 00:00:00 2001 From: Stephan Date: Mon, 28 Jan 2019 20:07:22 +0100 Subject: [PATCH 76/76] Bugfix --- .../PublishedCache/NuCache/ContentNode.cs | 37 ++++++++++--------- .../NuCache/PublishedContent.cs | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs index 29749ad51b..21af0f87e2 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentNode.cs @@ -67,9 +67,16 @@ namespace Umbraco.Web.PublishedCache.NuCache throw new ArgumentException("Both draftData and publishedData cannot be null at the same time."); if (draftData != null) - DraftModel = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + { + DraftContent = new PublishedContent(this, draftData, publishedSnapshotAccessor, variationContextAccessor); + DraftModel = DraftContent.CreateModel(); + } + if (publishedData != null) - PublishedModel = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor).CreateModel(); + { + PublishedContent = new PublishedContent(this, publishedData, publishedSnapshotAccessor, variationContextAccessor); + PublishedModel = PublishedContent.CreateModel(); + } } // clone parent @@ -88,11 +95,13 @@ namespace Umbraco.Web.PublishedCache.NuCache CreateDate = origin.CreateDate; CreatorId = origin.CreatorId; - var originDraft = origin.DraftModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.DraftModel); - var originPublished = origin.PublishedModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.PublishedModel); + var originDraft = origin.DraftContent; + var originPublished = origin.PublishedContent; - DraftModel = originDraft == null ? null : new PublishedContent(this, originDraft).CreateModel(); - PublishedModel = originPublished == null ? null : new PublishedContent(this, originPublished).CreateModel(); + DraftContent = new PublishedContent(this, originDraft); + PublishedContent = new PublishedContent(this, originPublished); + DraftModel = DraftContent?.CreateModel(); + PublishedModel = PublishedContent?.CreateModel(); ChildContentIds = new List(origin.ChildContentIds); // needs to be *another* list } @@ -110,8 +119,8 @@ namespace Umbraco.Web.PublishedCache.NuCache CreateDate = origin.CreateDate; CreatorId = origin.CreatorId; - var originDraft = origin.DraftModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.DraftModel); - var originPublished = origin.PublishedModel == null ? null : PublishedContent.UnwrapIPublishedContent(origin.PublishedModel); + var originDraft = origin.DraftContent; + var originPublished = origin.PublishedContent; DraftContent = originDraft == null ? null : new PublishedContent(this, originDraft.ContentData, publishedSnapshotAccessor, variationContextAccessor); DraftModel = DraftContent?.CreateModel(); @@ -151,21 +160,13 @@ namespace Umbraco.Web.PublishedCache.NuCache public ContentNodeKit ToKit() { - var draft = DraftModel is PublishedContentModel draftModel - ? (PublishedContent) draftModel.Unwrap() - : (PublishedContent) DraftModel; - - var published = PublishedModel is PublishedContentModel publishedModel - ? (PublishedContent) publishedModel.Unwrap() - : (PublishedContent) PublishedModel; - return new ContentNodeKit { Node = this, ContentTypeId = ContentType.Id, - DraftData = draft?.ContentData, - PublishedData = published?.ContentData + DraftData = DraftContent?.ContentData, + PublishedData = PublishedContent?.ContentData }; } } diff --git a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs index 522104c2f9..e0d9a0c027 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/PublishedContent.cs @@ -299,7 +299,7 @@ namespace Umbraco.Web.PublishedCache.NuCache // invariant content items) // if there is no 'published' published content, no culture can be published - var hasPublished = _contentNode.PublishedModel != null; + var hasPublished = _contentNode.PublishedContent != null; if (!hasPublished) return false;