Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"chat_group_mention": "%{username} mentioned %{group_name} in chat",
"new_features": "New features available!",
"new_with_count": "new (%{count})",
"new_with_count_unified": "Topics (%{count})",
"new": "New",
"no_notifications": "No notifications",
"no_replies": "No replies",
Expand All @@ -52,6 +53,7 @@
"switch_dark": "Use dark theme",
"term_exists": "%{term} already exists",
"unread_with_count": "unread (%{count})",
"unread_with_count_unified": "Replies (%{count})",
"term_placeholder": "Search or enter a community URL",
"term_placeholder_single_site": "Enter the community URL",
"please_wait": "Please wait...",
Expand Down
9 changes: 7 additions & 2 deletions js/screens/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@ class HomeScreen extends React.Component {
`${site.url}/session/otp/${site.oneTimePassword}`,
);
} else {
// Use & when the endpoint already carries a query string (eg
// /new?subset=topics) so we don't produce an invalid double-? URL.
const separator = endpoint.includes('?') ? '&' : '?';
if (Platform.OS === 'ios') {
const params = await this._siteManager.generateURLParams(site);
this.props.screenProps.openUrl(`${site.url}${endpoint}?${params}`);
this.props.screenProps.openUrl(
`${site.url}${endpoint}${separator}${params}`,
);
} else {
this.props.screenProps.openUrl(
`${site.url}${endpoint}?discourse_app=1`,
`${site.url}${endpoint}${separator}discourse_app=1`,
);
}
}
Expand Down
14 changes: 10 additions & 4 deletions js/screens/HomeScreenComponents/SiteRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,20 @@ export default function SiteRow(props) {
if (props.site.authToken) {
if (props.site.totalNew > 0) {
shortcuts.new = {
link: '/new',
text: i18n.t('new_with_count', { count: props.site.totalNew }),
link: props.site.usingUnifiedNew ? '/new?subset=topics' : '/new',
text: props.site.usingUnifiedNew
? i18n.t('new_with_count_unified', { count: props.site.totalNew })
: i18n.t('new_with_count', { count: props.site.totalNew }),
};
}
if (props.site.totalUnread > 0) {
shortcuts.unread = {
link: '/unread',
text: i18n.t('unread_with_count', { count: props.site.totalUnread }),
link: props.site.usingUnifiedNew ? '/new?subset=replies' : '/unread',
text: props.site.usingUnifiedNew
? i18n.t('unread_with_count_unified', {
count: props.site.totalUnread,
})
: i18n.t('unread_with_count', { count: props.site.totalUnread }),
};
}
}
Expand Down
2 changes: 2 additions & 0 deletions js/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ class Site {
this.chatNotifications = totals.chat_notifications || 0;
this.totalUnread = totals?.topic_tracking.unread || 0;
this.totalNew = totals?.topic_tracking.new || 0;
this.usingUnifiedNew =
totals?.topic_tracking.unified_new_enabled ?? false;
this.username = totals.username;
if (totals.group_inboxes) {
this.groupInboxes = totals.group_inboxes;
Expand Down
Loading