Commit graph

132 commits

Author SHA1 Message Date
Ben Wheeler
8d38d7d4e5 Revert "Merge pull request #2859 from benjiwheeler/comments-for-project-endpoint"
This reverts commit 07417846a9, reversing
changes made to 32484656ba.
2019-04-04 15:04:36 -04:00
Ben Wheeler
9b485cd16c Revert "Merge pull request #2871 from benjiwheeler/pass-ownerusername-to-comment-replies-endpoint"
This reverts commit afe6d6f4a4, reversing
changes made to c00b4fb189.
2019-04-04 15:04:27 -04:00
Ben Wheeler
f1dfeab399 pass ownerUsername in three places it was left out 2019-04-02 17:25:00 -04:00
Ben Wheeler
dd51cf4ea6 pass token to comments endpoints every time, not only if user is admin 2019-03-25 14:21:06 -04:00
Ben Wheeler
163741f34e add ownerUsername to comment API endpoint URIs; handle error responses from those endpoints 2019-03-25 13:40:12 -04:00
Ben Wheeler
49df9a6386 split admin and non-admin project studios endpoints 2019-03-23 10:03:51 -04:00
Ben Wheeler
986c608136 make token optional in call to getProjectStudios endpoint 2019-03-22 15:43:00 -04:00
Ben Wheeler
4a20a09f52 change studios for project endpoint to include owner, token 2019-03-21 21:11:14 -04:00
Paul Kaplan
4e8ea5c3bd Get thumbnails from the project for reporting 2019-02-15 14:27:36 -05:00
Paul Kaplan
49afbd2c70 Use a dummy form submission instead of logging out via xhr.
This fixes an issue where you could get logged out but then remain on your page by dismissing the window.onbeforeunload prompt when you have unsaved changes. That would put you in a state where you looked logged in but could not save.
2019-02-11 10:08:38 -05:00
Paul Kaplan
16391f25ee Strip out duplicates from replies and comments.
Fixes https://github.com/LLK/scratch-www/issues/2575
2019-01-10 13:49:07 -05:00
Paul Kaplan
f7e8922757 Allow loading more than 20 replies 2019-01-10 10:46:01 -05:00
Ben Wheeler
8e1d6fee54 love and favorite proxy, and use x-requested-with header 2019-01-07 11:39:31 -05:00
Paul Kaplan
3c7b090a1f Change the endpoint for loading single comments 2018-12-14 14:03:18 -05:00
Ben Wheeler
634d6c93e0 if remix parent or original is unshared, don't crash project page 2018-12-12 13:24:41 -05:00
Ben Wheeler
8dd239ebe5 use authorUsername, not users own username, in hitting logProjectView endpoint; use cookie and tokens in request 2018-12-07 11:00:43 -05:00
Ben Wheeler
5c3300dd68 pass onGreenFlag to GUI; when called, call API to register project view 2018-12-06 23:06:27 -05:00
Ben Wheeler
dab1be812e handle update project metadata errors without setting body 2018-12-04 15:47:21 -05:00
Paul Kaplan
172915f9d9 Add project thumbnail update action 2018-11-29 09:55:45 -05:00
Paul Kaplan
0b8c13fb40 Use the project author username in visibility request instead of viewer
/ht @chrisgarrity
2018-11-21 10:31:10 -05:00
Paul Kaplan
122160726d Show details about why a project is not public
Follow up the project info request with a request to the visibility endpoint to find out if the project is trashed or censored. The project just not being published is handled by the existing code.

This PR generalizes the ShareBanner to a more generic "Banner" that is then filled with the relevant content.
2018-11-20 12:01:52 -05:00
Paul Kaplan
3fe1242aa6 Allow user to exit "single comment mode" and see all comments.
This visually appears like a "load more comments" button for now, but has the impact of unsetting the #comments-<id> hash in the url and resetting the comment state, showing all the comments (in paginated view)
2018-11-19 15:47:47 -05:00
Paul Kaplan
f8d598549d Update instead of replacing project info to match API.
The API endpoint will return just the updated slice of the projectInfo, so just update the projectInfo instead of replacing.
2018-11-13 12:23:05 -05:00
Paul Kaplan
3a03f10aff Move sharing to special endpoint.
This makes a couple of assumptions about the shape of the endpoint:
- Route is /proxy/projects/:id/share.
- Returns the full (updated) project info on success, just like the project update endpoint does.

I reviewed these with colby since this is frontrunning the actual API, but I can update once the API is finalized.
2018-11-13 08:49:37 -05:00
Paul Kaplan
ae05f07e07 Fix project not available flag setting and catch 404 responses 2018-11-08 08:43:36 -05:00
Paul Kaplan
315c8b78fc Add "project not available" view for when project body cannot be loaded
This happens when the project id does not exist, or is not visible to the given user.
2018-11-07 16:32:12 -05:00
Paul Kaplan
fa7c2d5b09
Merge pull request #2230 from paulkaplan/single-comment-mode
Showing specific comment by url hash on preview
2018-10-24 15:41:14 -04:00
Paul Kaplan
5158907c5b
Merge pull request #2229 from paulkaplan/sudo-fix-load-more
Do not rely on total comment number for load more functionality
2018-10-24 11:42:00 -04:00
Paul Kaplan
520018ee50 View single thread of comments by URL hash 2018-10-24 10:29:33 -04:00
Paul Kaplan
ae626d5244 Do not rely on total comment number for load more functionality
Show the load more comments button any time the last comment page was filled to the requested limit. As noted in the comment, this heuristic will be wrong at most 5% of the time but the failure mode (showing load more which, when clicked doesn't load any more, just goes away) is very mild, and for the overwhelming majority of project views that happen on projects with many, many comments, this is very unlikely to ever be noticed. It obviously isn't a perfect solution, but I cannot think of another that does not need the server to do another query to find out the total number of visible comments, or to find out if there are more comments after the requested offset+limit.
2018-10-24 09:18:45 -04:00
Paul Kaplan
efb1a380da Update the comment routes 2018-10-24 08:55:36 -04:00
Benjamin Wheeler
a6409bbcce
Pass to and receive from GUI info about project creation lifecycle; handle url changes (#2197)
* add canSaveNew prop to pass to GUI

* pass to and receive from GUI info about project lifecycle

* reset project data or fetch new project data depending on updates received from gui

* removed canSaveNew

* projectId always a string

* moved handleUpdateProjectId calls that fetch or set project metadata into componentDidUpdate

* changed page history object

* removed comments

* two small fixes to deal with edge cases

* cleaning up getExtensions
2018-10-19 16:02:59 -04:00
Paul Kaplan
7772e197c7 Make comment deleting and restoring correctly update replies 2018-10-16 15:08:01 -04:00
Paul Kaplan
592c0e5703 Add restore functionality to comments for admins 2018-10-16 15:08:00 -04:00
Paul Kaplan
b0ac4018ee Use admin routes to include all comments when loading page 2018-10-16 15:08:00 -04:00
Paul Kaplan
b7b7b079b9 Combine comment reported and deleted flags into visibility string
To prepare for server including visibility
2018-10-16 15:08:00 -04:00
Paul Kaplan
bb71bd706a
Merge pull request #2190 from paulkaplan/move-report-to-api
Use the proper API route for reporting projects
2018-10-16 10:03:43 -04:00
Paul Kaplan
cef36682fd Fix comment delete endpoint 2018-10-15 15:24:20 -04:00
Paul Kaplan
85f13935b3 Use the proper API route for reporting projects 2018-10-15 11:17:40 -04:00
Paul Kaplan
c535f8e731 Update report route to match newest API update 2018-10-10 14:01:14 -04:00
Paul Kaplan
bdde34ba26 Implement report action with modal flow 2018-10-09 11:38:24 -04:00
Paul Kaplan
c622d52396 Pass the topLevelCommentId to make sure nested comment deleting works 2018-10-09 10:16:35 -04:00
Paul Kaplan
24fe4fef65 Use topLevelCommentId to simplify adding and deleting comments
This fixes the nested comment deletion problem: https://github.com/LLK/scratch-www/issues/2151
2018-10-09 09:36:41 -04:00
Paul Kaplan
744c90501e Add comments to projects and replies to comments 2018-10-09 09:36:41 -04:00
Paul Kaplan
24b456873b Add comment deleting for project owners 2018-10-03 13:31:54 -04:00
Benjamin Wheeler
eb9abd23a0
fixed errors in splash page that appear in develop (#2077) 2018-09-25 00:52:23 -04:00
Benjamin Wheeler
935eb0b15f
move login/registration functions and view state to session reducer, pass to gui (#2078)
* move login/registration functions and view state to session reducer, pass to gui

* navigation reducer handles login; gui passed renderLogin function

* put back in join class to make smoke tests keep working
2018-09-24 11:04:30 -04:00
Ben Wheeler
2c8990ae7e report project POSTs to scratchr2, displays modal reactively 2018-08-09 12:41:38 -04:00
Connor Hudson
1875870a86
Initial implementation for displaying comments on project page (#1997)
* Create Comment component, start styling it

* Restructure PreviewPresentation to better match mockup

* Add padding, border to comment bubble

* add padding to bottom row of comment

* Tweak alignment of avatar and comment content

* Add margin to lower project page container

* Use border-box box sizing for comment bubble

* Make user avatar a link

* Add initial implementation of comment tail

* Align username row properly, fix comment bubble width

* Use ::before pseudoelement for comment tail

* Remove unused props to Comment component

* Add CommentContainer to handle comment replies

* Use CommentContainer instead of Comment in PreviewPresentation

* Remove debug data from CommentContainer

* Fetch top level comments from the API

* Force comment container to stretch to bottom of view div

* Remove unused api import in CommentContainer

* Long words in comments should not overflow page

* Remove @ before username in comment title

* Fix word wrapping on Firefox

* Refactor CommentContainer into a class

* Properly export CommentContainer component

* Make replies column take up proper width

* Pass project ID to CommentContainer

* Fetch comment replies in CommentContainer

* Initial implementation for loading more comments

* Add "Load More" button to Presentation

* Initial implementation of collapsing threads longer than 3 replies

* Remove console log from preview.js redux

* Tweak last comment gradient color

* Only show three total replies in collapsed state

* Match scratchr2 behavior for thread collapsing

* Use width calc instead of margin and width 100%

* Fix styling for load more button

* Make comment border gray to match the wireframe

* Allow clicking through comment fade gradient

* Add comment compose component

* style comment compose box

* Style post, cancel buttons on comment compose component

* Add margin to create comment container

* Tweak styling for characters remaining text

* Tweak placeholder text

* Add more margin to comment avatar

* Add icons and styling to delete, report text

* Refactor px -> rem where possible in comment styles

* Change comment time color to dark gray

* Tweak margin and border radius

* Add reply icon to preview comments

* Clean up unused imports, console.log in compose-comment component

* Remove console statement in preview.jsx

* Add some clarifying comments to unfinished parts of comments

* Remove direct passing of comment api response to CommentContainer

* CommentContainer should not pass api response directly

* Rename CommentContainer to TopLevelComment

* First pass at getReplies for comments in redux

* Move reply fetching into redux actions instead of in TopLevelComment

* Refactor getReplies logic to behave better

* Remove components not directly related to reading comments

* Hide load more button if all comments are loaded
This uses the project info returned by the API

* Use same gradient as add to studio modal on comment thread
2018-08-06 11:52:18 -04:00
Ben Wheeler
d941ec1dff do not modify state object directly 2018-08-01 16:37:48 -04:00