fix (backend): hide remote user's reactions and network (following/followers) in case it's set to hidden on their end
This commit is contained in:
parent
27be8e06cb
commit
517022f9b2
4 changed files with 20 additions and 2 deletions
|
@ -528,8 +528,11 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
pinnedPage: profile!.pinnedPageId
|
||||
? Pages.pack(profile!.pinnedPageId, me)
|
||||
: null,
|
||||
publicReactions: profile!.publicReactions,
|
||||
ffVisibility: profile!.ffVisibility,
|
||||
// TODO: federate publicReactions
|
||||
publicReactions:
|
||||
user.host == null ? profile!.publicReactions : false,
|
||||
// TODO: federate ffVisibility
|
||||
ffVisibility: user.host == null ? profile!.ffVisibility : "private",
|
||||
twoFactorEnabled: profile!.twoFactorEnabled,
|
||||
usePasswordLessLogin: profile!.usePasswordLessLogin,
|
||||
securityKeys: UserSecurityKeys.countBy({
|
||||
|
|
|
@ -90,6 +90,11 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
|
||||
const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
|
||||
|
||||
// TODO: federate ffVisibility
|
||||
if (profile.userHost != null) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
}
|
||||
|
||||
if (profile.ffVisibility === "private") {
|
||||
if (me == null || me.id !== user.id) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
|
|
|
@ -89,6 +89,11 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
|
||||
const profile = await UserProfiles.findOneByOrFail({ userId: user.id });
|
||||
|
||||
// TODO: federate ffVisibility
|
||||
if (profile.userHost != null) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
}
|
||||
|
||||
if (profile.ffVisibility === "private") {
|
||||
if (me == null || me.id !== user.id) {
|
||||
throw new ApiError(meta.errors.forbidden);
|
||||
|
|
|
@ -49,6 +49,11 @@ export const paramDef = {
|
|||
export default define(meta, paramDef, async (ps, me) => {
|
||||
const profile = await UserProfiles.findOneByOrFail({ userId: ps.userId });
|
||||
|
||||
// TODO: federate publicReactions
|
||||
if (profile.userHost != null) {
|
||||
throw new ApiError(meta.errors.reactionsNotPublic);
|
||||
}
|
||||
|
||||
if (!profile.publicReactions && (me == null || me.id !== ps.userId)) {
|
||||
throw new ApiError(meta.errors.reactionsNotPublic);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue