-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Prevent users blocked from concierge from sending messages #2932
Conversation
placeholder="Write something..." | ||
placeholder={ | ||
isBlockedFromConcierge | ||
? 'Communication is barred' |
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.
Do we need to add these to a translation file?
src/libs/actions/User.js
Outdated
@@ -168,6 +174,13 @@ function validateLogin(accountID, validateCode) { | |||
}); | |||
} | |||
|
|||
function isBlockedFromConcierge(expiresAt) { | |||
const now = moment().format('YYYY-MM-DD'); | |||
const expires = moment(expiresAt).format('YYYY-MM-DD'); |
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.
Just an observation but it's kinda odd we only block based on the day, and not the time. Looking at the code in Web-E where we block users, if we block them 2 days or a week but only use the day, effectively they'll be blocked less than that.
Oops, sorry I forgot that e.cash automatically assigns a reviewer. I was planning on making a few big changes here 😬 |
Off hold! |
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 was trying to double check the format of the NVP private_blockedFromConcierge
but the permabanned account you mention in the tests doesn't exist in 1Password, can you check it's in the correct vault please?
* @param {String} expiresAt | ||
* @returns {boolean} | ||
*/ | ||
function isBlockedFromConcierge(expiresAt) { |
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 method pretty much just compares a date with now
, could it be generalized and moved to DateUtils?
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.
Given that I'm just using the super simple one liner you gave below, i don't think we need to put it in dateUtils
src/libs/actions/User.js
Outdated
const now = moment() | ||
.format('YYYY-MM-DD'); | ||
const expires = moment(expiresAt) | ||
.format('YYYY-MM-DD'); | ||
|
||
return now < expires; |
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 feel like this can be simplified with moment's comparison methods, i.e. the whole method can be rewritten to something like
!_.isNull(expiresAt) && moment().isBefore(moment(expiresAt));
or to only use the date and not the time,
... moment().isBefore(moment(expiresAt), 'day');
There's a small conflict now FYI :) |
RIP. Thanks i'll take a look |
I can see how that might have been confusing haha. The password is literally |
🤦 Haha yikes ok, I see now. Thanks! |
…s-preventBlockedUserMessages
Updated! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
I'm seeing this error on main:
|
Hm well that's not great. Looking into it |
🚀 Deployed to staging in version: 1.0.73-4🚀
|
🚀 Deployed to production in version: 1.0.74-0🚀
|
Details
This takes the blocking functionality currently on web and moves it to e.cash. If the user is blocked from concierge and tries to chat with them, all buttons and the compose box should be disabled.
Fixed Issues
https://github.com/Expensify/Expensify/issues/158313
Tests/QA
Tested On
Screenshots
Web
Mobile Web
Desktop
iOS
Android