mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: fix star
This commit is contained in:
7 files changed
+24
-47
No files matched your search
@@ -338,15 +338,10 @@ class DiscussionDetailHandler extends DiscussionHandler {
|
||||
}
|
||||
|
||||
@param('did', Types.ObjectId)
|
||||
async postStar(domainId: string, did: ObjectId) {
|
||||
await discussion.setStar(domainId, did, this.user._id, true);
|
||||
this.back({ star: true });
|
||||
}
|
||||
|
||||
@param('did', Types.ObjectId)
|
||||
async postUnstar(domainId: string, did: ObjectId) {
|
||||
await discussion.setStar(domainId, did, this.user._id, false);
|
||||
this.back({ star: false });
|
||||
@param('star', Types.Boolean)
|
||||
async postStar(domainId: string, did: ObjectId, star = false) {
|
||||
await discussion.setStar(domainId, did, this.user._id, star);
|
||||
this.back({ star });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -499,15 +499,11 @@ class HomeDomainHandler extends Handler {
|
||||
}
|
||||
|
||||
@param('id', Types.String)
|
||||
async postStar(domainId: string, id: string) {
|
||||
await user.setById(this.user._id, { pinnedDomains: [...this.user.pinnedDomains, id] });
|
||||
this.back({ star: true });
|
||||
}
|
||||
|
||||
@param('id', Types.String)
|
||||
async postUnstar(domainId: string, id: string) {
|
||||
await user.setById(this.user._id, { pinnedDomains: this.user.pinnedDomains.filter((i) => i !== id) });
|
||||
this.back({ star: false });
|
||||
@param('star', Types.Boolean)
|
||||
async postStar({ }, id: string, star = false) {
|
||||
if (star) await user.setById(this.user._id, { pinnedDomains: [...this.user.pinnedDomains, id] });
|
||||
else user.setById(this.user._id, { pinnedDomains: this.user.pinnedDomains.filter((i) => i !== id) });
|
||||
this.back({ star });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user