forked from trent_larson/crowd-funder-for-time-pwa
Remove unused confirmation code from ActivityListItem and HomeView
- Remove unused handleConfirmClick() and emitConfirmClaim() methods from ActivityListItem - Remove unused canConfirm computed property and confirmerIdList prop - Remove unused imports: isGiveClaimType, notifyWhyCannotConfirm, containsHiddenDid - Remove unused confirmClaim() method from HomeView - Remove unused @confirm-claim event binding and :confirmer-id-list prop - Remove unused imports: serverUtil, NOTIFY_CONFIRMATION_ERROR The confirmation functionality was not being used in ActivityListItem as there was no UI to trigger it. Confirmation is handled in other components like ClaimView and ConfirmGiftView.
This commit is contained in:
@@ -251,8 +251,7 @@
|
||||
import { Component, Prop, Vue, Emit } from "vue-facing-decorator";
|
||||
import { GiveRecordWithContactInfo } from "@/interfaces/give";
|
||||
import EntityIcon from "./EntityIcon.vue";
|
||||
import { isGiveClaimType, notifyWhyCannotConfirm } from "../libs/util";
|
||||
import { containsHiddenDid, isHiddenDid } from "../libs/endorserServer";
|
||||
import { isHiddenDid } from "../libs/endorserServer";
|
||||
import ProjectIcon from "./ProjectIcon.vue";
|
||||
import { createNotifyHelpers } from "@/utils/notify";
|
||||
import {
|
||||
@@ -272,7 +271,6 @@ export default class ActivityListItem extends Vue {
|
||||
@Prop() lastViewedClaimId?: string;
|
||||
@Prop() isRegistered!: boolean;
|
||||
@Prop() activeDid!: string;
|
||||
@Prop() confirmerIdList?: string[];
|
||||
|
||||
/**
|
||||
* Function prop for handling image caching
|
||||
@@ -331,15 +329,6 @@ export default class ActivityListItem extends Vue {
|
||||
return unitCode === "HUR" ? (single ? "hour" : "hours") : unitCode;
|
||||
}
|
||||
|
||||
get canConfirm(): boolean {
|
||||
if (!this.isRegistered) return false;
|
||||
if (!isGiveClaimType(this.record.fullClaim?.["@type"])) return false;
|
||||
if (this.confirmerIdList?.includes(this.activeDid)) return false;
|
||||
if (this.record.issuerDid === this.activeDid) return false;
|
||||
if (containsHiddenDid(this.record.fullClaim)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Emit methods using @Emit decorator
|
||||
@Emit("viewImage")
|
||||
emitViewImage(imageUrl: string) {
|
||||
@@ -351,26 +340,6 @@ export default class ActivityListItem extends Vue {
|
||||
return jwtId;
|
||||
}
|
||||
|
||||
@Emit("confirmClaim")
|
||||
emitConfirmClaim() {
|
||||
if (!this.canConfirm) {
|
||||
notifyWhyCannotConfirm(
|
||||
(msg, timeout) => this.notify.info(msg.text ?? "", timeout),
|
||||
this.isRegistered,
|
||||
this.record.fullClaim?.["@type"],
|
||||
this.record,
|
||||
this.activeDid,
|
||||
this.confirmerIdList,
|
||||
);
|
||||
return;
|
||||
}
|
||||
return this.record;
|
||||
}
|
||||
|
||||
handleConfirmClick() {
|
||||
this.emitConfirmClaim();
|
||||
}
|
||||
|
||||
get friendlyDate(): string {
|
||||
const date = new Date(this.record.issuedAt);
|
||||
return date.toLocaleDateString(undefined, {
|
||||
|
||||
@@ -234,11 +234,9 @@ Raymer * @version 1.0.0 */
|
||||
:last-viewed-claim-id="feedLastViewedClaimId"
|
||||
:is-registered="isRegistered"
|
||||
:active-did="activeDid"
|
||||
:confirmer-id-list="record.confirmerIdList"
|
||||
:on-image-cache="cacheImageData"
|
||||
@load-claim="onClickLoadClaim"
|
||||
@view-image="openImageViewer"
|
||||
@confirm-claim="confirmClaim"
|
||||
/>
|
||||
</ul>
|
||||
</InfiniteScroll>
|
||||
@@ -306,14 +304,12 @@ import {
|
||||
OnboardPage,
|
||||
} from "../libs/util";
|
||||
import { GiveSummaryRecord } from "../interfaces/records";
|
||||
import * as serverUtil from "../libs/endorserServer";
|
||||
import { logger } from "../utils/logger";
|
||||
import { GiveRecordWithContactInfo } from "../interfaces/give";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import {
|
||||
NOTIFY_CONTACT_LOADING_ISSUE,
|
||||
NOTIFY_CONFIRMATION_ERROR,
|
||||
} from "@/constants/notifications";
|
||||
import * as Package from "../../package.json";
|
||||
|
||||
@@ -1716,53 +1712,6 @@ export default class HomeView extends Vue {
|
||||
this.isImageViewerOpen = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles claim confirmation
|
||||
*
|
||||
* @public
|
||||
* Called by ActivityListItem component
|
||||
* @param record Record to confirm
|
||||
*/
|
||||
async confirmClaim(record: GiveRecordWithContactInfo) {
|
||||
this.notify.confirm(
|
||||
"Do you personally confirm that this is true?",
|
||||
async () => {
|
||||
const goodClaim = serverUtil.removeSchemaContext(
|
||||
serverUtil.removeVisibleToDids(
|
||||
serverUtil.addLastClaimOrHandleAsIdIfMissing(
|
||||
record.fullClaim,
|
||||
record.jwtId,
|
||||
record.handleId,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
const confirmationClaim = {
|
||||
"@context": "https://schema.org",
|
||||
"@type": "AgreeAction",
|
||||
object: goodClaim,
|
||||
};
|
||||
|
||||
const result = await serverUtil.createAndSubmitClaim(
|
||||
confirmationClaim,
|
||||
this.activeDid,
|
||||
this.apiServer,
|
||||
this.axios,
|
||||
);
|
||||
|
||||
if (result.success) {
|
||||
this.notify.confirmationSubmitted();
|
||||
|
||||
// Refresh the feed to show updated confirmation status
|
||||
await this.updateAllFeed();
|
||||
} else {
|
||||
logger.error("Error submitting confirmation:", result);
|
||||
this.notify.error(NOTIFY_CONFIRMATION_ERROR.message, TIMEOUTS.LONG);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
private handleQRCodeClick() {
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
this.$router.push({ name: "contact-qr-scan-full" });
|
||||
|
||||
Reference in New Issue
Block a user