Skip to content

Commit e706950

Browse files
authored
Fix: solve conversation blocking in private chat when non friendship. (#2542)
* refactor: refactor workflows contents. * add tool workflows. * update field. * fix: remove chat error. * Fix err. * fix error. * remove cn comment. * update workflows files. * update infra config. * move workflows. * feat: update bot. * fix: solve uncorrect outdated msg get. * update get docIDs logic. * update * update skip logic. * fix * update. * fix: update contribute cla. * fix: solve conversations bug.
1 parent 0af207b commit e706950

File tree

4 files changed

+32
-22
lines changed

4 files changed

+32
-22
lines changed

.github/workflows/cla-assistant.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
remote-repository-name: cla
3434
create-file-commit-message: 'Creating file for storing CLA Signatures'
3535
# signed-commit-message: '$contributorName has signed the CLA in $owner/$repo#$pullRequestNo'
36-
custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our [CLA Docs](https://github.com/OpenIM-Robot/cla/blob/main/README.md)'
37-
custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
38-
custom-allsigned-prcomment: '🤖 All Contributors have signed the [CLA](https://github.com/OpenIM-Robot/cla/blob/main/README.md).<br> The signed information is recorded [🤖here](https://github.com/openim-sigs/cla/tree/main/signatures/cla.json)'
36+
custom-notsigned-prcomment: '💕 Thank you for your contribution and please kindly read and sign our CLA. [CLA Docs](https://github.com/OpenIM-Robot/cla/blob/main/README.md)'
37+
custom-pr-sign-comment: 'I have read the CLA Document and I hereby sign the CLA'
38+
custom-allsigned-prcomment: '🤖 All Contributors have signed the [CLA](https://github.com/OpenIM-Robot/cla/blob/main/README.md).<br> The signed information is recorded [**here**](https://github.com/OpenIM-Robot/cla/blob/main/signatures/cla.json)'
3939
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
4040
#use-dco-flag: true - If you are using DCO instead of CLA

CONTRIBUTING-zh_CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ git push origin fix-bug-123
7777
### 9. 签署 CLA
7878
如果这是你第一次提交 PR,你需要在 PR 的评论中回复:
7979
```
80-
The signature to be committed in order to sign the CLA
80+
I have read the CLA Document and I hereby sign the CLA
8181
```
8282

8383
### 编程规范

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Go to your fork on GitHub and click the "Pull Request" button. Ensure the PR des
7575
### 9. Sign the CLA
7676
If this is your first time submitting a PR, you will need to reply in the comments of the PR:
7777
```
78-
The signature to be committed in order to sign the CLA
78+
I have read the CLA Document and I hereby sign the CLA
7979
```
8080

8181
### Programming Standards

internal/rpc/conversation/conversaion.go

+27-17
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
247247
}
248248
conv = *cs[0]
249249
}
250+
250251
var conversation dbModel.Conversation
251252
conversation.ConversationID = req.Conversation.ConversationID
252253
conversation.ConversationType = req.Conversation.ConversationType
@@ -259,12 +260,14 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
259260
unequal++
260261
}
261262
}
263+
262264
if req.Conversation.AttachedInfo != nil {
263265
m["attached_info"] = req.Conversation.AttachedInfo.Value
264266
if req.Conversation.AttachedInfo.Value != conv.AttachedInfo {
265267
unequal++
266268
}
267269
}
270+
268271
if req.Conversation.Ex != nil {
269272
m["ex"] = req.Conversation.Ex.Value
270273
if req.Conversation.Ex.Value != conv.Ex {
@@ -277,24 +280,48 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
277280
unequal++
278281
}
279282
}
283+
280284
if req.Conversation.GroupAtType != nil {
281285
m["group_at_type"] = req.Conversation.GroupAtType.Value
282286
if req.Conversation.GroupAtType.Value != conv.GroupAtType {
283287
unequal++
284288
}
285289
}
290+
286291
if req.Conversation.MsgDestructTime != nil {
287292
m["msg_destruct_time"] = req.Conversation.MsgDestructTime.Value
288293
if req.Conversation.MsgDestructTime.Value != conv.MsgDestructTime {
289294
unequal++
290295
}
291296
}
297+
292298
if req.Conversation.IsMsgDestruct != nil {
293299
m["is_msg_destruct"] = req.Conversation.IsMsgDestruct.Value
294300
if req.Conversation.IsMsgDestruct.Value != conv.IsMsgDestruct {
295301
unequal++
296302
}
297303
}
304+
305+
if req.Conversation.BurnDuration != nil {
306+
m["burn_duration"] = req.Conversation.BurnDuration.Value
307+
if req.Conversation.BurnDuration.Value != conv.BurnDuration {
308+
unequal++
309+
}
310+
}
311+
312+
if len(m) != 0 {
313+
if err := c.conversationDatabase.SetUsersConversationFieldTx(ctx, req.UserIDs, &conversation, m); err != nil {
314+
return nil, err
315+
}
316+
}
317+
318+
if unequal > 0 {
319+
for _, v := range req.UserIDs {
320+
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
321+
}
322+
return &pbconversation.SetConversationsResp{}, nil
323+
}
324+
298325
if req.Conversation.IsPrivateChat != nil && req.Conversation.ConversationType != constant.ReadGroupChatType {
299326
var conversations []*dbModel.Conversation
300327
for _, ownerUserID := range req.UserIDs {
@@ -313,23 +340,6 @@ func (c *conversationServer) SetConversations(ctx context.Context, req *pbconver
313340
}
314341
}
315342

316-
if req.Conversation.BurnDuration != nil {
317-
m["burn_duration"] = req.Conversation.BurnDuration.Value
318-
if req.Conversation.BurnDuration.Value != conv.BurnDuration {
319-
unequal++
320-
}
321-
}
322-
323-
if err := c.conversationDatabase.SetUsersConversationFieldTx(ctx, req.UserIDs, &conversation, m); err != nil {
324-
return nil, err
325-
}
326-
327-
if unequal > 0 {
328-
for _, v := range req.UserIDs {
329-
c.conversationNotificationSender.ConversationChangeNotification(ctx, v, []string{req.Conversation.ConversationID})
330-
}
331-
}
332-
333343
return &pbconversation.SetConversationsResp{}, nil
334344
}
335345

0 commit comments

Comments
 (0)