mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: implement fifth parameter in zap tag
This commit is contained in:
parent
4b416e3c66
commit
7d9f874cdf
2 changed files with 5 additions and 3 deletions
|
|
@ -276,10 +276,12 @@ export const statusZapSplitsController: AppController = async (c) => {
|
||||||
|
|
||||||
const weight = percentageSchema.catch(0).parse(zapsTag.find((name) => name[1] === pubkey)![3]) ?? 0;
|
const weight = percentageSchema.catch(0).parse(zapsTag.find((name) => name[1] === pubkey)![3]) ?? 0;
|
||||||
|
|
||||||
|
const message = zapsTag.find((name) => name[1] === pubkey)![4] ?? '';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
account,
|
account,
|
||||||
message: '',
|
message,
|
||||||
weight: weight,
|
weight,
|
||||||
};
|
};
|
||||||
}))).filter((zapSplit) => zapSplit.weight > 0);
|
}))).filter((zapSplit) => zapSplit.weight > 0);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ const createStatusController: AppController = async (c) => {
|
||||||
let totalSplit = 0;
|
let totalSplit = 0;
|
||||||
for (const pubkey in dittoZapSplit) {
|
for (const pubkey in dittoZapSplit) {
|
||||||
totalSplit += dittoZapSplit[pubkey].weight;
|
totalSplit += dittoZapSplit[pubkey].weight;
|
||||||
tags.push(['zap', pubkey, Conf.relay, dittoZapSplit[pubkey].weight.toString()]);
|
tags.push(['zap', pubkey, Conf.relay, dittoZapSplit[pubkey].weight.toString(), dittoZapSplit[pubkey].message]);
|
||||||
}
|
}
|
||||||
if (totalSplit) {
|
if (totalSplit) {
|
||||||
tags.push(['zap', author?.pubkey as string, Conf.relay, Math.max(0, 100 - totalSplit).toString()]);
|
tags.push(['zap', author?.pubkey as string, Conf.relay, Math.max(0, 100 - totalSplit).toString()]);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue