Slack: Check if muteUnfurlPromptsUntil timestamp is after now and don't show this setting if that is the case

Created on 14 May 2018  ยท  8Comments  ยท  Source: integrations/slack

Most helpful comment

Yep, that's exactly right ๐Ÿ‘

(or maybe I'm overthinking this and should just play with it and observe the behavior... ๐Ÿ˜„)

I don't blame you haha! It's an unreasonable amount of effort to get this running locally ๐Ÿ™ˆ

All 8 comments

Is this still relevant? If so, just comment with any updates and we'll leave it open. Otherwise, if there is no further activity, it will be closed.

yep

On Fri, Jul 13, 2018 at 7:25 PM stale[bot] notifications@github.com wrote:

Is this still relevant? If so, just comment with any updates and we'll
leave it open. Otherwise, if there is no further activity, it will be
closed.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/integrations/slack/issues/575#issuecomment-404805778,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHXHLlaBIqDYTZgG8BW-SkfNuaTN85-mks5uGIOogaJpZM4T9kLC
.

@wilhelmklopp ๐Ÿ‘‹

I want to try and tackle this, but I just want clarification. When you say _check if muteUnfurlPromptsUntil timestamp is_ after now, do you mean something like:

if ((this.muteUnfurlPromptsUntil > moment.unix()) || this.muteUnfurlPromptsIndefinitely) {
  // ignore this, don't show setting...
}

(basically I just want to find out what I'm doing in that conditional in your original comment)

@doms ๐Ÿ‘‹

Ah good catch! I think I mean exactly the opposite. We don't want to show the setting if the current unix timestamp is higher than the this.muteUnfurlPromptsUntil value and this.muteUnfurlPromptsIndefinitely is not set.

Since that would suggest that a user has decided to mute for say 24h, but we still give them the option in the settings to "remove the mute" even though that has already happened.

Let me know how you get on! I believe there is some _time-related_ oddness in some of the tests around this logic.

@wilhelmklopp cool, thanks for the clarification!

So rather than the snippet in my previous comment, instead we would want:

if ((this.muteUnfurlPromptsUntil < moment.unix()) && !this.muteUnfurlPromptsIndefinitely) {
  // don't show setting...
}

where this.muteUnfurlPromptsUntil is _less than_ moment.unix() and this.muteUnfurlPromptsIndefinitely is negated since we are expecting it to not be set? ๐Ÿค” (or maybe I'm overthinking this and should just play with it and observe the behavior... ๐Ÿ˜„)

Yep, that's exactly right ๐Ÿ‘

(or maybe I'm overthinking this and should just play with it and observe the behavior... ๐Ÿ˜„)

I don't blame you haha! It's an unreasonable amount of effort to get this running locally ๐Ÿ™ˆ

@wilhelmklopp

I think I'm almost ready to push this up, I just need to fix the tests! You were right about there being some _time-related_ oddness ๐Ÿ˜„

Do I need to update the failing snapshots? I did some digging through the jest snapshot testing docs because no matter what I did, the tests didn't pass, then I realized, maybe the behavior is right, but the snapshots need to be updated! (since its expecting the _old_ value in the *-test.js.snap file)

I'm not sure if this could be remedied with just changing the logic of the tests, or if updating the snapshots is a must. ๐Ÿค”

Happy to take a look at a WIP PR of what you have right now on Monday ๐Ÿ‘

On Fri, Sep 7, 2018, 22:01 Dominic notifications@github.com wrote:

@wilhelmklopp https://github.com/wilhelmklopp

I think I'm almost ready to push this up, I just need to fix the tests!
You were right about there being some time-related oddness ๐Ÿ˜„

Do I need to update the failing snapshots? I did some digging through
the jest snapshot testing docs
https://jestjs.io/docs/en/snapshot-testing.html because no matter what
I did, the tests didn't pass, then I realized, maybe the behavior is right,
but the snapshots need to be updated! (since its expecting the old
value in the *-test.js.snap file)

I'm not sure if this could be remedied with just changing the logic of the
tests, or if updating the snapshots is a must. ๐Ÿค”

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/integrations/slack/issues/575#issuecomment-419564695,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHXHLjCENvBPUnhs1ny8omLV7pOVmdGRks5uYt6hgaJpZM4T9kLC
.

Was this page helpful?
0 / 5 - 0 ratings