Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openimsdk/openim-sdk-core
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: openimsdk/openim-sdk-core
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: release-v3.8
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
Loading
Showing with 2,360 additions and 1,759 deletions.
  1. BIN .DS_Store
  2. +78 −0 .github/workflows/changelog.yml
  3. +66 −0 .github/workflows/cleanup-after-milestone-prs-merged.yml
  4. +133 −0 .github/workflows/merge-from-milestone.yml
  5. +1 −1 .github/workflows/release.yml
  6. +0 −1 .gitignore
  7. +34 −52 .goreleaser.yaml
  8. +0 −62 CHANGELOG/.chglog/CHANGELOG.tpl.md
  9. +0 −81 CHANGELOG/.chglog/config.yml
  10. +0 −42 CHANGELOG/CHANGELOG-1.0.md
  11. 0 CHANGELOG/CHANGELOG-1.1.md
  12. +0 −92 CHANGELOG/CHANGELOG-2.0.md
  13. +0 −23 CHANGELOG/CHANGELOG-2.1.md
  14. +0 −24 CHANGELOG/CHANGELOG-2.2.md
  15. +0 −32 CHANGELOG/CHANGELOG-2.3.md
  16. +0 −52 CHANGELOG/CHANGELOG-2.9.md
  17. +0 −128 CHANGELOG/CHANGELOG-3.0.md
  18. +0 −4 Makefile
  19. 0 {CHANGELOG → docs}/CHANGELOG.md
  20. +36 −10 go.mod
  21. +84 −20 go.sum
  22. +0 −4 integration_test/internal/pkg/reerrgroup/errgroup.go
  23. +55 −104 internal/conversation_msg/api.go
  24. +186 −129 internal/conversation_msg/conversation.go
  25. +56 −158 internal/conversation_msg/conversation_msg.go
  26. +211 −0 internal/conversation_msg/conversion.go
  27. +1 −15 internal/conversation_msg/delete.go
  28. +1 −4 internal/conversation_msg/entering.go
  29. +249 −112 internal/conversation_msg/message_check.go
  30. +168 −0 internal/conversation_msg/message_check_test.go
  31. +85 −85 internal/conversation_msg/notification.go
  32. +4 −4 internal/conversation_msg/read_drawing.go
  33. +10 −16 internal/conversation_msg/revoke.go
  34. +5 −3 internal/group/cache.go
  35. +5 −0 internal/group/group.go
  36. +5 −1 internal/group/notification.go
  37. +2 −0 internal/interaction/long_conn_mgr.go
  38. +75 −15 internal/interaction/msg_sync.go
  39. +24 −2 internal/relation/relation.go
  40. +2 −2 internal/relation/sync.go
  41. +7 −6 internal/third/log.go
  42. +1 −52 internal/user/api.go
  43. +3 −2 internal/user/full_sync.go
  44. +34 −14 internal/user/user.go
  45. +21 −6 open_im_sdk/caller.go
  46. +4 −0 open_im_sdk/conversation_msg.go
  47. +17 −0 pkg/cache/cache.go
  48. +49 −0 pkg/cache/conversation_seq_cache.go
  49. +0 −106 pkg/cache/manager.go
  50. +129 −0 pkg/cache/user_cache.go
  51. +11 −11 pkg/constant/constant.go
  52. +53 −32 pkg/db/chat_log_model.go
  53. +21 −0 pkg/db/chat_log_model_test.go
  54. +6 −0 pkg/db/conversation_model.go
  55. +0 −3 pkg/db/db_init.go
  56. +2 −3 pkg/db/db_interface/databse.go
  57. +0 −2 pkg/db/db_js.go
  58. +1 −1 pkg/db/group_member_model.go
  59. +21 −53 pkg/db/model_struct/data_model_struct.go
  60. +0 −40 pkg/db/temp_cache_chat_log_model.go
  61. +11 −2 pkg/sdk_params_callback/conversation_msg_sdk_struct.go
  62. +1 −0 pkg/sdkerrs/code.go
  63. +1 −0 pkg/sdkerrs/predefine.go
  64. +37 −39 sdk_struct/sdk_struct.go
  65. +1 −1 test/config.go
  66. +45 −1 test/conversation_test.go
  67. +5 −1 test/init.go
  68. +4 −0 test/listener.go
  69. +20 −0 test/long_conn_test.go
  70. +198 −0 tools/changelog/changelog.go
  71. +9 −1 version/version.go
  72. +1 −0 wasm/cmd/main.go
  73. +0 −4 wasm/cmd/static/wasm_exec.js
  74. +0 −45 wasm/indexdb/cache_message.go
  75. +48 −55 wasm/indexdb/chat_log_model.go
  76. +17 −0 wasm/indexdb/conversation_model.go
  77. +0 −1 wasm/indexdb/init.go
  78. +6 −0 wasm/wasm_wrapper/wasm_conversation_msg.go
Binary file added .DS_Store
Binary file not shown.
78 changes: 78 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release Changelog

on:
release:
types: [released]

permissions:
contents: write
pull-requests: write

jobs:
update-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run Go Changelog Generator
run: |
# Run the Go changelog generator, passing the release tag if available
if [ "${{ github.event.release.tag_name }}" = "latest" ]; then
go run tools/changelog/changelog.go > "${{ github.event.release.tag_name }}-changelog.md"
else
go run tools/changelog/changelog.go "${{ github.event.release.tag_name }}" > "${{ github.event.release.tag_name }}-changelog.md"
fi
- name: Handle changelog files
run: |
# Ensure that the CHANGELOG directory exists
mkdir -p CHANGELOG
# Extract Major.Minor version by removing the 'v' prefix from the tag name
TAG_NAME=${{ github.event.release.tag_name }}
CHANGELOG_VERSION_NUMBER=$(echo "$TAG_NAME" | sed 's/^v//' | grep -oP '^\d+\.\d+')
# Define the new changelog file path
CHANGELOG_FILENAME="CHANGELOG-$CHANGELOG_VERSION_NUMBER.md"
CHANGELOG_PATH="CHANGELOG/$CHANGELOG_FILENAME"
# Check if the changelog file for the current release already exists
if [ -f "$CHANGELOG_PATH" ]; then
# If the file exists, append the new changelog to the existing one
cat "$CHANGELOG_PATH" >> "${TAG_NAME}-changelog.md"
# Overwrite the existing changelog with the updated content
mv "${TAG_NAME}-changelog.md" "$CHANGELOG_PATH"
else
# If the changelog file doesn't exist, rename the temp changelog file to the new changelog file
mv "${TAG_NAME}-changelog.md" "$CHANGELOG_PATH"
# Ensure that README.md exists
if [ ! -f "CHANGELOG/README.md" ]; then
echo -e "# CHANGELOGs\n\n" > CHANGELOG/README.md
fi
# Add the new changelog entry at the top of the README.md
if ! grep -q "\[$CHANGELOG_FILENAME\]" CHANGELOG/README.md; then
sed -i "3i- [$CHANGELOG_FILENAME](./$CHANGELOG_FILENAME)" CHANGELOG/README.md
# Remove the extra newline character added by sed
# sed -i '4d' CHANGELOG/README.md
fi
fi
- name: Clean up
run: |
# Remove any temporary files that were created during the process
rm -f "${{ github.event.release.tag_name }}-changelog.md"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update CHANGELOG for release ${{ github.event.release.tag_name }}"
title: "Update CHANGELOG for release ${{ github.event.release.tag_name }}"
body: "This PR updates the CHANGELOG files for release ${{ github.event.release.tag_name }}"
branch: changelog-${{ github.event.release.tag_name }}
base: main
delete-branch: true
labels: changelog
66 changes: 66 additions & 0 deletions .github/workflows/cleanup-after-milestone-prs-merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Cleanup After Milestone PRs Merged

on:
pull_request:
types:
- closed

jobs:
handle_pr:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4.2.0

- name: Get the PR title and extract PR numbers
id: extract_pr_numbers
run: |
# Get the PR title
PR_TITLE="${{ github.event.pull_request.title }}"
echo "PR Title: $PR_TITLE"
# Extract PR numbers from the title
PR_NUMBERS=$(echo "$PR_TITLE" | grep -oE "#[0-9]+" | tr -d '#' | tr '\n' ' ')
echo "Extracted PR Numbers: $PR_NUMBERS"
# Save PR numbers to a file
echo "$PR_NUMBERS" > pr_numbers.txt
echo "Saved PR Numbers to pr_numbers.txt"
# Check if the title matches the specific pattern
if echo "$PR_TITLE" | grep -qE "\[Created by @.+ from #[0-9]+\]$"; then
echo "proceed=true" >> $GITHUB_OUTPUT
else
echo "proceed=false" >> $GITHUB_OUTPUT
fi
- name: Use extracted PR numbers and label PRs
if: (steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')) && github.event.pull_request.merged == true
run: |
# Read the previously saved PR numbers
PR_NUMBERS=$(cat pr_numbers.txt)
echo "Using extracted PR Numbers: $PR_NUMBERS"
# Loop through each PR number and add label
for PR_NUMBER in $PR_NUMBERS; do
echo "Adding 'cherry-picked' label to PR #$PR_NUMBER"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/labels \
-d '{"labels":["cherry-picked"]}'
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Delete branch after PR close
if: steps.extract_pr_numbers.outputs.proceed == 'true' || contains(github.event.pull_request.labels.*.name, 'milestone-merge')
continue-on-error: true
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
echo "Branch to delete: $BRANCH_NAME"
git push origin --delete "$BRANCH_NAME"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133 changes: 133 additions & 0 deletions .github/workflows/merge-from-milestone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Create Pre-Release PR from Milestone

permissions:
contents: write
pull-requests: write
issues: write

on:
workflow_dispatch:
inputs:
milestone_name:
description: "Milestone name to collect closed PRs from"
required: true
default: "v3.8.3"
target_branch:
description: "Target branch to merge the consolidated PR"
required: true
default: "pre-release-v3.8.3"

env:
MILESTONE_NAME: ${{ github.event.inputs.milestone_name || 'v3.8.3' }}
TARGET_BRANCH: ${{ github.event.inputs.target_branch || 'pre-release-v3.8.3' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
LABEL_NAME: cherry-picked
TEMP_DIR: /tmp # Using /tmp as the temporary directory

jobs:
merge_milestone_prs:
runs-on: ubuntu-latest
steps:
- name: Setup temp directory
run: |
# Create the temporary directory and initialize necessary files
mkdir -p ${{ env.TEMP_DIR }}
touch ${{ env.TEMP_DIR }}/pr_numbers.txt
touch ${{ env.TEMP_DIR }}/commit_hashes.txt
touch ${{ env.TEMP_DIR }}/pr_title.txt
touch ${{ env.TEMP_DIR }}/pr_body.txt
touch ${{ env.TEMP_DIR }}/created_pr_number.txt
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}

- name: Setup Git User for OpenIM-Robot
run: |
git config --global user.email "OpenIM-Robot@users.noreply.github.com"
git config --global user.name "OpenIM-Robot"
- name: Fetch Milestone ID and Filter PR Numbers
env:
MILESTONE_NAME: ${{ env.MILESTONE_NAME }}
run: |
# Fetch milestone details and extract milestone ID
milestones=$(curl -s -H "Authorization: token $BOT_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/milestones")
milestone_id=$(echo "$milestones" | grep -B3 "\"title\": \"$MILESTONE_NAME\"" | grep '"number":' | head -n1 | grep -o '[0-9]\+')
if [ -z "$milestone_id" ]; then
echo "Milestone '$MILESTONE_NAME' not found. Exiting."
exit 1
fi
echo "Milestone ID: $milestone_id"
echo "MILESTONE_ID=$milestone_id" >> $GITHUB_ENV
# Fetch issues for the milestone
issues=$(curl -s -H "Authorization: token $BOT_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/issues?milestone=$milestone_id&state=closed&per_page=100")
> ${{ env.TEMP_DIR }}/pr_numbers.txt
# Filter PRs that do not have the 'cherry-picked' label
for pr_number in $(echo "$issues" | jq -r '.[] | select(.pull_request != null) | .number'); do
labels=$(curl -s -H "Authorization: token $BOT_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/$pr_number/labels" | jq -r '.[].name')
if ! echo "$labels" | grep -q "${LABEL_NAME}"; then
echo "PR #$pr_number does not have the 'cherry-picked' label. Adding to the list."
echo "$pr_number" >> ${{ env.TEMP_DIR }}/pr_numbers.txt
fi
done
sort -n ${{ env.TEMP_DIR }}/pr_numbers.txt -o ${{ env.TEMP_DIR }}/pr_numbers.txt
- name: Create Individual PRs
run: |
for pr_number in $(cat ${{ env.TEMP_DIR }}/pr_numbers.txt); do
pr_details=$(curl -s -H "Authorization: token $BOT_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/pulls/$pr_number")
pr_title=$(echo "$pr_details" | jq -r '.title')
pr_body=$(echo "$pr_details" | jq -r '.body')
pr_creator=$(echo "$pr_details" | jq -r '.user.login')
merge_commit=$(echo "$pr_details" | jq -r '.merge_commit_sha')
short_commit_hash=$(echo "$merge_commit" | cut -c 1-7)
if [ "$merge_commit" != "null" ];then
git fetch origin
git checkout $TARGET_BRANCH
git pull origin $TARGET_BRANCH
cherry_pick_branch="cherry-pick-${short_commit_hash}"
git checkout -b $cherry_pick_branch
git cherry-pick "$merge_commit" --strategy=recursive -X theirs || git cherry-pick --continue
git remote set-url origin "https://${BOT_TOKEN}@github.com/${{ github.repository }}.git"
git push origin $cherry_pick_branch --force
new_pr_title="$pr_title [Created by @$pr_creator from #$pr_number]"
new_pr_body="$pr_body
>This PR is created from original PR #$pr_number."
response=$(curl -s -X POST -H "Authorization: token $BOT_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/pulls \
-d "$(jq -n --arg title "$new_pr_title" \
--arg head "$cherry_pick_branch" \
--arg base "$TARGET_BRANCH" \
--arg body "$new_pr_body" \
'{title: $title, head: $head, base: $base, body: $body}')")
new_pr_number=$(echo "$response" | jq -r '.number')
echo "Created PR #$new_pr_number"
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
-d '{"labels": ["milestone-merge"]}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$new_pr_number/labels"
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
distribution: goreleaser
version: latest
workdir: .
args: release --clean --release-footer-tmpl=scripts/template/footer.md.tmpl --release-header-tmpl=scripts/template/head.md.tmpl
args: release --clean
env:
USERNAME: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -55,7 +55,6 @@ deploy/Open-IM-SDK-Core
# Dependency directories (remove the comment below to include it)
vendor/
bin/
tools/
tmp/


Loading