mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-24 15:20:21 +08:00
fix: add username to comments
This commit is contained in:
parent
d91435db57
commit
085d808817
@ -1,5 +1,6 @@
|
|||||||
const APIError = require("../api/APIError");
|
const APIError = require("../api/APIError");
|
||||||
const FSNodeParam = require("../api/filesystem/FSNodeParam");
|
const FSNodeParam = require("../api/filesystem/FSNodeParam");
|
||||||
|
const { get_user } = require("../helpers");
|
||||||
const configurable_auth = require("../middleware/configurable_auth");
|
const configurable_auth = require("../middleware/configurable_auth");
|
||||||
const { Endpoint } = require("../util/expressutil");
|
const { Endpoint } = require("../util/expressutil");
|
||||||
const BaseService = require("./BaseService");
|
const BaseService = require("./BaseService");
|
||||||
@ -98,6 +99,9 @@ class CommentService extends BaseService {
|
|||||||
uid: comment.uid,
|
uid: comment.uid,
|
||||||
text: comment.text,
|
text: comment.text,
|
||||||
created: comment.created_at,
|
created: comment.created_at,
|
||||||
|
user: {
|
||||||
|
username: comment.user?.username,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +153,12 @@ class CommentService extends BaseService {
|
|||||||
[await node.get('mysql-id')],
|
[await node.get('mysql-id')],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for ( const comment of comments ) {
|
||||||
|
const user_id = comment.user_id;
|
||||||
|
const user = await get_user({ id: user_id });
|
||||||
|
comment.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
return comments;
|
return comments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user