Skip to content

Commit

Permalink
Fix Things
Browse files Browse the repository at this point in the history
  • Loading branch information
theADAMJR committed Aug 9, 2021
1 parent cf4bf36 commit 7e8818b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
12 changes: 7 additions & 5 deletions backend/src/rest/apply-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ import { Message } from '../data/models/message';
import { router as authRoutes } from './routes/auth-routes';
import path from 'path';
import { loggedIn, updateUser } from './middleware';
import { User } from '../data/models/user';
import createError from 'http-errors';

export default (app: Express) => {
const prefix = process.env.API_PREFIX;

app.get(`${prefix}/channels/:channelId/messages`, async (req, res) => {
// v6: has access to the channel

app.get(`${prefix}/channels/:channelId/messages`, async (req, res, next) => {
// v6: validate has access to the channel
const userInGuild = await Guild.findOne({ channels: req.params.channelId as any });
if (!userInGuild)
return next(createError(401, 'Insufficient access'));

const messages = await Message.find({ channelId: req.params.channelId });
res.json(messages);
});
Expand Down Expand Up @@ -44,7 +47,6 @@ export default (app: Express) => {
});

// v7: guild members
// v6: validate has access to users
app.get(`${prefix}/users`, loggedIn, updateUser, async (req, res) => {
const user: Entity.User = res.locals.user;
const guilds = await Guild
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/guild-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const GuildPage: React.FunctionComponent = () => {
<div
style={{ height: 'calc(100vh - 48px)' }}
className="flex">
<TextBasedChannel />
{ui.activeChannel && <TextBasedChannel />}
<MemberList users={guild.members} />
</div>
</div>
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/theme/discord-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ textarea {
background-color: var(--bg-textarea);
}

a[href] {
a[href]:not(a > *:last-child) {
color: var(--link);
}
a > button {
color: inherit;
}
a.active {
background-color: var(--bg-modifier-selected);
color: var(--heading);
Expand Down

0 comments on commit 7e8818b

Please sign in to comment.