fix for pendingTrusted bug

This commit is contained in:
Martina 2020-08-30 20:49:12 -07:00
parent 06b8df0812
commit 3621703d44
3 changed files with 3 additions and 14 deletions

View File

@ -33,16 +33,14 @@ const STYLES_LINK = css`
export default class Profile extends React.Component {
render() {
let data = this.props.creator ? this.props.creator : this.props.data; //do we need this?
let data = this.props.creator ? this.props.creator : this.props.data;
return (
<div css={STYLES_PROFILE}>
<div
css={STYLES_PROFILE_IMAGE}
style={{ backgroundImage: `url('${data.data.photo}')` }}
/>
<div css={STYLES_NAME}>{data.username}</div>
{/* TODO: replace with real name when added */}
{this.props.buttons}
<div css={STYLES_NAME}>{data.username}</div>/{this.props.buttons}
<br />
{data.slates && data.slates.length ? (
<div style={{ width: "100%" }}>

View File

@ -48,7 +48,7 @@ export const getById = async ({ id }) => {
// NOTE(jim): This should be the cheapest call.
const pendingTrusted = await Data.getPendingTrustedRelationshipsByUserId({
userId: [],
userId: id,
});
const r3 = await Serializers.doPendingTrusted({
users: [id],

View File

@ -77,7 +77,6 @@ export default class SceneProfile extends React.Component {
if (trust.length) {
let relation = trust[0];
newState.trustId = relation.id;
console.log(relation.id);
if (relation.data.verified) {
newState.trustStatus = "trusted";
} else {
@ -90,7 +89,6 @@ export default class SceneProfile extends React.Component {
if (pendingTrust.length) {
let relation = pendingTrust[0];
newState.trustId = relation.id;
console.log(relation.id);
if (pendingTrust[0].data.verified) {
newState.trustStatus = "trusted";
} else {
@ -109,8 +107,6 @@ export default class SceneProfile extends React.Component {
_handleUpdate = async (e) => {
let response = await this.props.onRehydrate();
// const response = await Actions.hydrateAuthenticatedUser();
console.log(response);
if (!response || response.error) {
alert("TODO: error fetching authenticated viewer");
return null;
@ -127,24 +123,20 @@ export default class SceneProfile extends React.Component {
this.state.trustStatus === "untrusted" ||
this.state.trustStatus === "sent"
) {
console.log(this.props.data);
response = await Actions.createTrustRelationship({
userId: this.props.data.id,
});
console.log(response);
console.log("cancel request or create trust");
} else if (this.state.trustStatus === "received") {
response = await Actions.updateTrustRelationship({
userId: this.props.data.id,
});
console.log(response);
console.log("accept");
} else {
response = await Actions.deleteTrustRelationship({
id: this.state.trustId,
});
console.log(response);
console.log("delete trust");
}
await this._handleUpdate();
};
@ -154,7 +146,6 @@ export default class SceneProfile extends React.Component {
userId: this.props.data.id,
});
console.log(response);
console.log("follow / unfollow");
await this._handleUpdate();
};