Forem Creators and Builders

Cover image for Changelog: Admin Updates, API Improvements, Accessibility Fixes and more!
Christina Gorton
Christina Gorton

Posted on

Changelog: Admin Updates, API Improvements, Accessibility Fixes and more!

Here is a round up of the latest highlights from our repository that add improvements to Forem.

Editable Published Dates in Admin for Articles List

This PR adds functionality to posts by making published_at an editable datetime select option in the admin side of articles.
Editable datetime select option in admin

Added published date as editable in admin articles list/show #11124

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

Adds post published_at as an editable datetime select option in the admin side articles index/show views

Related Tickets & Documents

Closes #10871

QA Instructions, Screenshots, Recordings

#QA Check out a published article in admin/articles list/show. Update the published_at date to something else and hit Submit. Confirm it has changed

Screenshot 2020-10-27 at 10 45 10 PM

#Additional changes

  1. Because published_at is added as a rails datetime_select field to fulfil all kinds of datetime requirements, the #update logic in admin/articles controller had to be changed. The existing logic picked up individual values from permitted params, changing a few of them, before saving them But datetime select pushes params as param(1i), param(2i) and so on, which doesn't sit well with extracting params. It is custom made to work with model.create(permitted_params) or model.update(permitted_params). Now, the code directly runs article.update(article_params) for checking successful update
  2. Because params are not cleaned up anymore, had to make sure all checkboxes return the correct boolean from the form. Converted all checkboxes to rails form check_box fields to ensure right matching to form object.
  3. Only co author ids needs special treatment for conversion to array from comma joined string before saving. To ensure smooth input from the form without changing the UI, added a model attribute co_author_ids_list which acts as a form field, and then parses it back to array at model level instead of controller, before saving

Added tests?

  • [x] Yes
  • [ ] No, and this is why: please replace this line with details on why tests have not been included
  • [ ] I need help with writing tests

Added to documentation?

  • [ ] Docs.forem.com
  • [ ] README
  • [x] No documentation needed

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

alt_text

API Improvement for Organizations

This PR adds new API endpoints to get a list of an organization's users.

In the future we will also include an endpoint for an organization's articles and listings.

API: Endpoint to get an organization's users #11514

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

This would provide an api endpoint dev.to/api/organizations/{org_username}/users to get a list of an organization's users. As discussed in issue 9212, This is the 2nd of 4 related endpoints that will include:

dev.to/api/organizations/{org_username}/articles
dev.to/api/organizations/{org_username}/listings

Related Tickets & Documents

#9212 #10931

Added tests?

  • [x] Yes
  • [ ] No, and this is why: please replace this line with details on why tests have not been included
  • [ ] I need help with writing tests

Added to documentation?

Bug Fix and Optimization for Deploys

In the past when we deployed Forem Cloud we did not retain assets for old versions of the platform, and service workers did not seem to reliably retain the in-memory cached version of asset.

This caused flashes of unstyled content and a few other frontend issues for people.

This PR adds more static assets to help with the frontend issues while also adding functionality to periodically flush the component of the serviceworker cache to make sure we don't over-cache.

Include core assets in serviceworker cache #11559

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [ ] Feature
  • [x] Bug Fix
  • [x] Optimization
  • [ ] Documentation Update

Description

Currently when we deploy Forem Cloud we do not retain assets for old versions of the platform, and service workers do not seem to reliably retain the in-memory cached version of assets, so we sometimes get flashes of unstyled content and other frontend issues.

This adds more static assets to the serviceworker cache, and also adds functionality to periodically flush that component of the serviceworker cache to make sure we don't over-cache.

QA Instructions, Screenshots, Recordings

Things should continue to work as normal. If you open up the application tab of chrome tools and view Cache Storage you'll see static 1.2 cache including a bunch of assets.

Update Admin β€œBan” and β€œSuspend” Language for Clarity

This PR renames "ban" to "suspend" throughout the /admin/ space. In the past we used β€œban” and β€œbanish” which caused some confusion.
Suspend more clearly implies a temporary nature.
Arit explaining how the language for suspend has changed
You can see a full video walkthrough of the changes by one of our developers Arit Amana here.

[EOY 2020] Replace "ban" with "suspend" in Admin #11581

What type of PR is this? (check all applicable)

  • [X] Refactor
  • [ ] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

Renames "ban" to "suspend" throughout the /admin/ space. closes https://github.com/forem/InternalProjectPlanning/issues/298

NOTE: πŸ‘‡πŸ½

I stopped short of changing banned and comment_banned to suspended and comment_suspended (respectively) within app > models > role.rb, as I am not sure how that move will affect current role assignments in production. I welcome feedback/corrections on my decision. πŸ™

QA Instructions, Screenshots, Recordings

  1. Navigate to localhost:xxxx/admin/users as a super_admin role
  2. Edit any user and give them either Suspend or Comment Suspend roles
  3. Check that their show page reflects the role changes made

https://www.loom.com/share/6c764ef0ff724b8e8c73433681a2edf1

UI accessibility concerns?

Changes were made just to certain text, depending on the user's role; there are no UI accessibility concerns introduced, in my humble opinion

Added tests?

  • [X] Yes, tests were modified according to code changes made
  • [ ] No, and this is why:
  • [ ] I need help with writing tests

Added to documentation?

[optional] Are there any post deployment tasks we need to perform?

None

[optional] What gif best describes this PR or how it makes you feel?

Get It Dance

Initial Accessibility Fixes

Forem is working with Marcy Sutton to improve accessibility on DEV and Forem in general.

This PR includes some of the initial accessibility issues encountered upon setup and improves color contrast on the site.

Accessibility: initial onboarding fixes #11408

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [ ] Feature
  • [X] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

This PR includes some of the initial accessibility issues I encountered upon setup. It primarily updates color contrast to pass WCAG 2.0 AA but there's also one bit of missing alt text. Additional accessibility items will be addressed in future PRs.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

  • Run the axe extension on DEV.to
  • See the color contrast issues that come up
  • Run axe again on this PR
  • Compare it to the list of accessibility violations

Added tests?

  • [ ] Yes
  • [X] No, and this is why: Not applicable
  • [ ] I need help with writing tests

Added to documentation?

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Simpsons GIF of Lisa saying 'wow, look at all the colors, man!' and Milhouse saying 'I'm FREAKING OUT!'

Fix For FaceBook Login

This PR fixes a bug with Facebook Login where you can't create an account because the profile image download process fails.

Fix Facebook Login profile image download failure #11478

What type of PR is this? (check all applicable)

  • [x] Bug Fix

Description

This fixes a bug with Facebook Login where you can't create an account because the profile image download process fails. The workaround is:

  1. Grab the user's Facebook UID and OAuth access token
  2. Request the photo directly via a separate call
  3. From that JSON response, grab the direct link to the requested profile image
  4. Pass along to Carrierwave to download as normal

Related Tickets & Documents

Closes https://github.com/forem/InternalProjectPlanning/issues/238

QA Instructions, Screenshots, Recordings

  1. Make a Facebook OAuth app https://docs.forem.com/backend/auth-facebook/
  2. Add your Facebook keys to your config
  3. Try to login via Facebook
  4. See that your user creates successfully

UI accessibility concerns?

Nope!

Added tests?

  • [x] No, and this is why: it's hard to stub this, and I think this is more of an implementation detail

Added to documentation?

  • [x] No documentation needed

[optional] Are there any post deployment tasks we need to perform?

Nope

[optional] What gif best describes this PR or how it makes you feel?

Alice falls through the rabbit hole.

Improvement to Tag Mod Filtering

A Tag Mod pointed out that when filtering to their tag while in /mod they were not seeing the latest posts there. This PR removes the score filter for articles to the moderator's article index so they can view all articles including showing the newest posts first. This will make it easier for Tag Mods to moderate their tags.

Bug Fix:Remove Score Filter From Tag Mod Index #11599

What type of PR is this? (check all applicable)

  • [x] Bug Fix

Description

Remove score filter for articles for the moderator's article index so they can view all articles.

Related Tickets & Documents

Closes https://github.com/forem/tech-private/issues/420

Added tests?

  • [x] No, they already exist

alt_text

Discussion (2)

Collapse
jess profile image
Jess Lee (she/her)

Loving these recaps!

Collapse
lee profile image
Lee

Agree, they are great!