0xasahi / neogroup

Donation: https://ko-fi.com/neogroup
https://neogrp.club/
MIT License
12 stars 5 forks source link

profile链接的一些修改 #18

Closed 0xasahi closed 1 year ago

0xasahi commented 1 year ago

@anig1scur 这个先别合并,借着这个PR问一个JS的问题,我想把小组页面右侧“最近加入”的人的profile链接也改成 neogroup 里的 profile 链接,但是貌似无法读取到 mastodon_username ,这个部分求指教

就是这段代码 https://github.com/0xasahi/neogroup/pull/18/files#diff-4377e19b4a2c5e360657f8f4c2a13e759fad605966648c87b3e94a77a7a5852eR14

anig1scur commented 1 year ago

@anig1scur 这个先别合并,借着这个PR问一个JS的问题,我想把小组页面右侧“最近加入”的人的profile链接也改成 neogroup 里的 profile 链接,但是貌似无法读取到 mastodon_username ,这个部分求指教

就是这段代码 #18 (files)

mastodon_usernamemastodon_account 是同级的,修改一下这里的 map 就行,console.log 大法好 ~

https://github.com/0xasahi/neogroup/pull/18/files#diff-4377e19b4a2c5e360657f8f4c2a13e759fad605966648c87b3e94a77a7a5852eL6

anig1scur commented 1 year ago

https://github.com/0xasahi/neogroup/blob/993150b21e71bf8604c36eccf1304b5e9cc0386b/group/schema.py#L9-L25

这个结构是有一点点混乱 ,当时让 copilot 给我按照 User model 生成的 ....

0xasahi commented 1 year ago

mastodon_usernamemastodon_account 是同级的,修改一下这里的 map 就行,console.log 大法好 ~

我有试着读取 mastodon_username ,但貌似是读不到的?

accounts 变量 似乎是只能拿到 mastodon_account ?

const accounts = last_join_users.map(u => u.user.mastodon_account)
anig1scur commented 1 year ago

我有试着读取 mastodon_username ,但貌似是读不到的?

accounts 变量 似乎是只能拿到 mastodon_account ?

const accounts = last_join_users.map(u => u.user.mastodon_account)

确定么? 应该是这样没问题的。。

const accounts = last_join_users.map(u => u.user)

然后 console.log 看下 accounts 的结构

user -- mastodon_username | ---- mastodon_account

0xasahi commented 1 year ago

const accounts = last_join_users.map(u => u.user)

原来如此,之前没敢这么改,我修复了,可以再 review 一下 https://github.com/0xasahi/neogroup/pull/18/commits/b68a5da8ca4a4d4e33736453b0f498ddfc85f39d