Skip to content

Commit e855d05

Browse files
committed
Add link to pricing page when refresh rate is not allowed
1 parent 5ef2465 commit e855d05

2 files changed

Lines changed: 29 additions & 12 deletions

File tree

  • services/backend-api

services/backend-api/client/src/features/feedConnections/components/UserFeedMiscSettingsTabSection/index.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,33 @@ export const UserFeedMiscSettingsTabSection = ({ feedId }: Props) => {
236236
const fastestAllowedRate = Math.min(
237237
...(feed?.refreshRateOptions.filter((r) => !r.disabledCode).map((o) => o.rateSeconds) || [])
238238
);
239+
const canHaveLowerRate = feed?.refreshRateOptions.filter(
240+
(r) => r.disabledCode === "INSUFFICIENT_SUPPORTER_TIER"
241+
);
239242

240243
if (e instanceof ApiAdapterError && e.errorCode === "USER_REFRESH_RATE_NOT_ALLOWED") {
241244
createErrorAlert({
242245
title: "Refresh rate is not allowed.",
243-
description: `Your selected refresh rate must be greater than or equal to ${(
244-
fastestAllowedRate / 60
245-
).toFixed(1)} minutes and less than or equal to 1440.0 minutes (1 day).`,
246+
description: (
247+
<Text>
248+
Your selected refresh rate must be greater than or equal to
249+
{(fastestAllowedRate / 60).toFixed(1)} minutes and less than or equal to 1440.0
250+
minutes (1 day).
251+
{canHaveLowerRate && (
252+
<>
253+
{" "}
254+
<Link
255+
color="blue.200"
256+
href="https://monitorss.xyz/pricing"
257+
target="_blank"
258+
rel="noreferrer"
259+
>
260+
Get lower rates by being a paid supporter.
261+
</Link>
262+
</>
263+
)}
264+
</Text>
265+
),
246266
});
247267
} else {
248268
createErrorAlert({

services/backend-api/src/features/user-feeds/user-feeds.service.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,16 +1120,13 @@ export class UserFeedsService {
11201120
updates.userRefreshRateSeconds === fastestPossibleRate
11211121
) {
11221122
useUpdateObject.$unset!.userRefreshRateSeconds = "";
1123-
} else if (
1124-
updates.userRefreshRateSeconds > 86400 ||
1125-
(updates.userRefreshRateSeconds !==
1126-
this.supportersService.defaultRefreshRateSeconds &&
1127-
updates.userRefreshRateSeconds !==
1128-
this.supportersService.defaultSupporterRefreshRateSeconds &&
1129-
updates.userRefreshRateSeconds < fastestPossibleRate)
1130-
) {
1123+
} else if (updates.userRefreshRateSeconds > 86400) {
1124+
throw new RefreshRateNotAllowedException(
1125+
`Refresh rate is too high. Maximum is 86400 seconds (24 hours).`
1126+
);
1127+
} else if (updates.userRefreshRateSeconds < fastestPossibleRate) {
11311128
throw new RefreshRateNotAllowedException(
1132-
`Refresh rate ${updates.userRefreshRateSeconds} is not allowed for user ${user.discordUserId}`
1129+
`Refresh rate is too low. Must be at least ${fastestPossibleRate} seconds.`
11331130
);
11341131
} else {
11351132
useUpdateObject.$set!.userRefreshRateSeconds =

0 commit comments

Comments
 (0)