Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SiteModel: Add column isSingleUserSite #2873

Merged
merged 8 commits into from
Oct 18, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class SiteRestClientTest {
mapOf(
"fields" to "ID,URL,name,description,jetpack,jetpack_connection," +
"visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," +
"organization_id,was_ecommerce_trial"
"organization_id,was_ecommerce_trial,single_user_site"
)
)
}
Expand Down Expand Up @@ -145,7 +145,7 @@ class SiteRestClientTest {
"filters" to "wpcom",
"fields" to "ID,URL,name,description,jetpack,jetpack_connection," +
"visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," +
"organization_id,was_ecommerce_trial"
"organization_id,was_ecommerce_trial,single_user_site"
)
)
}
Expand Down Expand Up @@ -174,7 +174,7 @@ class SiteRestClientTest {
mapOf(
"fields" to "ID,URL,name,description,jetpack,jetpack_connection," +
"visible,is_private,options,plan,capabilities,quota,icon,meta,zendesk_site_meta," +
"organization_id,was_ecommerce_trial"
"organization_id,was_ecommerce_trial,single_user_site"
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ public class SiteModel extends Payload<BaseNetworkError> implements Identifiable
private String mPlanActiveFeatures;
@Column
private Boolean mWasEcommerceTrial;
@Column
private Boolean mIsSingleUserSite;

@Override
public int getId() {
Expand Down Expand Up @@ -1111,4 +1113,12 @@ public String getPlanActiveFeatures() {
public void setPlanActiveFeatures(final String planActiveFeatures) {
this.mPlanActiveFeatures = planActiveFeatures;
}

public Boolean isSingleUserSite() {
return mIsSingleUserSite;
}

public void setIsSingleUserSite(Boolean isSingleUserSite) {
mIsSingleUserSite = isSingleUserSite;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,7 @@ class SiteRestClient @Inject constructor(
site.origin = SiteModel.ORIGIN_WPCOM_REST
site.planActiveFeatures = (from.plan?.features?.active?.joinToString(",")).orEmpty()
site.wasEcommerceTrial = from.was_ecommerce_trial
site.setIsSingleUserSite(from.single_user_site)
return site
}

Expand Down Expand Up @@ -1265,7 +1266,7 @@ class SiteRestClient @Inject constructor(
private const val NEW_SITE_TIMEOUT_MS = 90000
private const val SITE_FIELDS = "ID,URL,name,description,jetpack,jetpack_connection,visible,is_private," +
"options,plan,capabilities,quota,icon,meta,zendesk_site_meta,organization_id," +
"was_ecommerce_trial"
"was_ecommerce_trial,single_user_site"
private const val FIELDS = "fields"
private const val FILTERS = "filters"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,5 @@ public class BloggingPromptsSettings {
public Quota quota;
public ZendeskSiteMeta zendesk_site_meta;
public boolean was_ecommerce_trial;
public boolean single_user_site;
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ open class WellSqlConfig : DefaultWellConfig {
annotation class AddOn

override fun getDbVersion(): Int {
return 196
return 197
}

override fun getDbName(): String {
Expand Down Expand Up @@ -1990,6 +1990,9 @@ open class WellSqlConfig : DefaultWellConfig {
"_id INTEGER PRIMARY KEY AUTOINCREMENT)"
)
}
196 -> migrate(version) {
db.execSQL("ALTER TABLE SiteModel ADD IS_SINGLE_USER_SITE BOOLEAN")
}
}
}
db.setTransactionSuccessful()
Expand Down
Loading