;
viewersExpirePeriod: number;
+ isCurrentUserPremium?: boolean;
}
const CLOSE_ANIMATION_DURATION = 100;
@@ -35,6 +41,7 @@ function StoryViewers({
viewsCount,
viewersExpirePeriod,
seenByDates,
+ isCurrentUserPremium,
}: StateProps) {
const {
loadStorySeenBy, openChat, closeStorySeenBy, closeStoryViewer,
@@ -43,7 +50,7 @@ function StoryViewers({
const lang = useLang();
const isOpen = Boolean(storyId);
- const isExpired = Boolean(storyDate) && (storyDate + viewersExpirePeriod) < getServerTime();
+ const isExpired = !isCurrentUserPremium && Boolean(storyDate) && (storyDate + viewersExpirePeriod) < getServerTime();
const renderingSeenByDates = useCurrentOrPrev(seenByDates, true);
const renderingIsExpired = usePrevious(isExpired) || isExpired;
const renderingViewsCount = useCurrentOrPrev(viewsCount, true);
@@ -58,7 +65,7 @@ function StoryViewers({
return result;
}, [renderingIsExpired, renderingSeenByDates]);
- const isLoading = !renderingIsExpired && (!memberIds || memberIds.length === 0);
+ const isLoading = !isCurrentUserPremium && !renderingIsExpired && (!memberIds || memberIds.length === 0);
useEffect(() => {
if (!storyId || seenByDates || renderingIsExpired) {
@@ -99,6 +106,11 @@ function StoryViewers({
{renderText(lang('ExpiredViewsStub'), ['simple_markdown', 'emoji'])}
)}
+ {isCurrentUserPremium && Boolean(!memberIds?.length) && (
+
+ {lang('ServerErrorViewers')}
+
+ )}
{memberIds?.map((userId) => (
{
viewersExpirePeriod: appConfig!.storyExpirePeriod + appConfig!.storyViewersExpirePeriod,
storyDate,
viewsCount,
+ isCurrentUserPremium: selectIsCurrentUserPremium(global),
};
})(StoryViewers));
diff --git a/src/components/ui/SearchInput.tsx b/src/components/ui/SearchInput.tsx
index 77f29d1e4..f0f7e0b39 100644
--- a/src/components/ui/SearchInput.tsx
+++ b/src/components/ui/SearchInput.tsx
@@ -134,7 +134,7 @@ const SearchInput: FC = ({
onKeyDown={handleKeyDown}
/>
{
case 'updateUser': {
Object.values(global.byTabId).forEach(({ id: tabId }) => {
if (update.id === global.currentUserId && update.user.isPremium !== selectIsCurrentUserPremium(global)) {
- // TODO Do not display modal if premium is bought from another device
- if (update.user.isPremium) actions.openPremiumModal({ isSuccess: true, tabId });
+ if (update.user.isPremium && global.byTabId[tabId].premiumModal) {
+ actions.openPremiumModal({ isSuccess: true, tabId });
+ }
// Reset translation cache cause premium provides additional formatting
global = {
diff --git a/src/global/reducers/stories.ts b/src/global/reducers/stories.ts
index 57ed810a5..c0cddabc3 100644
--- a/src/global/reducers/stories.ts
+++ b/src/global/reducers/stories.ts
@@ -356,7 +356,10 @@ function updateOrderedStoriesUserIds(global: T, updateUse
}, { active: [], archived: [] });
function sort(userId: string) {
- return currentUserId === userId ? Infinity : byUserId[userId].lastUpdatedAt;
+ const PREMIUM_PRIORITY = 1e12;
+ const isPremium = selectUser(global, userId)?.isPremium;
+ const lastUpdated = byUserId[userId].lastUpdatedAt || 0;
+ return currentUserId === userId ? Infinity : (lastUpdated + (isPremium ? PREMIUM_PRIORITY : 0));
}
newOrderedUserIds.archived = orderBy(