Skip to content

Split avatar, presence, status widgets out from content.dart #1735

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

Merged
merged 3 commits into from
Jul 22, 2025

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented Jul 22, 2025

These started here with Avatar, one little widget which we didn't have a more natural home for and so tucked in with the content widgets.

That gradually grew from 34 lines to 159 lines, across several widgets. Then when we built widgets for presence and user status, we put them here as they're natural companions of the avatar. Now it's 367 lines in total, none of it really about message content; so give this all its own separate file.

(I had this thought a few weeks ago, but didn't want to create merge conflicts with the PRs adding presence and user status. Now that #1702 is merged, it's a good time for this move.)

Along the way, the need to move a few bits from content_checks.dart reminded me of an old recurring annoyance and prompted me to think of a new solution:

608a24f test [nfc]: Consolidate a widgets/checks.dart for trivial checks-extensions

I've long had a recurring small annoyance that the "foo_checks.dart"
file interferes with tab-completion for "foo_test.dart". For example
as mentioned in this comment:
#1608 (comment)

So here's an approach to solve that, beginning with the "checks" files
in test/widgets/.

For updating the imports, I used a bit of Perl:

$ perl -i -0pe '
      s,import .\K(?!dialog)\w*_checks.dart,checks.dart,g
    ' test/widgets/*_test.dart

…nsions

I've long had a recurring small annoyance that the "foo_checks.dart"
file interferes with tab-completion for "foo_test.dart".  For example
as mentioned in this comment:
  zulip#1608 (comment)

So here's an approach to solve that, beginning with the "checks" files
in test/widgets/.

For updating the imports, I used a bit of Perl:

  $ perl -i -0pe '
        s,import .\K(?!dialog)\w*_checks.dart,checks.dart,g
      ' test/widgets/*_test.dart
@gnprice gnprice requested a review from chrisbobbe July 22, 2025 21:58
@gnprice gnprice added the maintainer review PR ready for review by Zulip maintainers label Jul 22, 2025
gnprice added 2 commits July 22, 2025 15:07
…dart too

Also fix the name of one such extension; and make a local class
in one test private, so that it's clear directly from a grep that
its checks-extension isn't another one to consolidate.

The grep that found these, and confirmed there are no more, is:

  $ git grep 'on Subject<[^_]' test/widgets/'*'_test.dart
These started here with Avatar, one little widget which we didn't have
a more natural home for and so tucked in with the content widgets.

That gradually grew from 34 lines to 159 lines, across several
widgets.  Then when we built widgets for presence and user status,
we put them here as they're natural companions of the avatar.
Now it's 367 lines in total, none of it really about message content;
so give this all its own separate file.
@chrisbobbe chrisbobbe merged commit ae2b9a2 into zulip:main Jul 22, 2025
1 check passed
@chrisbobbe
Copy link
Collaborator

Thanks, LGTM! Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer review PR ready for review by Zulip maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants