@@ -343,7 +343,7 @@ export interface ISbDmVisual extends ISbDmCommon {
343343 getChildren ?( ) : ScoreBookDataModelEntry [ ] ;
344344
345345 /** Permission info for the current user (undefined until the backend provides it). */
346- readonly perm ?: ISbDmPermissionInfo ;
346+ perm ?: ISbDmPermissionInfo ;
347347}
348348
349349/** Permission summary for the current user on a score or folder. */
@@ -624,21 +624,6 @@ interface IWhoamiResponse {
624624 capabilities : ICapabilities ;
625625}
626626
627- /**
628- * Copies permission fields from a source into a target perm object in-place.
629- *
630- * @param target The existing perm to update.
631- * @param source The new perm values to copy.
632- */
633- const applyPerm = ( target : ISbDmPermissionInfo , source : ISbDmPermissionInfo ) : void => {
634- const t = target as Mutable < ISbDmPermissionInfo > ;
635- t . isOwner = source . isOwner ;
636- t . canRead = source . canRead ;
637- t . canWrite = source . canWrite ;
638- t . isWorld = source . isWorld ;
639- t . groupIds = source . groupIds ;
640- } ;
641-
642627export class ScoreBookDataModel {
643628 /**
644629 * Indicates whether the current session is allowed to mutate scores on the backend.
@@ -1726,10 +1711,10 @@ export class ScoreBookDataModel {
17261711 const newList : Array < ISbDmScoreFolder | ISbDmScore > = [ ] ;
17271712
17281713 data . folders . forEach ( ( folder ) => {
1729- const existing = existingById . get ( folder . id ) as ISbDmScoreFolder | undefined ;
1714+ const existing = existingById . get ( folder . id ) ;
17301715 if ( existing ) {
17311716 existing . name = folder . name ;
1732- applyPerm ( existing . perm ! , folder . perm ) ;
1717+ existing . perm = folder . perm ;
17331718 newList . push ( existing ) ;
17341719
17351720 return ;
@@ -1768,7 +1753,7 @@ export class ScoreBookDataModel {
17681753 if ( existing ) {
17691754 existing . name = score . name ;
17701755 existing . content = score . content ;
1771- applyPerm ( existing . perm ! , score . perm ) ;
1756+ existing . perm = score . perm ;
17721757 newList . push ( existing ) ;
17731758
17741759 return ;
0 commit comments