Fix useless bare-divar.ir links + hide empty homepage shifts section
CI/CD / CI · dotnet build (push) Successful in 4m6s
CI/CD / Deploy · hamkadr (push) Successful in 3m35s

- Divar listings with no extractable post token were given SourceUrl «https://divar.ir» — a link
  that just opens Divar''s homepage, not the ad. Store null instead, and guard the contact-modal
  fallback to require a real path (so existing bare-domain links stop being offered too).
- Homepage «جدیدترین شیفت‌ها»: only render when there are real open shifts. Almost all aggregated
  ads are ongoing hiring (jobs), not dated shifts, so the section was showing a fabricated shift
  date (the «۱۸ خرداد» on the welcome page). Now it hides when empty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-23 11:50:21 +03:30
parent fdeefb7625
commit 39c866f4c7
3 changed files with 19 additions and 19 deletions
@@ -62,7 +62,9 @@ public class DivarListingSource : IListingSource
var cityLabel = CityLabel(s.DivarCity); // every result is from the city we searched
foreach (var (text, token) in Harvest(doc.RootElement).Take(25))
{
var url = token is not null ? $"https://divar.ir/v/{token}" : "https://divar.ir";
// Only a real post token gives a usable deep link. Without one, leave SourceUrl null —
// a bare «https://divar.ir» just opens Divar's homepage, which is useless to the user.
var url = token is not null ? $"https://divar.ir/v/{token}" : null;
var itemText = text;
// Stamp the city so the parser/AI always resolve a location (Divar's own location
// line isn't always in the search row; the searched city is authoritative).