diff --git a/src/JobsMedical.Web/Pages/Jobs/Details.cshtml b/src/JobsMedical.Web/Pages/Jobs/Details.cshtml index 11d72ea..fe307d2 100644 --- a/src/JobsMedical.Web/Pages/Jobs/Details.cshtml +++ b/src/JobsMedical.Web/Pages/Jobs/Details.cshtml @@ -53,7 +53,7 @@ @* Numbers from THIS ad (aggregated) — the correct, per-listing contacts. *@ } - else if (!string.IsNullOrEmpty(f.Phone) || !string.IsNullOrEmpty(f.BaleId)) + else if (JobsMedical.Web.Services.SeoJsonLd.HasRealEmployer(f) && (!string.IsNullOrEmpty(f.Phone) || !string.IsNullOrEmpty(f.BaleId))) { @if (!string.IsNullOrEmpty(f.Phone)) { diff --git a/src/JobsMedical.Web/Pages/Shifts/Details.cshtml b/src/JobsMedical.Web/Pages/Shifts/Details.cshtml index 9c78f6a..12af487 100644 --- a/src/JobsMedical.Web/Pages/Shifts/Details.cshtml +++ b/src/JobsMedical.Web/Pages/Shifts/Details.cshtml @@ -53,7 +53,7 @@ @* Numbers from THIS ad (aggregated) — the correct, per-listing contacts. *@ } - else if (!string.IsNullOrEmpty(f.Phone) || !string.IsNullOrEmpty(f.BaleId)) + else if (JobsMedical.Web.Services.SeoJsonLd.HasRealEmployer(f) && (!string.IsNullOrEmpty(f.Phone) || !string.IsNullOrEmpty(f.BaleId))) { @if (!string.IsNullOrEmpty(f.Phone)) { diff --git a/src/JobsMedical.Web/Program.cs b/src/JobsMedical.Web/Program.cs index 0222a72..012a6c2 100644 --- a/src/JobsMedical.Web/Program.cs +++ b/src/JobsMedical.Web/Program.cs @@ -411,8 +411,16 @@ app.MapGet("/contact", async (string? type, int id, AppDbContext db, InterestSer if (s is null) return Results.NotFound(); title = s.Role?.Name ?? "تماس"; items.AddRange(s.Contacts.OrderBy(c => c.SortOrder).Select(c => Item(c.Type, c.Value))); - if (items.Count == 0 && !string.IsNullOrWhiteSpace(s.Facility?.Phone)) items.Add(Item(ContactType.Phone, s.Facility!.Phone!)); - if (!string.IsNullOrWhiteSpace(s.Facility?.BaleId)) items.Add(Item(ContactType.Bale, s.Facility!.BaleId!)); + // Only fall back to the facility's number for a REAL named employer — the shared + // «نامشخص» placeholder's phone is NOT this ad's number (it leaked one number onto many posts). + if (SeoJsonLd.HasRealEmployer(s.Facility)) + { + if (items.Count == 0 && !string.IsNullOrWhiteSpace(s.Facility!.Phone)) items.Add(Item(ContactType.Phone, s.Facility.Phone!)); + if (!string.IsNullOrWhiteSpace(s.Facility!.BaleId)) items.Add(Item(ContactType.Bale, s.Facility.BaleId!)); + } + if (items.Count == 0 && !string.IsNullOrWhiteSpace(s.SourceUrl) + && Uri.TryCreate(s.SourceUrl, UriKind.Absolute, out var ss) && ss.Host.Contains("divar")) + { fallbackUrl = s.SourceUrl; fallbackLabel = "مشاهده شماره در دیوار ↗"; } await interest.LogAsync(InterestEventType.Apply, id); break; } @@ -423,8 +431,14 @@ app.MapGet("/contact", async (string? type, int id, AppDbContext db, InterestSer if (j is null) return Results.NotFound(); title = j.Title; items.AddRange(j.Contacts.OrderBy(c => c.SortOrder).Select(c => Item(c.Type, c.Value))); - if (items.Count == 0 && !string.IsNullOrWhiteSpace(j.Facility?.Phone)) items.Add(Item(ContactType.Phone, j.Facility!.Phone!)); - if (!string.IsNullOrWhiteSpace(j.Facility?.BaleId)) items.Add(Item(ContactType.Bale, j.Facility!.BaleId!)); + if (SeoJsonLd.HasRealEmployer(j.Facility)) + { + if (items.Count == 0 && !string.IsNullOrWhiteSpace(j.Facility!.Phone)) items.Add(Item(ContactType.Phone, j.Facility.Phone!)); + if (!string.IsNullOrWhiteSpace(j.Facility!.BaleId)) items.Add(Item(ContactType.Bale, j.Facility.BaleId!)); + } + if (items.Count == 0 && !string.IsNullOrWhiteSpace(j.SourceUrl) + && Uri.TryCreate(j.SourceUrl, UriKind.Absolute, out var js) && js.Host.Contains("divar")) + { fallbackUrl = j.SourceUrl; fallbackLabel = "مشاهده شماره در دیوار ↗"; } await interest.LogJobAsync(InterestEventType.Apply, id); break; }