Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create abaquery forum #4446

Merged
merged 4 commits into from Feb 26, 2024
Merged

Create abaquery forum #4446

merged 4 commits into from Feb 26, 2024

Conversation

jonasdeluna
Copy link
Member

@jonasdeluna jonasdeluna commented Feb 6, 2024

Description

Create abaquery forum, now working MVP.
There is still more I want to add, refer to linear. For now this is a very basic working forum (Like the notification on @ someone, subscribe to threads, and better content options beside just text)

Styling is not my strong suit, so all the sideborder colors on the threads are blue, which is kind of ugly, but I wasn't sure what to put because it should probably be different from the forums.
Maybe the color can be defined for each thread/forum? But that could also create a lot of chaos.

For now I added it to the hamburger menu. Maybe it should be more visible like in the top bar, but we also don't want too much clutter there.

I added a hover effect on comments that shows when they were created:

image

(If you're wondering why I'm using edge as my dev browser now it's because all other browsers for some reason doesn't work with cookies so I get auto-logged out and everything breaks)

I think this is a good opportunity to allow others to in the very least remove other comments with enough permissions, maybe restricted to forums but I could see it useful for articles as well.

Thread creation is IsAuthenticated, forum creation is some sort of admin (ref lego PR)
As per now, I believe everyone has the actiongrant for thread.create and thread.edit because everyone is allowed to create threads, and edit their own. Not sure how to perform a check for permission to delete/edit others' threads or if this should be a thing. I feel like someone will definitely shitpost and it needs to be deleted so having to shell would be a PITA.

Also adding reactions to comments could be a quick way to implement the karma system (more about this on linear) @haukkagu

Depends on: webkom/lego#3549

*EDIT: Update the content of a thread to be a lego-editor content. Not sure about opinions on this, but at least the content is formattable now.

Result

image

image

image

image

image

image

image

image

  • Changes look good on both light and dark theme.
  • Changes look good with different viewports (mobile, tablet, etc.).
  • Changes look good with slower Internet connections.

Caution

Make sure your images do not contain any real user information.

Description Before After
... ... ...

Testing

  • I have thoroughly tested my changes.

Please describe what and how the changes have been tested, and provide instructions to reproduce if necessary.


Resolves ABA-561

@jonasdeluna jonasdeluna added the new-feature Pull requests that introduce a new feature label Feb 6, 2024
@github-actions github-actions bot added the review-needed Pull requests that need review label Feb 6, 2024
Copy link

linear bot commented Feb 7, 2024

@ivarnakken
Copy link
Member

Would you like any reviews on this while it is still a draft?

@jonasdeluna
Copy link
Member Author

Would you like any reviews on this while it is still a draft?

If you have any feedback already that would be appreciated, though I'm working on finishing an MVP on this soon so if you haven't read through it I think it would be better to review after the MVP 👍

@jonasdeluna jonasdeluna marked this pull request as ready for review February 18, 2024 21:42
@jonasdeluna jonasdeluna self-assigned this Feb 18, 2024
Copy link
Member

@ivarnakken ivarnakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very interesting feature! Good job! 🏅

We should perhaps consider just calling this "Forum" instead of "AbaQuery" though.

app/store/createRootReducer.ts Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadEditor.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadDetail.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadDetail.tsx Outdated Show resolved Hide resolved

return (
thread && (
<LoadingIndicator loading={fetchingThreads && fetchingComments}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to show loading indicator if threads or comments is not empty in the redux store. Consider using skeleton components <3

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I'll have a look after the other things are resolved on how to implement this.

app/routes/forum/components/ThreadList.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadEditor.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadEditor.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ThreadEditor.tsx Outdated Show resolved Hide resolved
app/routes/forum/components/ForumListEntry.tsx Outdated Show resolved Hide resolved
@ivarnakken ivarnakken requested a review from a team February 19, 2024 07:58
@ivarnakken ivarnakken added the changes-requested Pull requests with requested changes label Feb 19, 2024
@ivarnakken
Copy link
Member

I realize that I made a lot of comments - so don't feel like you have to resolve all of them. Feel free to iterate on it in a new PR later 😄

@jonasdeluna
Copy link
Member Author

I realize that I made a lot of comments - so don't feel like you have to resolve all of them. Feel free to iterate on it in a new PR later 😄

Ill go through and try to fix them 👍
What do you think about changing description to a Lego editor for more formatting on the body of a thread. I pushed it but can be reverted if it's not wanted

@jonasdeluna
Copy link
Member Author

jonasdeluna commented Feb 20, 2024

I rebased and fixed your comments - updated screenshots @ivarnakken
I think it's good for a MVP.
Another sort of important thing I want to add is stickying but we can also test this in staging perhaps before that...
Or should it get more features before pushing out?

@ivarnakken
Copy link
Member

What do you think about changing description to a Lego editor for more formatting on the body of a thread. I pushed it but can be reverted if it's not wanted

I like that!

Another sort of important thing I want to add is stickying but we can also test this in staging perhaps before that...
Or should it get more features before pushing out?

This is a great MVP! If you want we can probably merge this in 😄 I'd love to get some more views on this new feature though.


Are you planning on migrating threads from the slack channel? I believe we have saved most (or a lot) through the Matrix clone

@jonasdeluna jonasdeluna force-pushed the create-abaquery-forum branch 2 times, most recently from caab7ea to e0f8249 Compare February 23, 2024 15:23
@jonasdeluna
Copy link
Member Author

This is a great MVP! If you want we can probably merge this in 😄 I'd love to get some more views on this new feature though.

Are you planning on migrating threads from the slack channel? I believe we have saved most (or a lot) through the Matrix clone

Alright, backend is pushed and should be good.
Sure we could try migrating them if we have an export already.
The structure is a little different though, as a "thread" here is not a slack-channel but maybe its actually 1:1?
Forum - Channel
Message/Thread - Thread?
I think we can do it after merging in so case?

Copy link
Member

@norbye norbye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for reviewing a little late - but here we are(:

Ended up being a few more comments than I planned for, and as this is becoming a kinda chunky PR I'll leave it as approved if you want to merge it as the first iterations. But if you have the time it would be awesome if you just skim over the comments to see if we agree

Edit: one of the things you might want to look at before merging anyways are the changes you made to components under the articles route - but as long as your changes are unique to the forums functionality I'd say go for it if you want to

schema: forumSchema,
meta: {
errorMessage: 'Opprettelse av forum feilet',
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason why you only added requiresAuthentication to the first two endpoints?

Comment on lines +80 to +91
export function fetchThreads() {
return callAPI<PublicThread[]>({
types: Thread.FETCH_ALL,
endpoint: '/threads/',
schema: [threadSchema],
method: 'GET',
meta: {
errorMessage: 'Henting av tråder feilet',
},
propagateError: true,
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this?

Comment on lines +106 to +116
export function fetchThread(threadId: ID) {
return callAPI<DetailedThread>({
types: Thread.FETCH,
endpoint: `/threads/${threadId}/`,
schema: threadSchema,
meta: {
errorMessage: 'Henting av tråd feilet',
},
propagateError: true,
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this?

export function createThread(thread: CreateThread) {
return callAPI<DetailedThread>({
types: Thread.CREATE,
endpoint: '/threads/',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endpoint: '/threads/',
endpoint: `/forums/${forumId}/threads/`,

export function editThread(thread: UpdateThread) {
return callAPI({
types: Thread.UPDATE,
endpoint: `/threads/${thread.id}/`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
endpoint: `/threads/${thread.id}/`,
endpoint: `/forums/${forumId}/threads/${threadId}`,

Comment on lines +48 to +49
{(thread.createdBy?.id === currentUser.id ||
detailActionGrant.includes('edit')) && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood your backend-changes correctly, actionGrant should include the first line if it matches the permissions.py thingy, which I hope it does

Suggested change
{(thread.createdBy?.id === currentUser.id ||
detailActionGrant.includes('edit')) && (
{detailActionGrant.includes('edit')) && (

Comment on lines +35 to +36
const { threadId } = useParams<{ threadId: string }>();
const { forumId } = useParams<{ forumId: string }>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { threadId } = useParams<{ threadId: string }>();
const { forumId } = useParams<{ forumId: string }>();
const { forumId, threadId } = useParams<{ forumId: string, threadId: string }>();

app/routes/forum/components/ThreadEditor.tsx Outdated Show resolved Hide resolved
const ForumRoute = () => (
<Routes>
<Route index element={<ForumList />} />
<Route path=":forumId/threads" element={<ForumDetail />} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm knitpicking at a pretty serious level - but this feels more natural idk

Suggested change
<Route path=":forumId/threads" element={<ForumDetail />} />
<Route path=":forumId" element={<ForumDetail />} />

<Route path=":forumId/threads" element={<ForumDetail />} />
<Route path="new" element={<ForumEditor />} />
<Route path=":forumId/edit" element={<ForumEditor />} />
<Route path=":forumId/new" element={<ThreadEditor />} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Route path=":forumId/new" element={<ThreadEditor />} />
<Route path=":forumId/threads/new" element={<ThreadEditor />} />

@jonasdeluna jonasdeluna force-pushed the create-abaquery-forum branch 2 times, most recently from 69a10db to 4b2a2ec Compare February 26, 2024 16:49
@jonasdeluna
Copy link
Member Author

As mentioned in the backend PR I think I'll merge this for now and resolve all the other comments in the next sprint.

@jonasdeluna jonasdeluna merged commit 0d01ead into master Feb 26, 2024
4 checks passed
@jonasdeluna jonasdeluna deleted the create-abaquery-forum branch February 26, 2024 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes-requested Pull requests with requested changes new-feature Pull requests that introduce a new feature review-needed Pull requests that need review
Projects
None yet
3 participants