Repository navigation
feat(community): Discord 分享按 Discord id 归到本人账号 - #61
Merged
Merged
Conversation
机器人渠道以前只传昵称,所有链接都挂在 discord-bridge 名下,昵称会改、会重名, 对不上是谁分享的,绑定了 Discord 的人也看不到自己的分享。 - shared_links 新增 discord_user_id(schema.sql 建表 + ADD COLUMN IF NOT EXISTS, test-schema 同步;init.sql 本来就不建这张表) - InternalShareRequest 新增可选 discordUserId,controller 校验纯数字(≤20 位) - submitInternal:Discord id 绑定到可用账号时记为 submitter,否则仍挂 discord-bridge; id 一律落库,没绑定的人日后可按 id 改挂 - 网页每日限频只数网页提交,Discord 里的分享不占配额 - 修正 controller 注释:这个接口其实公网可达,只靠 X-Internal-Key 把门 不传 discordUserId 的旧 bot 行为不变;Jackson 忽略未知字段,新 bot 配旧后端也不报错。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
为什么
机器人渠道以前只传分享人的 Discord 昵称,所有链接都挂在
discord-bridge系统账号名下。昵称会改、会重名,所以对不上是谁分享的;绑定了 Discord 的人在「我的分享」里也看不到自己在群里分享的链接。改了什么
shared_links新增可空列discord_user_id:schema.sql 里建表时就带上,再加一句ADD COLUMN IF NOT EXISTS兼容已有库;test-schema 同步;init.sql 本来就不建这张表。InternalShareRequest新增可选字段discordUserId,controller 校验必须是纯数字且不超过 20 位,否则返回 400。submitInternal:如果这个 Discord id 通过user_identities绑定到了一个可用账号,就记为 submitter;否则仍挂discord-bridge。id 一律落库,没绑定的人以后绑定了,可以按 id 把链接改挂过去。countBySubmitterSince)只数网页提交。机器人渠道本身就不限频,已绑定的人在群里分享不应该占网页配额。X-Internal-Key。兼容性
discordUserId,行为和以前完全一样。验证
./mvnw -o test:353 个全部通过,其中新增 6 个集成测试,分别覆盖已绑定、未绑定、账号禁用、不传 id、id 非法、配额不受影响。和 #57 只有一处文本冲突:两边在
UserIdentityService的同一位置各加了一行 import,后合并的一方保留两行即可。配套的 ChatBot PR:InvolutionHell/ChatBot(feat/discord-share-attribution)。
🤖 Generated with Claude Code