File tree Expand file tree Collapse file tree 4 files changed +17
-12
lines changed
src/software/aws/toolkits/jetbrains/core/notification
tst/software/aws/toolkits/jetbrains/core/notification Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -256,6 +256,7 @@ subprojects {
256
256
systemProperty(" ide.show.tips.on.startup.default.value" , false )
257
257
258
258
systemProperty(" aws.telemetry.skip_prompt" , " true" )
259
+ systemProperty(" aws.suppress_deprecation_prompt" , true )
259
260
ciOnly {
260
261
systemProperty(" aws.sharedCredentialsFile" , " /tmp/.aws/credentials" )
261
262
}
Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ class JetBrainsMinimumVersionChange : NoticeType {
23
23
override fun getSuppressNotificationValue (): String = ApplicationInfo .getInstance().fullVersion
24
24
25
25
override fun isNotificationSuppressed (previousSuppressNotificationValue : String? ): Boolean {
26
+ if (System .getProperty(SKIP_PROMPT , null )?.toBoolean() == true ) {
27
+ return true
28
+ }
26
29
previousSuppressNotificationValue?.let {
27
30
return previousSuppressNotificationValue == getSuppressNotificationValue()
28
31
}
@@ -33,4 +36,9 @@ class JetBrainsMinimumVersionChange : NoticeType {
33
36
34
37
override fun getNoticeContents (): NoticeContents = noticeContents
35
38
override fun getNoticeType (): NotificationType = NotificationType .WARNING
39
+
40
+ private companion object {
41
+ // Used by tests to make sure the prompt never shows up
42
+ const val SKIP_PROMPT = " aws.suppress_deprecation_prompt"
43
+ }
36
44
}
Original file line number Diff line number Diff line change @@ -48,16 +48,9 @@ class DefaultNoticeManager :
48
48
/* *
49
49
* Returns the notices that require notification
50
50
*/
51
- override fun getRequiredNotices (notices : List <NoticeType >, project : Project ): List <NoticeType > = notices.filter { it.isNotificationRequired() }
52
- .filter {
53
- internalState[it.id]?.let { state ->
54
- state.noticeSuppressedValue?.let { previouslySuppressedValue ->
55
- return @filter ! it.isNotificationSuppressed(previouslySuppressedValue)
56
- }
57
- }
58
-
59
- true
60
- }
51
+ override fun getRequiredNotices (notices : List <NoticeType >, project : Project ): List <NoticeType > = notices
52
+ .filter { it.isNotificationRequired() }
53
+ .filter { ! it.isNotificationSuppressed(internalState[it.id]?.noticeSuppressedValue) }
61
54
62
55
override fun notify (notices : List <NoticeType >, project : Project ) {
63
56
notices.forEach { notify(it, project) }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package software.aws.toolkits.jetbrains.core.notification
6
6
import com.intellij.testFramework.ProjectRule
7
7
import com.nhaarman.mockitokotlin2.eq
8
8
import com.nhaarman.mockitokotlin2.mock
9
+ import com.nhaarman.mockitokotlin2.spy
9
10
import com.nhaarman.mockitokotlin2.times
10
11
import com.nhaarman.mockitokotlin2.verify
11
12
import com.nhaarman.mockitokotlin2.whenever
@@ -47,13 +48,15 @@ class NoticeManagerTest {
47
48
}
48
49
49
50
@Test
50
- fun nonSerializedNoticeDoesRequiresNotification () {
51
- val notice = createSampleNotice(true , true )
51
+ fun nonSerializedNoticeCallsIsNotificationSuppressed () {
52
+ val notice = spy( createSampleNotice(requiresNotification = true , isNotificationSuppressed = false ) )
52
53
53
54
val notices = sut.getRequiredNotices(listOf (notice), projectRule.project)
54
55
55
56
assertThat(notices).hasSize(1 )
56
57
assertThat(notices).contains(notice)
58
+
59
+ verify(notice).isNotificationSuppressed(null )
57
60
}
58
61
59
62
@Test
You can’t perform that action at this time.
0 commit comments