feat: track events in note creator
This commit is contained in:
parent
d2cec4909c
commit
a1e9df8254
@ -6,7 +6,7 @@ import { TagsInput } from "react-tag-input-component";
|
||||
|
||||
import Icon from "@/Icons/Icon";
|
||||
import useEventPublisher from "@/Hooks/useEventPublisher";
|
||||
import { appendDedupe, openFile } from "@/SnortUtils";
|
||||
import { appendDedupe, openFile, trackEvent } from "@/SnortUtils";
|
||||
import Textarea from "@/Element/Textarea";
|
||||
import Modal from "@/Element/Modal";
|
||||
import ProfileImage from "@/Element/User/ProfileImage";
|
||||
@ -158,6 +158,16 @@ export function NoteCreator() {
|
||||
async function sendNote() {
|
||||
const ev = await buildNote();
|
||||
if (ev) {
|
||||
trackEvent("PostNote")
|
||||
if (ev.tags.find(a => a[0] === "content-warning")) {
|
||||
trackEvent("PostNote:WithContentWarning");
|
||||
}
|
||||
if (ev.tags.find(a => a[0] === "poll_option")) {
|
||||
trackEvent("PostNote:WithPoll");
|
||||
}
|
||||
if (ev.tags.find(a => a[0] === "zap")) {
|
||||
trackEvent("PostNote:WithZapSplit");
|
||||
}
|
||||
const events = (note.otherEvents ?? []).concat(ev);
|
||||
events.map(a =>
|
||||
sendEventToRelays(system, a, note.selectedCustomRelays, r => {
|
||||
@ -193,7 +203,7 @@ export function NoteCreator() {
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadFile(file: File | Blob) {
|
||||
async function uploadFile(file: File) {
|
||||
try {
|
||||
if (file) {
|
||||
const rx = await uploader.upload(file, file.name);
|
||||
@ -259,6 +269,7 @@ export function NoteCreator() {
|
||||
note.update(v => (v.preview = undefined));
|
||||
} else if (publisher) {
|
||||
const tmpNote = await buildNote();
|
||||
trackEvent("PostNote:Preview");
|
||||
note.update(v => (v.preview = tmpNote));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user