Quellcode durchsuchen

fix userApps population when user is template owner

tags/v1.5.4
Jonathan Cobb vor 4 Jahren
Ursprung
Commit
a4c1c678a2
2 geänderte Dateien mit 7 neuen und 2 gelöschten Zeilen
  1. +5
    -0
      bubble-server/src/main/java/bubble/model/app/BubbleApp.java
  2. +2
    -2
      bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java

+ 5
- 0
bubble-server/src/main/java/bubble/model/app/BubbleApp.java Datei anzeigen

@@ -118,6 +118,11 @@ public class BubbleApp extends IdentifiableBaseParentEntity implements AccountTe
@ECField(index=70)
@Column(length=UUID_MAXLEN, updatable=false)
@Getter @Setter private String templateApp;
public boolean hasTemplateApp() { return !empty(templateApp); }

public String getTemplateAppOrSelf() {
return hasTemplateApp() ? templateApp : template() ? getUuid() : null;
}

@ECSearchable @ECField(index=80)
@ECIndex @Column(nullable=false)


+ 2
- 2
bubble-server/src/main/java/bubble/service/dbfilter/EntityIterator.java Datei anzeigen

@@ -203,7 +203,7 @@ public abstract class EntityIterator implements Iterator<Identifiable> {
// only copy enabled apps, make them templates
if (log.isDebugEnabled()) log.debug("addEntities: starting with planApps="+json(planApps.stream().map(BubblePlanApp::getApp).collect(Collectors.toList())));
userApps = new ArrayList<>();
entities.stream().filter(app -> planAppEnabled(((BubbleApp) app).getTemplateApp(), planApps))
entities.stream().filter(app -> planAppEnabled(((BubbleApp) app).getTemplateAppOrSelf(), planApps))
.map(app -> ((BubbleApp) app).setTemplate(true))
.forEach(app -> {
userApps.add(app); // save these for later, we will need them when copying BubblePlanApps below
@@ -229,7 +229,7 @@ public abstract class EntityIterator implements Iterator<Identifiable> {
.filter(app -> app.getTemplateApp().equals(systemPlanApp.getApp()))
.findFirst().orElse(null);
if (userApp == null) {
if (log.isInfoEnabled()) log.info("addEntities: system BubblePlanApp " + systemPlanApp.getUuid() + ": no matching BubbleApp not found in userApps (not adding): " + names(userApps));
if (log.isInfoEnabled()) log.info("addEntities: system BubblePlanApp " + systemPlanApp.getUuid() + ": no matching BubbleApp found in userApps (not adding): " + names(userApps));
} else {
// systemPlanApp will now be associated with "root"'s BubblePlan, but user's BubbleApp
if (log.isInfoEnabled()) log.info("addEntities: rewrote app for " + systemPlanApp.getUuid() + " -> " + userApp.getName() + "/" + userApp.getUuid());


Laden…
Abbrechen
Speichern