-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better management of archived channel names #1344
base: main
Are you sure you want to change the base?
Conversation
24ed3b6
to
432b103
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! One more thing that I think needs to be handled is the topic actions sheet. None of the supported actions (follow/mute/unmute/resolve/unresolve) works on a topic in an archived channel. Not sure what's the best way to deal with this, though. It would be a good question to ask on #mobile-design.
lib/widgets/compose_box.dart
Outdated
if (channel == null || !store.hasPostingPermission(inChannel: channel, | ||
user: selfUser, byDate: DateTime.now())) { | ||
user: selfUser, byDate: DateTime.now()) || channel.isArchived) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's reformat this to show that these expressions are parallel:
if (channel == null || !store.hasPostingPermission(inChannel: channel, | |
user: selfUser, byDate: DateTime.now())) { | |
user: selfUser, byDate: DateTime.now()) || channel.isArchived) { | |
if (channel == null | |
|| !store.hasPostingPermission(inChannel: channel, | |
user: selfUser, byDate: DateTime.now()) | |
|| channel.isArchived) { |
test/widgets/compose_box_test.dart
Outdated
testWidgets('error banner is shown in $narrowType narrow', (tester) async { | ||
await prepareComposeBox(tester, | ||
narrow: narrow, | ||
selfUser: eg.user(role: UserRole.administrator), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the user role relevant here? If not, this can be removed.
lib/widgets/subscription_list.dart
Outdated
pinned.add(subscription); | ||
} else { | ||
unpinned.add(subscription); | ||
if(!subscription.isArchived) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can use continue
here, so that the if
s don't need to be nested
lib/widgets/subscription_list.dart
Outdated
@@ -187,10 +189,13 @@ class _SubscriptionList extends StatelessWidget { | |||
|
|||
@override | |||
Widget build(BuildContext context) { | |||
// Filtering out the archived subscriptions. | |||
final activeSubscriptions = subscriptions.where((sub) => !sub.isArchived).toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line of code is pretty straightforward, and the comment doesn't add much here, so let's just leave it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, is it possible for subscriptions
to contain archived subscriptions, or is it the job of SubscriptionListPageBody
to ensure that no archived subscriptions are passed here?
If the latter, it might be better performance-wise to have an assertion that none of these subscriptions is archived, so that we don't need to re-filter the subscriptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now that I check, its already being handled. removed this part.
eg.subscription(eg.stream(streamId: 1, isArchived: true), pinToTop: true), | ||
eg.subscription(eg.stream(streamId: 2), pinToTop: true), | ||
eg.subscription(eg.stream(streamId: 3, isArchived: true), pinToTop: false), | ||
eg.subscription(eg.stream(streamId: 4,), pinToTop: false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra comma
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also reorder the list to make it easier to read:
await setupStreamListPage(tester, subscriptions: [
eg.subscription(eg.stream(streamId: 1, isArchived: true), pinToTop: true),
eg.subscription(eg.stream(streamId: 2, isArchived: true), pinToTop: false),
eg.subscription(eg.stream(streamId: 3), pinToTop: true),
eg.subscription(eg.stream(streamId: 4), pinToTop: false),
]);
test/widgets/message_list_test.dart
Outdated
@@ -1062,7 +1085,7 @@ void main() { | |||
.initNarrow.equals(DmNarrow.withUser(eg.otherUser.userId, selfUserId: eg.selfUser.userId)); | |||
await tester.pumpAndSettle(); | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks unintentional.
lib/widgets/message_list.dart
Outdated
fontStyle: FontStyle.italic, | ||
), | ||
), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is a specific design that we are following here (and other UI changes), it would be helpful to have a link in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There isn't a particular design that i could reference. I'm trying to keep it consistent with web.
test/widgets/inbox_test.dart
Outdated
@@ -595,6 +616,36 @@ void main() { | |||
check(rectAfterTap).equals(rectBeforeTap); | |||
}); | |||
|
|||
testWidgets('shows archived label for archived streams', (tester) async { | |||
final zulipLocalizations = GlobalLocalizations.zulipLocalizations; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For tests, it is fine to not use ZulipLocalizations
and have plain strings unless we are specifically testing something related to l10n. This way we have a better idea of what exactly we are expecting in tests.
]); | ||
|
||
// Only non-archived streams | ||
check(getItemCount()).equals(2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit ambiguous because it doesn't check if the remaining streams are the ones that are not archived.
lib/api/model/model.dart
Outdated
@@ -347,6 +347,8 @@ class ZulipStream { | |||
// TODO(server-8): added in FL 199, was previously only on [Subscription] objects | |||
int? streamWeeklyTraffic; | |||
|
|||
final bool isArchived; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Make sure to match the order of these fields in the API documentation. See the dartdoc of ZulipStream
to find the relevant piece.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to be the order in the API documentation as I checked. Please let me know if its not
https://zulip.com/api/register-queue and go to subscriptions
return value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. The location the dartdoc points to has a different order. Let's match that:
/// For docs, search for "if stream"
/// in <https://zulip.com/api/register-queue>.
@JsonSerializable(fieldRename: FieldRename.snake)
class ZulipStream {
432b103
to
2760c82
Compare
This enables the client to receive metadata about archived streams in the register response and events, allowing it to handle them properly.
6a37c0c
to
1a8ae0f
Compare
1a8ae0f
to
1bc6ec1
Compare
Pull Request
Description
This PR improves archived stream support in the mobile app to match the web app’s behavior. Key updates include:
Related Issues
Screenshots