add tests for new activity of offers-directly-to-user
This commit is contained in:
@@ -25,18 +25,25 @@
|
||||
:icon="showOffersDetails ? 'chevron-down' : 'chevron-right'"
|
||||
class="cursor-pointer ml-4 text-lg"
|
||||
@click="expandOffersToUserAndMarkRead()"
|
||||
data-testid="showOffersToUser"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="showOffersDetails" class="ml-4">
|
||||
<ul class="list-disc ml-4">
|
||||
<li v-for="offer in newOffersToUser" :key="offer.id" class="mt-4 relative group">
|
||||
<li
|
||||
v-for="offer in newOffersToUser"
|
||||
:key="offer.id"
|
||||
class="mt-4 relative group"
|
||||
>
|
||||
<span>{{
|
||||
didInfo(offer.offeredByDid, activeDid, allMyDids, allContacts)
|
||||
}}</span>
|
||||
offers
|
||||
<span v-if="offer.objectDescription">{{ offer.objectDescription }}
|
||||
</span>{{ offer.objectDescription && offer.amount ? ", and " : "" }}
|
||||
<span v-if="offer.objectDescription">{{
|
||||
offer.objectDescription
|
||||
}}</span
|
||||
>{{ offer.objectDescription && offer.amount ? ", and " : "" }}
|
||||
<span v-if="offer.amount">{{
|
||||
displayAmount(offer.unit, offer.amount)
|
||||
}}</span>
|
||||
@@ -67,7 +74,12 @@ import GiftedDialog from "@/components/GiftedDialog.vue";
|
||||
import QuickNav from "@/components/QuickNav.vue";
|
||||
import EntityIcon from "@/components/EntityIcon.vue";
|
||||
import { NotificationIface } from "@/constants/app";
|
||||
import { accountsDB, db, retrieveSettingsForActiveAccount, updateAccountSettings } from "@/db/index";
|
||||
import {
|
||||
accountsDB,
|
||||
db,
|
||||
retrieveSettingsForActiveAccount,
|
||||
updateAccountSettings,
|
||||
} from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import {
|
||||
didInfo,
|
||||
@@ -151,7 +163,9 @@ export default class NewActivityView extends Vue {
|
||||
}
|
||||
|
||||
async markOffersAsReadStartingWith(jwtId: string) {
|
||||
const index = this.newOffersToUser.findIndex(offer => offer.jwtId === jwtId);
|
||||
const index = this.newOffersToUser.findIndex(
|
||||
(offer) => offer.jwtId === jwtId,
|
||||
);
|
||||
if (index !== -1 && index < this.newOffersToUser.length - 1) {
|
||||
// Set to the next offer's jwtId
|
||||
await updateAccountSettings(this.activeDid, {
|
||||
|
||||
Reference in New Issue
Block a user