Add option for default reply privacy set to unlisted by default (#4496)

This PR fixes https://github.com/tuskyapp/Tusky/issues/2798 and is
mostly based on and supersedes
https://github.com/tuskyapp/Tusky/pull/2826 but I have fixed all merge
conflicts and unit tests.

I tested the changes locally and the setting takes effect immediately
for replies, and persists across killing the app.

---------

Co-authored-by: Eva Tatarka <eva@tatarka.me>
Co-authored-by: Konrad Pozniak <connyduck@users.noreply.github.com>
This commit is contained in:
Eliot Lash 2024-06-09 11:25:03 -07:00 committed by GitHub
commit 9883bfa7c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 118 additions and 10 deletions

View file

@ -62,7 +62,7 @@ import java.io.File;
},
// Note: Starting with version 54, database versions in Tusky are always even.
// This is to reserve odd version numbers for use by forks.
version = 60,
version = 62,
autoMigrations = {
@AutoMigration(from = 48, to = 49),
@AutoMigration(from = 49, to = 50, spec = AppDatabase.MIGRATION_49_50.class),
@ -841,4 +841,11 @@ public abstract class AppDatabase extends RoomDatabase {
);
}
};
public static final Migration MIGRATION_60_62 = new Migration(60, 62) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
database.execSQL("ALTER TABLE `AccountEntity` ADD COLUMN `defaultReplyPrivacy` INTEGER NOT NULL DEFAULT 2");
}
};
}

View file

@ -63,6 +63,7 @@ data class AccountEntity(
var notificationVibration: Boolean = true,
var notificationLight: Boolean = true,
var defaultPostPrivacy: Status.Visibility = Status.Visibility.PUBLIC,
var defaultReplyPrivacy: Status.Visibility = Status.Visibility.UNLISTED,
var defaultMediaSensitivity: Boolean = false,
var defaultPostLanguage: String = "",
var alwaysShowSensitiveMedia: Boolean = false,