diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-09-28 23:41:34 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-09-28 23:41:34 +0200 |
commit | 274204c21e421ed13c66411ce56bb70dea03d410 (patch) | |
tree | 44f96996f5631526e96866fe583de2ca87ec2898 /popup | |
parent | 29909a27f592ac1bca98bfe7058b576167445518 (diff) |
check contract hash, fix unicode bug
Diffstat (limited to 'popup')
-rw-r--r-- | popup/popup.tsx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/popup/popup.tsx b/popup/popup.tsx index 5a381c987..3797d81dc 100644 --- a/popup/popup.tsx +++ b/popup/popup.tsx @@ -30,7 +30,7 @@ import {substituteFulfillmentUrl} from "../lib/wallet/helpers"; import BrowserClickedEvent = chrome.browserAction.BrowserClickedEvent; -import {Wallet} from "../lib/wallet/wallet"; +import {HistoryRecord} from "../lib/wallet/wallet"; import {AmountJson} from "../lib/wallet/types"; declare var m: any; @@ -173,7 +173,7 @@ function retryPayment(url: string, contractHash: string) { } -function formatHistoryItem(historyItem: any) { +function formatHistoryItem(historyItem: HistoryRecord) { const d = historyItem.detail; const t = historyItem.timestamp; console.log("hist item", historyItem); @@ -215,7 +215,7 @@ namespace WalletHistory { } class Controller { - myHistory: any; + myHistory: any[]; gotError = false; constructor() { @@ -241,14 +241,24 @@ namespace WalletHistory { } export function view(ctrl: Controller) { - let history = ctrl.myHistory; + let history: HistoryRecord[] = ctrl.myHistory; if (ctrl.gotError) { return i18n`Error: could not retrieve event history`; } if (!history) { throw Error("Could not retrieve history"); } - let listing = _.map(history, formatHistoryItem); + + let subjectMemo: {[s: string]: boolean} = {}; + let listing: any[] = []; + for (let record of history.reverse()) { + //if (record.subjectId && subjectMemo[record.subjectId]) { + // return; + //} + subjectMemo[record.subjectId as string] = true; + listing.push(formatHistoryItem(record)); + } + if (listing.length > 0) { return m("div.container", listing); } |