Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/resources/Disputes.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Disputes {
const amountShift = event.args._amount.toNumber()
// juror won/lost tokens
if (address === account) {
const userProfile = await this._StoreProviderInstance.getUserProfile(
const userProfile = await this._StoreProviderInstance.setUpUserProfile(
account
)
const contractAddress = this._ArbitratorInstance.getContractAddress()
Expand Down
5 changes: 2 additions & 3 deletions src/resources/Notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ class Notifications {
*/
getUnreadStoredNotifications = async account => {
this._requireStoreProvider()

const profile = await this._StoreProviderInstance.getUserProfile(account)
const profile = await this._StoreProviderInstance.setUpUserProfile(account)
const currentArbitrator = this._ArbitratorInstance.getContractAddress()
// return notifications that are for current arbitrator and are unread
return _.filter(
Expand Down Expand Up @@ -605,7 +604,7 @@ class Notifications {

// If we have store provider fetch contracts and disputes from the store.
if (this._StoreProviderInstance) {
const userProfile = await this._StoreProviderInstance.getUserProfile(
const userProfile = await this._StoreProviderInstance.setUpUserProfile(
account
)

Expand Down
14 changes: 7 additions & 7 deletions src/utils/StoreProviderWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class StoreProviderWrapper {
* @returns {number} The last block number.
*/
getLastBlock = async userAddress => {
const userProfile = await this.getUserProfile(userAddress)
const userProfile = await this.setUpUserProfile(userAddress)

return userProfile.lastBlock || 0
}
Expand Down Expand Up @@ -229,10 +229,10 @@ class StoreProviderWrapper {
setUpUserProfile = async userAddress => {
let userProfile = await this.getUserProfile(userAddress)
if (_.isNull(userProfile)) {
this.updateUserProfile(userAddress, {})
userProfile = await this.queueReadRequest(
`${this._storeUri}/${userAddress}`
)
const response = await this.updateUserProfile(userAddress, {})
if (response.status !== 201)
throw new Error(errorConstants.REQUEST_FAILED(response.responseText))
userProfile = response.body
}

return userProfile
Expand Down Expand Up @@ -329,7 +329,7 @@ class StoreProviderWrapper {
params
) => {
const getBodyFn = async () => {
const userProfile = await this.getUserProfile(userAddress)
const userProfile = await this.setUpUserProfile(userAddress)

const currentDisputeProfile =
_.filter(
Expand Down Expand Up @@ -438,7 +438,7 @@ class StoreProviderWrapper {
isRead = true
) => {
const getBodyFn = async () => {
const userProfile = await this.getUserProfile(userAddress)
const userProfile = await this.setUpUserProfile(userAddress)

const notificationIndex = await _.findIndex(
userProfile.notifications,
Expand Down