mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-22 12:24:02 +03:00
converted data.settings to just the individual settings
This commit is contained in:
parent
59ab96dc6f
commit
27f32cbcd9
@ -41,7 +41,7 @@ export default class SidebarFileStorageDeal extends React.Component {
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
if (!this.props.viewer.settings?.settings_deals_auto_approve) {
|
||||
if (!this.props.viewer.settingsDealsAutoApprove) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -209,14 +209,11 @@ export const getById = async ({ id }) => {
|
||||
email: user.email || null,
|
||||
data: user.data,
|
||||
library: user.library,
|
||||
settingsDealsAutoApprove: user.settingsDealsAutoApprove,
|
||||
allowAutomaticDataStorage: user.allowAutomaticDataStorage,
|
||||
allowEncryptedDataStorage: user.allowEncryptedDataStorage,
|
||||
// onboarding: user.data.onboarding || {},
|
||||
// status: user.data.status || {},
|
||||
// settings: {
|
||||
// allow_automatic_data_storage: user.data.allow_automatic_data_storage || null,
|
||||
// allow_encrypted_data_storage: user.data.allow_encrypted_data_storage || null,
|
||||
// allow_filecoin_directory_listing: user.data.allow_filecoin_directory_listing || null,
|
||||
// settings_deals_auto_approve: user.data.settings_deals_auto_approve || null,
|
||||
// },
|
||||
stats: {
|
||||
bytes,
|
||||
maximumBytes: Constants.TEXTILE_ACCOUNT_BYTE_LIMIT,
|
||||
|
@ -108,7 +108,7 @@ export default async (req, res) => {
|
||||
|
||||
// NOTE(jim): Either encrypt the bucket or don't encrypt the bucket.
|
||||
let encryptThisDeal = false;
|
||||
if (bucketName !== STAGING_DEAL_BUCKET && user.data.settings?.allow_encrypted_data_storage) {
|
||||
if (bucketName !== STAGING_DEAL_BUCKET && user.allowEncryptedDataStorage) {
|
||||
encryptThisDeal = true;
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ export default async (req, res) => {
|
||||
|
||||
let key = bucketRoot.key;
|
||||
let encryptedBucketName = null;
|
||||
if (user.data.settings?.allow_encrypted_data_storage || req.body.data.forceEncryption) {
|
||||
if (user.allowEncryptedDataStorage || req.body.data.forceEncryption) {
|
||||
encryptedBucketName = req.body.data.forceEncryption
|
||||
? `encrypted-deal-${uuid()}`
|
||||
: `encrypted-data-${uuid()}`;
|
||||
|
@ -109,12 +109,6 @@ export default async (req, res) => {
|
||||
twitterId: twitterUser.id_str,
|
||||
textileToken,
|
||||
data: {
|
||||
settings: {
|
||||
settings_deals_auto_approve: false,
|
||||
allow_filecoin_directory_listing: false,
|
||||
allow_automatic_data_storage: true,
|
||||
allow_encrypted_data_storage: true,
|
||||
},
|
||||
twitter: {
|
||||
username: twitterUser.screen_name,
|
||||
verified: twitterUser.verified,
|
||||
|
@ -91,13 +91,6 @@ export default async (req, res) => {
|
||||
twitterId: twitterUser.id_str,
|
||||
textileToken,
|
||||
data: {
|
||||
body: "",
|
||||
settings: {
|
||||
settings_deals_auto_approve: false,
|
||||
allow_filecoin_directory_listing: false,
|
||||
allow_automatic_data_storage: true,
|
||||
allow_encrypted_data_storage: true,
|
||||
},
|
||||
twitter: {
|
||||
username: twitterUser.screen_name,
|
||||
verified: twitterUser.verified,
|
||||
|
@ -83,15 +83,6 @@ export default async (req, res) => {
|
||||
username: newUsername,
|
||||
email: newEmail,
|
||||
textileToken,
|
||||
data: {
|
||||
body: "",
|
||||
settings: {
|
||||
settings_deals_auto_approve: false,
|
||||
allow_filecoin_directory_listing: false,
|
||||
allow_automatic_data_storage: true,
|
||||
allow_encrypted_data_storage: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!user) {
|
||||
|
@ -30,10 +30,8 @@ export default class SceneArchive extends React.Component {
|
||||
deals: [],
|
||||
dealsLoaded: false,
|
||||
networkViewer: null,
|
||||
allow_filecoin_directory_listing: this.props.viewer.data.settings
|
||||
?.allow_filecoin_directory_listing,
|
||||
allow_automatic_data_storage: this.props.viewer.data.settings?.allow_automatic_data_storage,
|
||||
allow_encrypted_data_storage: this.props.viewer.data.settings?.allow_encrypted_data_storage,
|
||||
allowAutomaticDataStorage: this.props.viewer.allowAutomaticDataStorage,
|
||||
allowEncryptedDataStorage: this.props.viewer.allowEncryptedDataStorage,
|
||||
};
|
||||
|
||||
async componentDidMount() {
|
||||
@ -75,13 +73,8 @@ export default class SceneArchive extends React.Component {
|
||||
this.setState({ changingFilecoin: true });
|
||||
|
||||
await Actions.updateViewer({
|
||||
data: {
|
||||
settings: {
|
||||
allow_filecoin_directory_listing: this.state.allow_filecoin_directory_listing,
|
||||
allow_automatic_data_storage: this.state.allow_automatic_data_storage,
|
||||
allow_encrypted_data_storage: this.state.allow_encrypted_data_storage,
|
||||
},
|
||||
},
|
||||
allowAutomaticDataStorage: this.state.allowAutomaticDataStorage,
|
||||
allowEncryptedDataStorage: this.state.allowEncryptedDataStorage,
|
||||
});
|
||||
|
||||
this.setState({ changingFilecoin: false });
|
||||
@ -146,17 +139,8 @@ export default class SceneArchive extends React.Component {
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 24 }}
|
||||
name="allow_filecoin_directory_listing"
|
||||
value={this.state.allow_filecoin_directory_listing}
|
||||
onChange={this._handleCheckboxChange}
|
||||
>
|
||||
Show your successful deals on a directory page where others can retrieve them.
|
||||
</System.CheckBox>
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 24 }}
|
||||
name="allow_automatic_data_storage"
|
||||
value={this.state.allow_automatic_data_storage}
|
||||
name="allowAutomaticDataStorage"
|
||||
value={this.state.allowAutomaticDataStorage}
|
||||
onChange={this._handleCheckboxChange}
|
||||
>
|
||||
Allow Slate to make archive storage deals on your behalf to the Filecoin
|
||||
@ -165,8 +149,8 @@ export default class SceneArchive extends React.Component {
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 24 }}
|
||||
name="allow_encrypted_data_storage"
|
||||
value={this.state.allow_encrypted_data_storage}
|
||||
name="allowEncryptedDataStorage"
|
||||
value={this.state.allowEncryptedDataStorage}
|
||||
onChange={this._handleCheckboxChange}
|
||||
>
|
||||
Force encryption on archive storage deals (only you can see retrieved data from
|
||||
|
@ -50,10 +50,8 @@ export default class SceneEditAccount extends React.Component {
|
||||
photo: this.props.viewer.photo,
|
||||
name: this.props.viewer.name,
|
||||
deleting: false,
|
||||
allow_filecoin_directory_listing: this.props.viewer.data.settings
|
||||
?.allow_filecoin_directory_listing,
|
||||
allow_automatic_data_storage: this.props.viewer.data.settings?.allow_automatic_data_storage,
|
||||
allow_encrypted_data_storage: this.props.viewer.data.settings?.allow_encrypted_data_storage,
|
||||
allowAutomaticDataStorage: this.props.viewer.allowAutomaticDataStorage,
|
||||
allowEncryptedDataStorage: this.props.viewer.allowEncryptedDataStorage,
|
||||
changingPassword: false,
|
||||
changingAvatar: false,
|
||||
savingNameBio: false,
|
||||
@ -86,13 +84,8 @@ export default class SceneEditAccount extends React.Component {
|
||||
this.setState({ changingFilecoin: true });
|
||||
|
||||
let response = await Actions.updateViewer({
|
||||
data: {
|
||||
settings: {
|
||||
allow_filecoin_directory_listing: this.state.allow_filecoin_directory_listing,
|
||||
allow_automatic_data_storage: this.state.allow_automatic_data_storage,
|
||||
allow_encrypted_data_storage: this.state.allow_encrypted_data_storage,
|
||||
},
|
||||
},
|
||||
allowAutomaticDataStorage: this.state.allowAutomaticDataStorage,
|
||||
allowEncryptedDataStorage: this.state.allowEncryptedDataStorage,
|
||||
});
|
||||
|
||||
Events.hasError(response);
|
||||
@ -255,19 +248,10 @@ export default class SceneEditAccount extends React.Component {
|
||||
them from the Filecoin Network.
|
||||
</div>
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 48 }}
|
||||
name="allow_filecoin_directory_listing"
|
||||
value={this.state.allow_filecoin_directory_listing}
|
||||
onChange={this._handleChange}
|
||||
>
|
||||
Show your successful deals on a directory page where others can retrieve them.
|
||||
</System.CheckBox>
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 24 }}
|
||||
name="allow_automatic_data_storage"
|
||||
value={this.state.allow_automatic_data_storage}
|
||||
name="allowAutomaticDataStorage"
|
||||
value={this.state.allowAutomaticDataStorage}
|
||||
onChange={this._handleChange}
|
||||
>
|
||||
Allow Slate to make archive storage deals on your behalf to the Filecoin Network.
|
||||
@ -276,8 +260,8 @@ export default class SceneEditAccount extends React.Component {
|
||||
|
||||
<System.CheckBox
|
||||
style={{ marginTop: 24 }}
|
||||
name="allow_encrypted_data_storage"
|
||||
value={this.state.allow_encrypted_data_storage}
|
||||
name="allowEncryptedDataStorage"
|
||||
value={this.state.allowEncryptedDataStorage}
|
||||
onChange={this._handleChange}
|
||||
>
|
||||
Force encryption on archive storage deals (only you can see retrieved data from the
|
||||
|
@ -271,9 +271,9 @@ Users
|
||||
'data.photo', -> 'photo' MIGRATED
|
||||
'data.status', -> 'hidePrivacyAlert' MIGRATED
|
||||
'data.tokens.api', -> 'textileToken' MIGRATED
|
||||
'data.settings.settings_deals_auto_approve', -> 'settingsDealsAutoApprove'
|
||||
'data.settings.allow_automatic_data_storage', -> 'allowAutomaticDataStorage'
|
||||
'data.settings.allow_encrypted_data_storage', -> 'allowEncryptedDataStorage'
|
||||
'data.settings.settings_deals_auto_approve', -> 'settingsDealsAutoApprove' MIGRATED
|
||||
'data.settings.allow_automatic_data_storage', -> 'allowAutomaticDataStorage' MIGRATED
|
||||
'data.settings.allow_encrypted_data_storage', -> 'allowEncryptedDataStorage' MIGRATED
|
||||
'data.onboarding', -> 'onboarding'
|
||||
'data.twitter.username', -> 'twitterUsername'
|
||||
'data.twitter.verified', -> 'twitterVerified'
|
||||
|
@ -71,12 +71,12 @@ const run = async () => {
|
||||
for (let i = 0; i < response.length; i++) {
|
||||
const user = response[i];
|
||||
|
||||
if (user.data.settings?.allow_automatic_data_storage) {
|
||||
if (user.allowAutomaticDataStorage) {
|
||||
storageUsers.unshift(user);
|
||||
dealUsers = dealUsers + 1;
|
||||
}
|
||||
|
||||
if (user.data.settings?.allow_encrypted_data_storage) {
|
||||
if (user.allowEncryptedDataStorage) {
|
||||
encryptedUsers = encryptedUsers + 1;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ const run = async () => {
|
||||
const printData = {
|
||||
username: storageUsers[i].username,
|
||||
slateURL: `https://slate.host/${storageUsers[i].username}`,
|
||||
isForcingEncryption: user.data.settings?.allow_encrypted_data_storage,
|
||||
isForcingEncryption: user.allowEncryptedDataStorage,
|
||||
};
|
||||
let buckets;
|
||||
|
||||
@ -188,7 +188,7 @@ const run = async () => {
|
||||
time: o.time,
|
||||
pending: o.pending,
|
||||
createdAt: Strings.toDateSinceEpoch(o.time),
|
||||
userEncryptsDeals: !!user.data.settings?.allow_encrypted_data_storage,
|
||||
userEncryptsDeals: !!user.allowEncryptedDataStorage,
|
||||
miner: minerMap[o.dealInfo.miner] ? minerMap[o.dealInfo.miner] : { id: o.dealInfo.miner },
|
||||
phase: "MARCH",
|
||||
user: {
|
||||
@ -344,7 +344,7 @@ const run = async () => {
|
||||
userBuckets.length < BUCKET_LIMIT
|
||||
) {
|
||||
key = null;
|
||||
encrypt = !!user.data.settings?.allow_encrypted_data_storage;
|
||||
encrypt = !!user.allowEncryptedDataStorage;
|
||||
|
||||
// NOTE(jim): Create a new bucket
|
||||
const newBucketName = encrypt ? `encrypted-data-${uuid()}` : `open-data-${uuid()}`;
|
||||
|
Loading…
Reference in New Issue
Block a user