further social improvements, client-render edge cases

This commit is contained in:
41666 2019-03-21 08:13:58 -05:00
parent dd07e6bac4
commit 1c784d0605
4 changed files with 9 additions and 7 deletions

View file

@ -26,16 +26,22 @@ export default ($: AppContext) => ({
const { userId } = (ctx.session: { userId: string }) const { userId } = (ctx.session: { userId: string })
const srv = $.discord.client.guilds.get(id) const srv = $.discord.client.guilds.get(id)
if (srv == null) { if (srv == null) {
return { err: 'not_found' } return { err: 'not_found' }
} }
if (userId == null) {
return {
id: id,
server: $.P.serverSlug(srv)
}
}
let gm let gm
if (srv.members.has(userId)) { if (srv.members.has(userId)) {
gm = $.discord.gm(id, userId) gm = $.discord.gm(id, userId)
} else if ($.discord.isRoot(userId)) { } else if ($.discord.isRoot(userId)) {
// gm = $.discord.fakeGm({ id: userId }) gm = $.discord.fakeGm({ id: userId })
} }
if (gm == null) { if (gm == null) {

View file

@ -34,7 +34,7 @@ const Hider = styled.div`
class Server extends React.Component<ServerPageProps> { class Server extends React.Component<ServerPageProps> {
static async getInitialProps (ctx: *, rpc: *, router: *) { static async getInitialProps (ctx: *, rpc: *, router: *) {
const isDiscordBot = ctx.req.headers['user-agent'].includes('Discordbot') const isDiscordBot = ctx.req && ctx.req.headers['user-agent'].includes('Discordbot')
if (ctx.user == null) { if (ctx.user == null) {
if (!isDiscordBot) { if (!isDiscordBot) {
redirect(ctx, `/auth/login?r=${router.asPath}`) redirect(ctx, `/auth/login?r=${router.asPath}`)

View file

@ -129,10 +129,6 @@ export default class AuthLogin extends React.Component<AuthLoginProps, AuthLogin
redirect(ctx, r || '/') redirect(ctx, r || '/')
} }
if (ctx.req.headers['user-agent'].contains('Discordbot')) {
redirect(ctx, '/_internal/_discordbot/_login')
}
ctx.robots = 'NOINDEX, NOFOLLOW' ctx.robots = 'NOINDEX, NOFOLLOW'
if (r != null) { if (r != null) {

BIN
ui/static/social.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB