@@ -20,27 +20,37 @@ type mockNotificationSettings struct {
2020 oneToOneChats string
2121 groupChats string
2222 personalMentions string
23- globalMentions string
24- allMessages string
25- messagePreview int
26- hasExemption bool
27- exMuteAllMessages bool
23+ globalMentions string
24+ allMessages string
25+ messagePreview int
26+ hasExemption bool
27+ exMuteAllMessages bool
2828 exPersonalMentions string
29- exGlobalMentions string
30- exOtherMessages string
29+ exGlobalMentions string
30+ exOtherMessages string
3131}
3232
33- func (m * mockNotificationSettings ) GetOneToOneChats () (string , error ) { return m .oneToOneChats , nil }
34- func (m * mockNotificationSettings ) GetGroupChats () (string , error ) { return m .groupChats , nil }
35- func (m * mockNotificationSettings ) GetPersonalMentions () (string , error ) { return m .personalMentions , nil }
36- func (m * mockNotificationSettings ) GetGlobalMentions () (string , error ) { return m .globalMentions , nil }
37- func (m * mockNotificationSettings ) GetAllMessages () (string , error ) { return m .allMessages , nil }
38- func (m * mockNotificationSettings ) GetMessagePreview () (int , error ) { return m .messagePreview , nil }
39- func (m * mockNotificationSettings ) HasExemption (id string ) (bool , error ) { return m .hasExemption , nil }
40- func (m * mockNotificationSettings ) GetExMuteAllMessages (id string ) (bool , error ) { return m .exMuteAllMessages , nil }
41- func (m * mockNotificationSettings ) GetExPersonalMentions (id string ) (string , error ) { return m .exPersonalMentions , nil }
42- func (m * mockNotificationSettings ) GetExGlobalMentions (id string ) (string , error ) { return m .exGlobalMentions , nil }
43- func (m * mockNotificationSettings ) GetExOtherMessages (id string ) (string , error ) { return m .exOtherMessages , nil }
33+ func (m * mockNotificationSettings ) GetOneToOneChats () (string , error ) { return m .oneToOneChats , nil }
34+ func (m * mockNotificationSettings ) GetGroupChats () (string , error ) { return m .groupChats , nil }
35+ func (m * mockNotificationSettings ) GetPersonalMentions () (string , error ) {
36+ return m .personalMentions , nil
37+ }
38+ func (m * mockNotificationSettings ) GetGlobalMentions () (string , error ) { return m .globalMentions , nil }
39+ func (m * mockNotificationSettings ) GetAllMessages () (string , error ) { return m .allMessages , nil }
40+ func (m * mockNotificationSettings ) GetMessagePreview () (int , error ) { return m .messagePreview , nil }
41+ func (m * mockNotificationSettings ) HasExemption (id string ) (bool , error ) { return m .hasExemption , nil }
42+ func (m * mockNotificationSettings ) GetExMuteAllMessages (id string ) (bool , error ) {
43+ return m .exMuteAllMessages , nil
44+ }
45+ func (m * mockNotificationSettings ) GetExPersonalMentions (id string ) (string , error ) {
46+ return m .exPersonalMentions , nil
47+ }
48+ func (m * mockNotificationSettings ) GetExGlobalMentions (id string ) (string , error ) {
49+ return m .exGlobalMentions , nil
50+ }
51+ func (m * mockNotificationSettings ) GetExOtherMessages (id string ) (string , error ) {
52+ return m .exOtherMessages , nil
53+ }
4454
4555func TestApplyMessagePreview (t * testing.T ) {
4656 title , message := "Alice" , "Hello there"
@@ -179,9 +189,9 @@ func TestShowMessageNotification_Exemptions(t *testing.T) {
179189 msg .ID , msg .ChatId , msg .Text , msg .From , msg .Mentioned = "m1" , chat .ID , "hi" , "0xabc" , true
180190 msg .MessageType = protobuf .MessageType_COMMUNITY_CHAT
181191 settings := & mockNotificationSettings {
182- personalMentions : notifValueSendAlerts ,
183- globalMentions : notifValueSendAlerts ,
184- hasExemption : true ,
192+ personalMentions : notifValueSendAlerts ,
193+ globalMentions : notifValueSendAlerts ,
194+ hasExemption : true ,
185195 exMuteAllMessages : true ,
186196 }
187197 got := showMessageNotification (settings , key .PublicKey , msg , chat , nil )
@@ -193,9 +203,9 @@ func TestShowMessageNotification_Exemptions(t *testing.T) {
193203 msg .ID , msg .ChatId , msg .Text , msg .From = "m1" , chat .ID , "hi" , "0xabc"
194204 msg .MessageType = protobuf .MessageType_COMMUNITY_CHAT
195205 settings := & mockNotificationSettings {
196- allMessages : notifValueSendAlerts ,
197- hasExemption : true ,
198- exOtherMessages : notifValueTurnOff ,
206+ allMessages : notifValueSendAlerts ,
207+ hasExemption : true ,
208+ exOtherMessages : notifValueTurnOff ,
199209 }
200210 got := showMessageNotification (settings , key .PublicKey , msg , chat , nil )
201211 require .False (t , got )
@@ -219,11 +229,11 @@ func TestShowMessageNotification_Exemptions(t *testing.T) {
219229 msg .ID , msg .ChatId , msg .Text , msg .From , msg .Mentioned = "m1" , chat .ID , "hi" , "0xabc" , true
220230 msg .MessageType = protobuf .MessageType_COMMUNITY_CHAT
221231 settings := & mockNotificationSettings {
222- personalMentions : notifValueSendAlerts ,
223- globalMentions : notifValueSendAlerts ,
224- hasExemption : true ,
225- exPersonalMentions : notifValueTurnOff ,
226- exGlobalMentions : notifValueTurnOff ,
232+ personalMentions : notifValueSendAlerts ,
233+ globalMentions : notifValueSendAlerts ,
234+ hasExemption : true ,
235+ exPersonalMentions : notifValueTurnOff ,
236+ exGlobalMentions : notifValueTurnOff ,
227237 }
228238 got := showMessageNotification (settings , key .PublicKey , msg , chat , nil )
229239 require .False (t , got )
@@ -235,8 +245,8 @@ func TestShowMessageNotification_Exemptions(t *testing.T) {
235245 msg .MessageType = protobuf .MessageType_COMMUNITY_CHAT
236246 settings := & mockNotificationSettings {
237247 personalMentions : notifValueTurnOff ,
238- globalMentions : notifValueTurnOff ,
239- hasExemption : true ,
248+ globalMentions : notifValueTurnOff ,
249+ hasExemption : true ,
240250 exPersonalMentions : notifValueSendAlerts ,
241251 }
242252 got := showMessageNotification (settings , key .PublicKey , msg , chat , nil )
@@ -248,9 +258,9 @@ func TestShowMessageNotification_Exemptions(t *testing.T) {
248258 msg .ID , msg .ChatId , msg .Text , msg .From , msg .Mentioned = "m1" , chat .ID , "hi" , "0xabc" , true
249259 msg .MessageType = protobuf .MessageType_COMMUNITY_CHAT
250260 settings := & mockNotificationSettings {
251- personalMentions : notifValueTurnOff ,
261+ personalMentions : notifValueTurnOff ,
252262 globalMentions : notifValueTurnOff ,
253- hasExemption : true ,
263+ hasExemption : true ,
254264 exGlobalMentions : notifValueSendAlerts ,
255265 }
256266 got := showMessageNotification (settings , key .PublicKey , msg , chat , nil )
0 commit comments