Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-v7' into dev-v7
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastien-sougnez committed Nov 28, 2018
2 parents 35343f1 + 9ecc0f3 commit 795c310
Show file tree
Hide file tree
Showing 37 changed files with 456 additions and 421 deletions.
14 changes: 10 additions & 4 deletions .github/CONTRIBUTING_DETAILED.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ When contributing code to Umbraco there's plenty of things you'll want to know,
* [What branch should I target for my contributions?](#what-branch-should-i-target-for-my-contributions)
* [Building Umbraco from source code](#building-umbraco-from-source-code)
* [Keeping your Umbraco fork in sync with the main repository](#keeping-your-umbraco-fork-in-sync-with-the-main-repository)

## How Can I Contribute?

### Reporting Bugs
Expand Down Expand Up @@ -52,7 +52,7 @@ Provide more context by answering these questions:

Include details about your configuration and environment:

* **Which version of Umbraco are you using?**
* **Which version of Umbraco are you using?**
* **What is the environment you're using Umbraco in?** Is this a problem on your local machine or on a server. Tell us about your configuration: Windows version, IIS/IISExpress, database type, etc.
* **Which packages do you have installed?**

Expand Down Expand Up @@ -80,7 +80,7 @@ The most successful pull requests usually look a like this:
* Unit tests, while optional are awesome, thank you!
* New code is commented with documentation from which [the reference documentation](https://our.umbraco.com/documentation/Reference/) is generated

Again, these are guidelines, not strict requirements.
Again, these are guidelines, not strict requirements.

## Making changes after the PR was opened

Expand All @@ -90,7 +90,7 @@ If you make the corrections we ask for in the same branch and push them to your

To be honest, we don't like rules very much. We trust you have the best of intentions and we encourage you to create working code. If it doesn't look perfect then we'll happily help clean it up.

That said, the Umbraco development team likes to follow the hints that ReSharper gives us (no problem if you don't have this installed) and we've added a `.editorconfig` file so that Visual Studio knows what to do with whitespace, line endings, etc.
That said, the Umbraco development team likes to follow the hints that ReSharper gives us (no problem if you don't have this installed) and we've added a `.editorconfig` file so that Visual Studio knows what to do with whitespace, line endings, etc.

## What should I know before I get started?

Expand Down Expand Up @@ -125,6 +125,12 @@ We like to use [Gitflow as much as possible](https://jeffkreeftmeijer.com/git-fl

### Building Umbraco from source code

In order to build the Umbraco source code locally, first make sure you have the following installed.

* Visual Studio 2017 v15.3+
* Node v10+ (Installed via `build.bat` script. If you already have it installed, make sure you're running at least v10)
* npm v6.4.1+ (Installed via `build.bat` script. If you already have it installed, make sure you're running at least v6.4.1)

The easiest way to get started is to run `build.bat` which will build both the backoffice (also known as "Belle") and the Umbraco core. You can then easily start debugging from Visual Studio, or if you need to debug Belle you can run `gulp dev` in `src\Umbraco.Web.UI.Client`. See [this page](BUILD.md) for more details.

Alternatively, you can open `src\umbraco.sln` in Visual Studio 2017 (version 15.3 or higher, [the community edition is free](https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=Community&rel=15) for you to use to contribute to Open Source projects). In Visual Studio, find the Task Runner Explorer (in the View menu under Other Windows) and run the build task under the gulpfile.
Expand Down
10 changes: 7 additions & 3 deletions src/Umbraco.Core/Models/UserExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Globalization;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
Expand Down Expand Up @@ -35,9 +36,12 @@ public static bool HasSectionAccess(this IUser user, string app)
/// A list of 5 different sized avatar URLs
/// </returns>
internal static string[] GetUserAvatarUrls(this IUser user, ICacheProvider staticCache)
{
//check if the user has explicitly removed all avatars including a gravatar, this will be possible and the value will be "none"
if (user.Avatar == "none")
{
// If FIPS is required, never check the Gravatar service as it only supports MD5 hashing.
// Unfortunately, if the FIPS setting is enabled on Windows, using MD5 will throw an exception
// and the website will not run.
// Also, check if the user has explicitly removed all avatars including a gravatar, this will be possible and the value will be "none"
if (user.Avatar == "none" || CryptoConfig.AllowOnlyFipsAlgorithms)
{
return new string[0];
}
Expand Down
14 changes: 7 additions & 7 deletions src/Umbraco.Core/Persistence/Repositories/AuditRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public IEnumerable<IAuditItem> GetPagedResultsByQuery(IQuery<IAuditItem> query,
var sql = GetBaseQuery(false);

if (query == null) query = new Query<IAuditItem>();

var queryHasWhereClause = query.GetWhereClauses().Any();
var translatorIds = new SqlTranslator<IAuditItem>(sql, query);
var translatedQuery = translatorIds.Translate();
Expand All @@ -59,7 +59,7 @@ public IEnumerable<IAuditItem> GetPagedResultsByQuery(IQuery<IAuditItem> query,
{
var filterSql = new Sql();
foreach (var filterClause in customFilterWheres)
{
{
filterSql.Append($"AND ({filterClause.Item1})", filterClause.Item2);
}

Expand All @@ -70,7 +70,7 @@ public IEnumerable<IAuditItem> GetPagedResultsByQuery(IQuery<IAuditItem> query,
{
var filterSql = new Sql();
foreach (var filterClause in auditTypeFilter)
{
{
filterSql.Append("AND (logHeader = @logHeader)", new { logHeader = filterClause.ToString() });
}

Expand All @@ -80,14 +80,14 @@ public IEnumerable<IAuditItem> GetPagedResultsByQuery(IQuery<IAuditItem> query,
if (orderDirection == Direction.Descending)
translatedQuery.OrderByDescending("Datestamp");
else
translatedQuery.OrderBy("Datestamp");
translatedQuery.OrderBy("Datestamp");

// Get page of results and total count
var pagedResult = Database.Page<LogDto>(pageIndex + 1, pageSize, translatedQuery);
totalRecords = pagedResult.TotalItems;

var pages = pagedResult.Items.Select(
dto => new AuditItem(dto.Id, dto.Comment, Enum<AuditType>.ParseOrNull(dto.Header) ?? AuditType.Custom, dto.UserId)).ToArray();
dto => new AuditItem(dto.NodeId, dto.Comment, Enum<AuditType>.ParseOrNull(dto.Header) ?? AuditType.Custom, dto.UserId)).ToArray();

//Mapping the DateStamp
for (var i = 0; i < pages.Length; i++)
Expand Down Expand Up @@ -142,7 +142,7 @@ protected override IEnumerable<IAuditItem> PerformGetAll(params int[] ids)
protected override IEnumerable<IAuditItem> PerformGetByQuery(IQuery<IAuditItem> query)
{
throw new NotImplementedException();
}
}

protected override string GetBaseWhereClause()
{
Expand All @@ -167,7 +167,7 @@ private Sql GetFilteredSqlForPagedResults(Sql sql, Sql filterSql, bool hasWhereC
// Apply filter
if (filterSql != null)
{
//ensure we don't append a WHERE if there is already one
//ensure we don't append a WHERE if there is already one
var sqlFilter = hasWhereClause
? filterSql.SQL
: " WHERE " + filterSql.SQL.TrimStart("AND ");
Expand Down
14 changes: 11 additions & 3 deletions src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,20 @@ public IEnumerable<TEntity> GetAll(params TId[] ids)
//.Where(x => Equals(x, default(TId)) == false)
.ToArray();

if (ids.Length > 2000)
// can't query more than 2000 ids at a time... but if someone is really querying 2000+ entities,
// the additional overhead of fetching them in groups is minimal compared to the lookup time of each group
const int maxParams = 2000;
if (ids.Length <= maxParams)
{
throw new InvalidOperationException("Cannot perform a query with more than 2000 parameters");
return CachePolicy.GetAll(ids, PerformGetAll);
}
var entities = new List<TEntity>();
foreach (var groupOfIds in ids.InGroupsOf(maxParams))
{
entities.AddRange(CachePolicy.GetAll(groupOfIds.ToArray(), PerformGetAll));
}
return entities;

return CachePolicy.GetAll(ids, PerformGetAll);
}

protected abstract IEnumerable<TEntity> PerformGetByQuery(IQuery<TEntity> query);
Expand Down
12 changes: 11 additions & 1 deletion src/Umbraco.Core/Services/ContentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2575,8 +2575,18 @@ private Attempt<PublishStatus> SaveAndPublishDo(IContent content, int userId = 0
_publishingStrategy.PublishingFinalized(uow, descendants, false);
}

Audit(uow, AuditType.Publish, "Save and Publish performed by user", userId, content.Id);
uow.Commit();

if (publishStatus.StatusType == PublishStatusType.Success)
{
Audit(uow, AuditType.Publish, "Save and Publish performed by user", userId, content.Id);
}
else
{
Audit(uow, AuditType.Save, "Save performed by user", userId, content.Id);
}
uow.Commit();

return Attempt.If(publishStatus.StatusType == PublishStatusType.Success, publishStatus);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Tests/Migrations/Upgrades/SqlCeUpgradeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void DatabaseSpecificSetUp()
catch (Exception)
{
//if this doesn't work we have to make sure everything is reset! otherwise
// well run into issues because we've already set some things up
// we'll run into issues because we've already set some things up
TearDown();
throw;
}
Expand Down Expand Up @@ -83,4 +83,4 @@ public override string GetDatabaseSpecificSqlScript()
return SqlScripts.SqlResources.SqlCeTotal_480;
}
}
}
}
6 changes: 3 additions & 3 deletions src/Umbraco.Tests/TestHelpers/BaseDatabaseFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ protected virtual void CreateSqlCeDatabase()
{
RemoveDatabaseFile(ex =>
{
//if this doesn't work we have to make sure everything is reset! otherwise
// well run into issues because we've already set some things up
//If this doesn't work we have to make sure everything is reset! otherwise
// we'll run into issues because we've already set some things up
TearDown();
throw ex;
});
Expand Down Expand Up @@ -435,4 +435,4 @@ protected virtual string GetXmlContent(int templateId)
</root>";
}
}
}
}
1 change: 0 additions & 1 deletion src/Umbraco.Web.UI.Client/src/less/belle.less
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
@import "components/umb-confirm-action.less";
@import "components/umb-keyboard-shortcuts-overview.less";
@import "components/umb-checkbox-list.less";
@import "components/umb-radiobuttons-list.less";
@import "components/umb-locked-field.less";
@import "components/umb-tabs.less";
@import "components/umb-load-indicator.less";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
box-sizing: border-box;
background: @gray-10;
border-bottom: 1px solid @purple-l3;
pointer-events: none;
}

.umb-overlay__item-details-title-wrapper {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
$scope.section = dialogOptions.section;
$scope.treeAlias = dialogOptions.treeAlias;
$scope.multiPicker = dialogOptions.multiPicker;
$scope.hideHeader = true;
$scope.hideHeader = (typeof dialogOptions.hideHeader) === "boolean" ? dialogOptions.hideHeader : true;;
$scope.searchInfo = {
searchFromId: dialogOptions.startNodeId,
searchFromName: null,
Expand Down Expand Up @@ -428,4 +428,4 @@ angular.module("umbraco").controller("Umbraco.Dialogs.TreePickerController",
$scope.dialogTreeEventHandler.unbind("treeNodeExpanded", nodeExpandedHandler);
$scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
<umb-editor model="preValue" is-pre-value="true"></umb-editor>
</umb-property>

<button type="button" class="btn" ng-click="toggleEditListViewDataTypeSettings()"><localize key="general_close">Close</localize></button>
<button type="button" class="btn btn-success" ng-click="saveListViewDataType()"><localize key="buttons_saveListView"></localize></button>
<div class="text-right">
<button type="button" class="btn btn-link" ng-click="toggleEditListViewDataTypeSettings()"><localize key="general_close">Close</localize></button>
<button type="button" class="btn btn-success" ng-click="saveListViewDataType()"><localize key="buttons_saveListView"></localize></button>
</div>

</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<select ng-model="model.value">
<select ng-model="model.value" required>
<option value="STRING">String</option>
<option value="DECIMAL">Decimal</option>
<option value="DATETIME">Date/time</option>
<option value="INT">Integer</option>
<option value="TEXT">Long string</option>
</select>
</select>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<label class="checkbox">
<input type="checkbox" name="checkboxlist"
value="{{item.key}}"
ng-model="item.checked" />
ng-model="item.checked"
ng-required="model.validation.mandatory && !model.value.length" />
{{item.val}}
</label>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,16 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.DropdownFlexibleCo
// if we run in single mode we'll store the value in a local variable
// so we can pass an array as the model as our PropertyValueEditor expects that
$scope.model.singleDropdownValue = "";
if ($scope.model.config.multiple === "0") {
if ($scope.model.config.multiple === "0" && $scope.model.value) {
$scope.model.singleDropdownValue = Array.isArray($scope.model.value) ? $scope.model.value[0] : $scope.model.value;
}

// if we run in multiple mode, make sure the model is an array (in case the property was previously saved in single mode)
// also explicitly set the model to null if it's an empty array, so mandatory validation works on the client
if ($scope.model.config.multiple === "1" && $scope.model.value) {
$scope.model.value = !Array.isArray($scope.model.value) ? [$scope.model.value] : $scope.model.value;
if ($scope.model.value.length === 0) {
$scope.model.value = null;
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
ng-switch-default
ng-change="updateSingleDropdownValue()"
ng-model="model.singleDropdownValue"
ng-options="item.id as item.value for item in model.config.items">
ng-options="item.id as item.value for item in model.config.items"
ng-required="model.validation.mandatory">
<option></option>
</select>

Expand All @@ -15,5 +16,6 @@
ng-switch-when="1"
multiple
ng-model="model.value"
ng-options="item.id as item.value for item in model.config.items"></select>
ng-options="item.id as item.value for item in model.config.items"
ng-required="model.validation.mandatory"></select>
</div>
Loading

0 comments on commit 795c310

Please sign in to comment.