Skip to content

Commit 7cc373b

Browse files
committed
chore: Lint branch
1 parent 104b743 commit 7cc373b

File tree

4 files changed

+50
-40
lines changed

4 files changed

+50
-40
lines changed

protocol/communities_messenger_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,9 +386,9 @@ func (s *MessengerCommunitiesSuite) TestJoinCommunity() {
386386
s.Require().Len(response.Communities()[0].Categories(), 1)
387387
s.Require().Len(response.notifications, 1)
388388
for _, notification := range response.notifications {
389-
s.Require().Equal(notification.Title, community.Name())
390-
s.Require().EqualValues(notification.BodyType, localnotifications.CategoryCommunityJoined)
391-
s.Require().EqualValues(notification.Category, localnotifications.CategoryCommunityJoined)
389+
s.Require().Equal(community.Name(), notification.Title)
390+
s.Require().EqualValues(localnotifications.TypeMessage, notification.BodyType)
391+
s.Require().EqualValues(localnotifications.CategoryCommunityJoined, notification.Category)
392392
}
393393

394394
var categoryID string

protocol/local_notifications_test.go

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4555
func 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)

protocol/messenger.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ func (r *ReceivedMessageState) addNewMessageNotification(messenger *Messenger, s
28142814
}
28152815
}
28162816

2817-
if !chat.Muted {
2817+
if !chat.Muted {
28182818
if showMessageNotification(settings, publicKey, msg, chat, responseTo) {
28192819
messagePreview := messagePreviewNameAndMessage
28202820
if settings != nil {
@@ -2967,8 +2967,8 @@ func (m *Messenger) buildMessageState() *ReceivedMessageState {
29672967
c, _ := m.communitiesManager.GetByIDString(communityID)
29682968
return c
29692969
},
2970-
AllBookmarks: make(map[string]*browsers.Bookmark),
2971-
AllTrustStatus: make(map[string]verification.TrustStatus),
2970+
AllBookmarks: make(map[string]*browsers.Bookmark),
2971+
AllTrustStatus: make(map[string]verification.TrustStatus),
29722972
}
29732973
}
29742974

services/local-notifications/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const (
44
CategoryMessage PushCategory = "newMessage"
55
CategoryGroupInvite PushCategory = "groupInvite"
66
CategoryCommunityRequestToJoin PushCategory = "communityRequestToJoin"
7-
CategoryCommunityJoined PushCategory = "communityJoined"
7+
CategoryCommunityJoined PushCategory = "communityJoined"
88
CategoryContactRequest PushCategory = "contactRequest"
99

1010
TypeMessage NotificationType = "message"

0 commit comments

Comments
 (0)