Fix indexable setting

This commit is contained in:
Grishka 2023-09-22 21:33:21 +03:00
parent f24eba08d3
commit fe1cfa1d7b
4 changed files with 10 additions and 8 deletions

View File

@ -195,7 +195,7 @@ public class AccountSession{
public void savePreferencesIfPending(){
if(preferencesNeedSaving){
new UpdateAccountCredentialsPreferences(preferences, null, self.discoverable, !self.noindex)
new UpdateAccountCredentialsPreferences(preferences, null, self.discoverable, self.source.indexable)
.setCallback(new Callback<>(){
@Override
public void onSuccess(Account result){

View File

@ -19,8 +19,10 @@ public class SettingsPrivacyFragment extends BaseSettingsFragment<Void>{
Account self=AccountSessionManager.get(accountID).self;
onDataLoaded(List.of(
discoverableItem=new CheckableListItem<>(R.string.settings_discoverable, 0, CheckableListItem.Style.SWITCH, self.discoverable, R.drawable.ic_thumbs_up_down_24px, ()->toggleCheckableItem(discoverableItem)),
indexableItem=new CheckableListItem<>(R.string.settings_indexable, 0, CheckableListItem.Style.SWITCH, self.indexable, R.drawable.ic_search_24px, ()->toggleCheckableItem(indexableItem))
indexableItem=new CheckableListItem<>(R.string.settings_indexable, 0, CheckableListItem.Style.SWITCH, self.source.indexable!=null ? self.source.indexable : true, R.drawable.ic_search_24px, ()->toggleCheckableItem(indexableItem))
));
if(self.source.indexable==null)
indexableItem.isEnabled=false;
}
@Override
@ -30,9 +32,9 @@ public class SettingsPrivacyFragment extends BaseSettingsFragment<Void>{
public void onPause(){
super.onPause();
Account self=AccountSessionManager.get(accountID).self;
if(self.discoverable!=discoverableItem.checked || self.indexable!=indexableItem.checked){
if(self.discoverable!=discoverableItem.checked || (self.source.indexable!=null && self.source.indexable!=indexableItem.checked)){
self.discoverable=discoverableItem.checked;
self.indexable=indexableItem.checked;
self.source.indexable=indexableItem.checked;
AccountSessionManager.get(accountID).savePreferencesLater();
}
}

View File

@ -133,8 +133,6 @@ public class Account extends BaseModel{
*/
public Instant muteExpiresAt;
public boolean noindex;
public boolean indexable;
public boolean hideCollections;
@Override
@ -195,8 +193,6 @@ public class Account extends BaseModel{
", suspended="+suspended+
", muteExpiresAt="+muteExpiresAt+
", noindex="+noindex+
", indexable="+indexable+
", hideCollections="+hideCollections+
'}';
}
}

View File

@ -37,6 +37,8 @@ public class Source extends BaseModel{
* The number of pending follow requests.
*/
public int followRequestCount;
public Boolean indexable;
public boolean hideCollections;
@Override
public void postprocess() throws ObjectValidationException{
@ -54,6 +56,8 @@ public class Source extends BaseModel{
", sensitive="+sensitive+
", language='"+language+'\''+
", followRequestCount="+followRequestCount+
", indexable="+indexable+
", hideCollections="+hideCollections+
'}';
}
}