mirror of https://github.com/halo-dev/halo
perf: associate ghost user with posts on user deletion. (#3293)
#### What type of PR is this? /kind bug #### What this PR does / why we need it: 文章发布用户被删除后,设置这篇文章的发布人为Ghost #### Which issue(s) this PR fixes: Fixes #3265 ```release-note NONE ```pull/3314/head^2
parent
26f29b20c7
commit
e485acef66
|
@ -13,4 +13,11 @@ public class Contributor {
|
|||
private String displayName;
|
||||
private String avatar;
|
||||
private String name;
|
||||
|
||||
public static Contributor getGhost() {
|
||||
Contributor contributor = new Contributor();
|
||||
contributor.setName("ghost");
|
||||
contributor.setDisplayName("已删除用户");
|
||||
return contributor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,7 +231,8 @@ public class PostServiceImpl extends AbstractContentService implements PostServi
|
|||
contributor.setDisplayName(user.getSpec().getDisplayName());
|
||||
contributor.setAvatar(user.getSpec().getAvatar());
|
||||
return contributor;
|
||||
});
|
||||
})
|
||||
.defaultIfEmpty(Contributor.getGhost());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue