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
Create abaquery forum #4446
Conversation
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 👍 |
e75a62c
to
a401cf3
Compare
There was a problem hiding this 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.
|
||
return ( | ||
thread && ( | ||
<LoadingIndicator loading={fetchingThreads && fetchingComments}> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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 👍 |
41049f7
to
edbfeb9
Compare
feb49b8
to
0d300cd
Compare
I rebased and fixed your comments - updated screenshots @ivarnakken |
I like that!
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 |
caab7ea
to
e0f8249
Compare
e0f8249
to
8ab8093
Compare
Alright, backend is pushed and should be good. |
There was a problem hiding this 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', | ||
}, |
There was a problem hiding this comment.
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?
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, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete this?
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, | ||
}); | ||
} |
There was a problem hiding this comment.
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/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint: '/threads/', | |
endpoint: `/forums/${forumId}/threads/`, |
export function editThread(thread: UpdateThread) { | ||
return callAPI({ | ||
types: Thread.UPDATE, | ||
endpoint: `/threads/${thread.id}/`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
endpoint: `/threads/${thread.id}/`, | |
endpoint: `/forums/${forumId}/threads/${threadId}`, |
{(thread.createdBy?.id === currentUser.id || | ||
detailActionGrant.includes('edit')) && ( |
There was a problem hiding this comment.
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
{(thread.createdBy?.id === currentUser.id || | |
detailActionGrant.includes('edit')) && ( | |
{detailActionGrant.includes('edit')) && ( |
const { threadId } = useParams<{ threadId: string }>(); | ||
const { forumId } = useParams<{ forumId: string }>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { threadId } = useParams<{ threadId: string }>(); | |
const { forumId } = useParams<{ forumId: string }>(); | |
const { forumId, threadId } = useParams<{ forumId: string, threadId: string }>(); |
const ForumRoute = () => ( | ||
<Routes> | ||
<Route index element={<ForumList />} /> | ||
<Route path=":forumId/threads" element={<ForumDetail />} /> |
There was a problem hiding this comment.
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
<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 />} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Route path=":forumId/new" element={<ThreadEditor />} /> | |
<Route path=":forumId/threads/new" element={<ThreadEditor />} /> |
69a10db
to
4b2a2ec
Compare
As mentioned in the backend PR I think I'll merge this for now and resolve all the other comments in the next sprint. |
4b2a2ec
to
a21b0d2
Compare
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:
(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
Caution
Make sure your images do not contain any real user information.
Testing
Please describe what and how the changes have been tested, and provide instructions to reproduce if necessary.
Resolves ABA-561