Skip to content

Commit 0ba51f8

Browse files
Move member properties to Member Content App (V9 merge regression) (#11768)
* Fix regression after merging to v9 * Update test to align with removed member properties
1 parent a69499a commit 0ba51f8

File tree

2 files changed

+9
-39
lines changed

2 files changed

+9
-39
lines changed

src/Umbraco.Core/Models/Mapping/MemberTabsAndPropertiesMapper.cs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,11 @@ public override IEnumerable<Tab<ContentPropertyDisplay>> Map(IMember source, Map
6565

6666
var resolved = base.Map(source, context);
6767

68-
// This is kind of a hack because a developer is supposed to be allowed to set their property editor - would have been much easier
69-
// if we just had all of the membership provider fields on the member table :(
70-
// TODO: But is there a way to map the IMember.IsLockedOut to the property ? i dunno.
68+
// IMember.IsLockedOut can't be set to true, so make it readonly when that's the case (you can only unlock)
7169
var isLockedOutProperty = resolved.SelectMany(x => x.Properties).FirstOrDefault(x => x.Alias == Constants.Conventions.Member.IsLockedOut);
7270
if (isLockedOutProperty?.Value != null && isLockedOutProperty.Value.ToString() != "1")
7371
{
74-
isLockedOutProperty.View = "readonlyvalue";
75-
isLockedOutProperty.Value = _localizedTextService.Localize("general", "no");
72+
isLockedOutProperty.Readonly = true;
7673
}
7774

7875
return resolved;
@@ -191,28 +188,14 @@ public IEnumerable<ContentPropertyDisplay> MapMembershipProperties(IMember membe
191188
{
192189
var properties = new List<ContentPropertyDisplay>
193190
{
194-
new ContentPropertyDisplay
195-
{
196-
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}id",
197-
Label = _localizedTextService.Localize("general","id"),
198-
Value = new List<string> {member.Id.ToString(), member.Key.ToString()},
199-
View = "idwithguid"
200-
},
201-
new ContentPropertyDisplay
202-
{
203-
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}doctype",
204-
Label = _localizedTextService.Localize("content","membertype"),
205-
Value = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, member.ContentType.Name),
206-
View = _propertyEditorCollection[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
207-
},
208191
GetLoginProperty(member, _localizedTextService),
209192
new ContentPropertyDisplay
210193
{
211194
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}email",
212195
Label = _localizedTextService.Localize("general","email"),
213196
Value = member.Email,
214197
View = "email",
215-
Validation = {Mandatory = true}
198+
Validation = { Mandatory = true }
216199
},
217200
new ContentPropertyDisplay
218201
{
@@ -221,20 +204,21 @@ public IEnumerable<ContentPropertyDisplay> MapMembershipProperties(IMember membe
221204
Value = new Dictionary<string, object>
222205
{
223206
// TODO: why ignoreCase, what are we doing here?!
224-
{"newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null)},
207+
{ "newPassword", member.GetAdditionalDataValueIgnoreCase("NewPassword", null) }
225208
},
226-
// TODO: Hard coding this because the changepassword doesn't necessarily need to be a resolvable (real) property editor
227209
View = "changepassword",
228-
// Initialize the dictionary with the configuration from the default membership provider
229-
Config = GetPasswordConfig(member)
210+
Config = GetPasswordConfig(member) // Initialize the dictionary with the configuration from the default membership provider
230211
},
231212
new ContentPropertyDisplay
232213
{
233214
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}membergroup",
234215
Label = _localizedTextService.Localize("content","membergroup"),
235216
Value = GetMemberGroupValue(member.Username),
236217
View = "membergroups",
237-
Config = new Dictionary<string, object> {{"IsRequired", true}}
218+
Config = new Dictionary<string, object>
219+
{
220+
{ "IsRequired", true }
221+
}
238222
}
239223
};
240224

tests/Umbraco.Tests.UnitTests/Umbraco.Web.BackOffice/Controllers/MemberControllerUnitTests.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -618,20 +618,6 @@ private Member SetupMemberTestData(
618618
Id = 77,
619619
Properties = new List<ContentPropertyDisplay>()
620620
{
621-
new ContentPropertyDisplay()
622-
{
623-
Alias = "_umb_id",
624-
View = "idwithguid",
625-
Value = new []
626-
{
627-
"123",
628-
"guid"
629-
}
630-
},
631-
new ContentPropertyDisplay()
632-
{
633-
Alias = "_umb_doctype"
634-
},
635621
new ContentPropertyDisplay()
636622
{
637623
Alias = "_umb_login"

0 commit comments

Comments
 (0)