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

[HOLD for payment 2023-05-16] Add custom renderer for user mentions #17885

Closed
puneetlath opened this issue Apr 24, 2023 · 39 comments
Closed

[HOLD for payment 2023-05-16] Add custom renderer for user mentions #17885

puneetlath opened this issue Apr 24, 2023 · 39 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 NewFeature Something to build that is a new item.

Comments

@puneetlath
Copy link
Contributor

As part of the mentions project, we will be adding a custom renderer called MentionUserRenderer for the tag. The custom renderer will be similar to the AnchorRenderer.

The details of the implementation are described in the doc here.

@puneetlath puneetlath added Daily KSv2 NewFeature Something to build that is a new item. labels Apr 24, 2023
@puneetlath puneetlath self-assigned this Apr 24, 2023
@MelvinBot
Copy link

Current assignee @puneetlath is eligible for the NewFeature assigner, not assigning anyone new.

@robertKozik
Copy link
Contributor

Hi 👋🏼 I'm from Software Mansion and I'll handle this task

@MelvinBot

This comment was marked as off-topic.

@puneetlath
Copy link
Contributor Author

Ok great @robertKozik. I have assigned you to the issue and shared the design doc with you. Please feel free to hit me up here or in slack if you have any questions!

@puneetlath
Copy link
Contributor Author

puneetlath commented Apr 28, 2023

@robertKozik if you want to test this, the easiest way will be to:

  1. Add the changes from this PR in App/node_modules/expensify-common/lib/ExpensiMark.js. That will make it so that when you type @here or @user@domain.com it gets the <mention-here> or <mention-user> html tags added.
  2. Force the app offline. This way when you send a message it'll just show the optimistic message, not the one returned by the server. This is because the server will strip any html tags it doesn't recognize (we just merged a PR to allow these two, so it won't be live for another few days)

2023-04-27_21-17-33

@robertKozik
Copy link
Contributor

Thats way more convenient than what I used to do (patching the ReportActionItemFragment to replace all occurances). Thanks!

@robertKozik
Copy link
Contributor

robertKozik commented Apr 28, 2023

Hey Hey, two follow up questions:

  1. In the mockups in design doc the tooltip which turn on after hovering the user mention includes user profile image. The snippet of userMentionRenderer does not include it. Is it still in the scope for the Before EC3 version?
  2. User mentions which comes from the ExpensiMark does not include fields like login (as stated in design doc), it's only: <mention-user>@user@mail</mention-user> Is it intended and the login handle is only provided inside the body of the HTML tag, or It's just due to that I've only applied changes inside ExpensiMark ?

@puneetlath
Copy link
Contributor Author

Great questions.

  1. Given that we're using primary logins, I think we can skip the tooltip altogether for the before EC3 portion of mentions. I don't think any tooltip is needed. We just need to make sure that the profile page is opened when you click on a mention.

image

  1. Yes, for now there won't be a login attribute. There won't be any html attributes. Just the text between the tags.

@robertKozik
Copy link
Contributor

Thanks for answers, today I should create the PR with it.

@puneetlath
Copy link
Contributor Author

Awesome!

@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Apr 28, 2023
@robertKozik
Copy link
Contributor

robertKozik commented Apr 28, 2023

Hi! Sadly I didn't finish it :/ I've encountered two problems:

  1. When I've patched the ExpensiMark file, on Safari browser app is not loading for me and gets following error. Looks like safari can't handle new regex, but I'm not sure about it.

image

  1. Android native app can't render mention when it's wrapped in Pressable component. Only after refreshing the code, mentions are appearing

image

I'll investigate it further @puneetlath

@puneetlath
Copy link
Contributor Author

Hmm, interesting. It looks like our custom renderer for Anchor tags also returns a component wrapped in a Pressable.

@getusha
Copy link
Contributor

getusha commented May 1, 2023

When I've patched the ExpensiMark file, on Safari browser app is not loading for me and gets following error. Looks like safari can't handle new regex, but I'm not sure about it.

Hi @robertKozik
It seems like negative look behind regex group is not supported on safari browser yet, i will investigate and update the PR with the necessary changes.

@puneetlath
Copy link
Contributor Author

@robertKozik I just wanted to check in and see how this is going.

@robertKozik
Copy link
Contributor

Sorry, I was OOO most of the time. I've checked the android issue on the physical device and now it work as it should be, maybe that was a problem with my simulator. I'll check today one more just to be sure, and tomorrow PR will be ready to review, hopefully alongside the @here mention renderer as it is very similar

@puneetlath
Copy link
Contributor Author

Awesome!

@robertKozik
Copy link
Contributor

I've pushed PR to review. Problems with android were indeed corelated with usage of Pressable component. The Anchor renderer uses the PressableWithSecondaryInteraction with inline prop – it determines usage of Text rather than Pressable, as it causes problem with positioning of rendered fragment.

I've used newest implementation of ExpensiMark changes, it works on every browser, although now it cannot recognise properly when mention handle has the . before the at sign @. F.E. my mail: @robert.kozik@swmansion.com renders as mail rather than mention. Is it intended?
CC. @puneetlath @getusha

@puneetlath
Copy link
Contributor Author

Nice! Reviewing asap.

Yes, it is intended that only certain characters are allowed directly before the @ sign in a mention and . is not one of them.

@puneetlath
Copy link
Contributor Author

Just merged.

@robertKozik
Copy link
Contributor

Great! I'll follow up with the here mention renderer soon

@robertKozik
Copy link
Contributor

As the PR needs to be reverted due to android problems, what is the correct way to go with this? Do we pivot to the non-rounded mentions for now?

@puneetlath
Copy link
Contributor Author

puneetlath commented May 5, 2023

Ok I reverted the PR. This issue is the problem.

I'm going to chat internally and see what the best path forward is here.

@robertKozik
Copy link
Contributor

That catch me off guard 😢 I could have sworn that It was working for me while testing...

Let me know if you will know what next, with the work we do already here reverting to the more simple colouring will be an ease and would take no time

@parasharrajat
Copy link
Member

@puneetlath Please assign this issue to me as C+.

I think we can just use no border-radius and padding solution for now. When the inline-code block PR is fixed, we can swap that.

@getusha
Copy link
Contributor

getusha commented May 5, 2023

That catch me off guard 😢 I could have sworn that It was working for me while testing...

Let me know if you will know what next, with the work we do already here reverting to the more simple colouring will be an ease and would take no time

Is there any alternative of using InlineCodeBlock? it's the only issue right now. the issue is unpredictable it works sometimes but won't work suddenly, but most of the time it's not working.

@puneetlath
Copy link
Contributor Author

Ok @robertKozik @parasharrajat I chatted internally and let's go back to using styled text so it will look good on most devices and just accept that it will be ugly on Android in some scenarios.

So back to what you had originally that had this problem:
Screenshot 2023-05-04 at 11 24 37 AM

And then when Expensify/react-native#43 is merged, the issue should resolve itself.

@puneetlath
Copy link
Contributor Author

Sorry for all the flip-flopping!

@robertKozik
Copy link
Contributor

Alright, It will hopefully need only reverting commits, so I'll do it right away, create new PR and test it

And then when Expensify/react-native#43 is merged, the issue should resolve itself.

Not quite itself, as it will introduce new prop for such styling. But follow-up pr would need only to move style to another prop.

@puneetlath
Copy link
Contributor Author

Sounds great and that makes sense. Thanks @robertKozik

@robertKozik
Copy link
Contributor

Created draft PR for that, just want to check it on all platforms and I'll change it to ready cc. @parasharrajat

@parasharrajat
Copy link
Member

I will check this tomorrow daytime. Night..Night...

@parasharrajat
Copy link
Member

PR is not yet ready for review.

@robertKozik
Copy link
Contributor

Sorry, forgot to change it 😄

@puneetlath
Copy link
Contributor Author

Merged again!

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 9, 2023
@melvin-bot melvin-bot bot changed the title Add custom renderer for user mentions [HOLD for payment 2023-05-16] Add custom renderer for user mentions May 9, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 9, 2023

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot
Copy link

melvin-bot bot commented May 9, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.12-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-05-16. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 15, 2023
@puneetlath
Copy link
Contributor Author

@puneetlath
Copy link
Contributor Author

All paid. Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Daily KSv2 NewFeature Something to build that is a new item.
Projects
None yet
Development

No branches or pull requests

5 participants