Skip to content
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

internal_link: Parse topic permalinks #729

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

sm-sayedi
Copy link
Collaborator

These links (/with/NNNN) are just accepted and ignored in this PR, they will be interpreted in #683.

Fixes: #684

@sm-sayedi sm-sayedi added buddy review GSoC buddy review needed. labels Jun 11, 2024
@sm-sayedi sm-sayedi requested a review from rajveermalviya June 11, 2024 14:46
@sm-sayedi sm-sayedi force-pushed the issue-684-parse-topic-permalinks branch from 3c4996c to a72eb7b Compare June 11, 2024 15:12
Comment on lines 209 to 211
// cannot use lowerCamelCase `with` as it is a reserved keyword in Dart
// ignore: constant_identifier_names
With,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun.

Let's call it with_. The leading capital reads to me like it's a different kind of thing — like not an enum value at all, but a class or something like a class.

Copy link
Collaborator Author

@sm-sayedi sm-sayedi Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will generate the same "with_" string value in the enum map which is not compatible with the API! 🙂

with enum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that can be adjusted, though. The JSON serialization is all nicely customizable with more annotations — for a value of an enum, it's @JsonValue:
https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonValue-class.html

Copy link
Collaborator Author

@sm-sayedi sm-sayedi Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thank you.

Also, as this is my first time using the json_annotation package, I have a hard time working with it:
When I run the dart run build_runner watch --delete-conflicting-outputs command, all of the other auto-generated files are also modified, such as lib/api/model/events.g.dart, lib/api/route/account.g.dart, and more — and some are deleted such as lib/host/android_notifications.g.dart. So far, I have used git restore file to reject changes to those files, but I am not sure if I am doing things correctly from the start. Also, the files that these modified files are used in, gives an error like this:

Target of URI hasn't been generated: './android_notifications.g.dart'.
Try running the generator that will generate the file referenced by the URI.dart[uri_has_not_been_generated]

Even though I run the previous command, and also do a flutter clean and flutter pub get, those errors won't go away!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, curious. That's not a symptom I've seen. Please start a chat thread in #mobile-team and let's debug there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(For cross-reference: this turned out to be a newlines issue, of CRLF vs. LF.)

@sm-sayedi sm-sayedi force-pushed the issue-684-parse-topic-permalinks branch from a72eb7b to f28998c Compare June 11, 2024 17:34
Copy link
Collaborator

@rajveermalviya rajveermalviya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks and works great!
Moving on to mentor review, cc @hackerkid.

@rajveermalviya rajveermalviya added mentor review GSoC mentor review needed. and removed buddy review GSoC buddy review needed. labels Jun 12, 2024
@rajveermalviya rajveermalviya requested a review from hackerkid June 12, 2024 04:56
Copy link
Member

@hackerkid hackerkid left a 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 @sm-sayedi. Changes looks good to me :)

@hackerkid hackerkid added maintainer review PR ready for review by Zulip maintainers and removed mentor review GSoC mentor review needed. labels Jun 12, 2024
@sm-sayedi sm-sayedi requested a review from chrisbobbe June 13, 2024 04:13
Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @sm-sayedi!

One nit in the commit message, otherwise LGTM.

internal_link: Parse topic permalinks

These links (`/with/NNNN`) are just accepted and ignored in this PR,
they will be interpreted in #683.

Fixes: #684

The links themselves aren't accepted and ignored; it's only the with operator that's accepted and ignored. So for example (from the added test cases), /#narrow/pm-with/1,2-group/with/2 is interpreted as a DM narrow with users 1 and 2, just like /#narrow/pm-with/1,2-group would be.

I noticed some pre-existing disorganization and duplication in this file; I might try to clean things up as a followup once this is merged.

@gnprice
Copy link
Member

gnprice commented Jun 13, 2024

Thanks @sm-sayedi and reviewers!

This looks good, apart from the point Chris made above about the commit message. I'll fix that up and merge, so I can include this in the upcoming v0.0.16 release to get us all ready for starting to use this new API feature on the server.

This `with` operator (as in `/with/NNNN`) is just accepted and
ignored as of this change.  Interpreting them is zulip#683.

Fixes: zulip#684
@gnprice gnprice force-pushed the issue-684-parse-topic-permalinks branch from f28998c to ebb41b6 Compare June 13, 2024 23:39
@gnprice gnprice merged commit ebb41b6 into zulip:main Jun 13, 2024
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.

Parse topic permalinks
5 participants