Compare commits

...

2 Commits

Author SHA1 Message Date
Naiyuan Qing
ec89c746e1 test(onboarding): cover official source reporting controls 2026-07-01 14:12:50 +08:00
Naiyuan Qing
784b33fa4f fix(self-host): restore official source report endpoint 2026-07-01 14:07:55 +08:00
4 changed files with 42 additions and 8 deletions

View File

@@ -162,6 +162,26 @@ describe("SourceBackfillModal", () => {
).toBeChecked();
});
it("does not show reporting controls on the official API URL", async () => {
setUser({
id: "u1",
onboarded_at: "2026-01-01T00:00:00Z",
onboarding_questionnaire: { source: [] },
});
const user = userEvent.setup();
renderModal();
await user.click(await screen.findByText("Friends or colleagues"));
expect(
screen.queryByText(
"Help us understand how you heard about Multica. No extra information is sent.",
),
).not.toBeInTheDocument();
expect(
screen.queryByRole("switch", { name: /allow sending domain/i }),
).not.toBeInTheDocument();
});
it("Submit PATCHes the merged questionnaire preserving role / use_case", async () => {
setUser({
id: "u1",

View File

@@ -83,6 +83,22 @@ describe("StepSource (single-select primary source)", () => {
).toBeChecked();
});
it("does not show reporting controls on the official API URL", () => {
renderStep({
...EMPTY,
source: ["social_linkedin"],
});
expect(
screen.queryByText(
"Help us understand how you heard about Multica. No extra information is sent.",
),
).not.toBeInTheDocument();
expect(
screen.queryByRole("switch", { name: /allow sending domain/i }),
).not.toBeInTheDocument();
});
it("lets the user disable plaintext domain reporting", async () => {
setApiInstance(new ApiClient("https://api.customer.example"));
const user = userEvent.setup();

View File

@@ -18,11 +18,9 @@ import (
)
const (
ReportPath = "/api/acquisition/self-host-source"
// Temporary validation target for the dev/staging rollout of #4741.
sourceChannelReportAPIURL = "https://multica-api.copilothub.ai"
systemSaltKey = "self_host_source_channel_salt"
defaultTimeout = 3 * time.Second
ReportPath = "/api/acquisition/self-host-source"
systemSaltKey = "self_host_source_channel_salt"
defaultTimeout = 3 * time.Second
)
type settingStore interface {
@@ -65,7 +63,7 @@ func NewSender(settings settingStore, cfg SenderConfig) (*Sender, error) {
return &Sender{
settings: settings,
client: client,
endpoint: sourceChannelReportAPIURL + ReportPath,
endpoint: OfficialMulticaAPIURL + ReportPath,
timeout: timeout,
logger: logger,
}, nil

View File

@@ -33,8 +33,8 @@ func recordingClient(t *testing.T, got chan<- Report) *http.Client {
if req.Method != http.MethodPost {
t.Errorf("method: want POST, got %s", req.Method)
}
if req.URL.String() != sourceChannelReportAPIURL+ReportPath {
t.Errorf("url: want %s, got %s", sourceChannelReportAPIURL+ReportPath, req.URL.String())
if req.URL.String() != OfficialMulticaAPIURL+ReportPath {
t.Errorf("url: want %s, got %s", OfficialMulticaAPIURL+ReportPath, req.URL.String())
}
var payload Report
if err := json.NewDecoder(req.Body).Decode(&payload); err != nil {