Commit graph

747 commits

Author SHA1 Message Date
Suzanne Aitchison
3982b389f1
Rework user subscription liquid tag to avoid errors (#16460)
* move script to packs, strip ids

* make sure userdata is available before determining ui

* stop working around old html, fix duplicate ID errors

* skip login modal

* remove DEV hard coding

* replace system spec with cypress spec

* update base_data to include apple auth info, add to cypress tests

* add initial version of DUS to resave HTML

* remove data update script
2022-02-15 09:14:03 +00:00
Jeremy Friesen
77d9640e3e
Initial statement of intent regarding Listings (#16335)
* Initial statement of intent regarding Listings

I want to use this pull request as a means of conveying intended
direction; namely that we want Forem administrators to be able to toggle
off (or on) the Listing feature set.

This refactor is a first, yet incomplete pass, that doesn't make the
code worse.  Expect more of a similar vein as we work to put the Listing
feature set behind a feature flag.

Related https://github.com/forem/rfcs/issues/291

* Adding feature flag based on reviewer comment
2022-01-28 10:07:06 -05:00
ludwiczakpawel
1abf02d94b
Generator updates (#16339)
* generator

* mod tools update
2022-01-28 12:20:30 +01:00
ludwiczakpawel
43c188eafb
Updated indicators (#16190) 2022-01-20 06:25:10 +01:00
Jeremy Friesen
3253ba2c7a
Patching ERB rendering of the data-info JSON (#16067)
Prior to this commit, we were somewhat naively rendering Hash style data
attributes in our ERB templates.  By rendering each hash attribute
separately, we were rendering characters that could break the
javascript (e.g. double hack or backslash `"` or `\`).

By moving to this view_object rendering, we leverage Rails's `to_json`
behavior to ensure properly escaped values.  As part of this exercise, I
generalized the method to allow for other places to benefit from this
behavior.

This generalization also helps ensure that we have a more conformant
rendering (e.g. we should always have an :id, :className, and :name
value in our data-info hash).

_Note: I've updated the user's names for Cypress tests as they are more
likely to catch the particular issue than anything else.  I assume that
I'm going to break some cypress tests and will need some help fixing
them._

Closes #15916, #14704

Supersedes #15983

How to test locally:

Assuming you have seeded database (e.g. `rails db:seed`), checkout the
"main" branch.  Then in `rails console` find a user that's written articles:

```ruby
user = Article.last.user

user.update(name: "\\: #{user.name}")

user.articles.each(&:save)
```

Now, again on the "main" branch, start your application (e.g.,
`bin/startup`).

Then get a logged in and a logged out browser session going.  Open your
web inspector and open console.  Then go to the local instances homepage
(e.g., http://localhost:3000) and look for JS errors.

On the main branch, you should see an exception around
`JSON.parse(button.data.info)` (assuming that the `user`'s article is
rendered on the homepage).

Then go to the user's page (e.g. https://localhost:3000/:user-slug) and
look for JS parse errors.

On this PR's branch (e.g.,
`jeremyf/take-two-at-resolving-gh-15916`)
you shouldn't see those console errors.

More importantly, the Follow buttons should work.
2022-01-14 08:30:49 -05:00
Michael Kohl
2dc6227b5f
Update crayons_icon_tag helper (#16099) 2022-01-14 17:14:42 +07:00
Michael Kohl
fd67b238ea
Use crayons_icon_tag for article views (#16071) 2022-01-14 09:33:44 +07:00
Jeremy Friesen
05bad3ae10
Replacing custom call with existing cached method (#16083)
There's a few things going on:

1. I introduced [a change][1].
2. There was a [data script][2] that should've completed successfully, but
   some data was not converted (see [Blazer query on DEV.to][3])

Thus the current state of the data means that we have have serialized
data in an `OpenStruct` format and `Articles::CachedEntity` format.

This patch should work because the OpenStruct should previously have an
`image_profile_90` attribute.

In addition, I have added some recommendations and tests to better
describe what's happening.

[1]:9780dba380/app/models/articles/cached_entity.rb (L4)
[2]:9780dba380/lib/data_update_scripts/20200723070918_update_articles_cached_entities.rb (L1)
[3]:https://dev.to/admin/blazer/queries/609-serialized-data-in-mixed-forms
2022-01-13 07:48:32 -05:00
Jeremy Friesen
a65954107f
Refactoring to add helper method (#16064)
* Refactoring to add helper method

Prior to this commit, we made view level calls to service modules.  This
refactor provides convenience methods on the model.

Furthermore, it addresses a few Rubocop violations that "come along for
the ride."

* Ensuring cached entity squaks like User

* Fixing broken spec

* Fixing typo
2022-01-12 11:21:44 -05:00
yheuhtozr
3acd4e9deb
delete and add back i18n keys (#15905) 2021-12-30 10:12:40 -05:00
Suzanne Aitchison
0295dbeabf
Update a11y of ButtonGroup component (#15765) 2021-12-15 12:52:33 +00:00
yheuhtozr
74b065be58
I18nize views misc & non-HTML templates (#15136) 2021-12-08 11:28:16 -05:00
Suzanne Aitchison
03660423b9
Rename feeds + update feeds' tabs UI (#15435)
* Rename feeds + update feeds' tabs UI

* rspec updates

* change relevance to relevant
2021-11-29 07:51:24 +00:00
Jeremy Friesen
58a4d805d7
Preventing author profile from going transparent (#15478)
* Preventing author profile from going transparent

Prior to this change, when you would hover over an author profile that
was "close to" the bottom of the page, the card would be transparent
instead of the expected opaque.

With this change, when you hover over an author profile that is "close"
to the bottom of the page, the card renders as an opaque card.

Now why does this work?  I don't really know, except to say that a
`display: table` imperative is a more "chunky" display element than a
block.  I would love for someone to explain why this works.

Tested against on MacOS Safari, Firefox, and Chrome.

https://developer.mozilla.org/en-US/docs/Web/CSS/display

Fixes #15290

* revert table

* fix

* missed spot

* actions dropdown

Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
2021-11-24 09:38:13 -05:00
ludwiczakpawel
50f8cb21fc
Mod tools trigger (#15400)
* init

* init

* test

* test
2021-11-22 08:22:26 +01:00
Anna Buianova
4cab190285
Hiding comments: an option to hide or keep children (#15178)
* Optional hiding child comments (start)

* Changed confirm button in comments hide form

* Hide children comments if hide_children was passed

* Added a spec for hidden child comment notifications

* Hide only explicitly hidden comments

* Hide comment modal on article page

* Prevent default behaviour for hide comment link

* Improved hide comments modal looks

* Improved hide comments modal looks

* Removed unused code

* Send hide comment form via fetch

* Hide comment descendants when hide_children was passed

* Don't hide hidden comments descendants on permalink

* Removed unnecesary span

* Improved hide comments modal styling

* Removed unused styles and js, improved styling

* Clickable label

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

* Fixed showing hidden comments spoiler for article author

* Fixed hideArticleComments.spec.js

* Fixed displaying hidden comments text for artice author, added specs

* Target hide comments modal inside the modal when adding a listener

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Replaced hide comment link with a button

* Refactored adding hide_children url param

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Fixed cypress hide comments test

* Removed aria-label for submit on the hide comments modal

* Fixed formatting

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-11-18 11:57:40 +03:00
ludwiczakpawel
f6dc6c1112
fix (#15360) 2021-11-12 12:35:36 +01:00
ludwiczakpawel
09db50b296
Update tag's style (#15266)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-11-11 14:03:31 -05:00
yheuhtozr
a6f08ae215
views/stories, views/layouts and other homepage i18n (#15083)
* views/stories and home related i18n

* PR key names fixes

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update articles_search_spec.rb

* Update _meta.html.erb

* Update index.html.erb

* Update _meta.html.erb

* Update articles_search_spec.rb

text in HTML should not contain raw brackets

* Update articles_search_spec.rb

* Update _signup_modal.html.erb

* Add back missing Search text

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2021-11-10 07:38:43 -06:00
Mac Siri
2f42bc46d4
Add collection cache in articles/full_comment_area (#15278)
* Add collection cache in articles/full_comment_area

* Add missing file
2021-11-04 10:38:29 -04:00
Akash Srivastava
4cb48768f9
Added collapsed hidden comments to author's article/podcast episode view (#14018)
* Handling hiding/collapsing hidden comments client side

* Updated comment quality text

* Added placeholder for comments against podcast episodes

* Added logic for encompassing co-author-ids in articles

* Removed rspecs validating non-presence of hidden comments in dom

* Fixed hiding flow on comments page for a commentable

* Fixed e2e specs

* Addressed feedback on e2e tests
2021-11-03 11:08:04 +07:00
Daniel Uber
43adc9f1fb
cross posted articles showing <time> tag (#15224)
* Maybe this is what we need to do?

* Undo change to keyword

Use the on_html translation in the view, but pass 'on' as a keyword to
the template.

* remove unused translation

Since we only want to use views.articles.crossposted.on.html (and this is only used in the
article show template) - remove the unused 'on' key from the
translations file.

* Add a spec

Tested that this fails in main and passes on the branch

* Check that the original publication date is shown in the users local

And that it's not a <time> tag presented as text

* Correct local date selection error

If time zone was UTC (i.e. offset from utc was 0) the check for
positive? was false, I meant "non-negative" (positive or zero). Invert
the test.
2021-10-29 12:10:53 -05:00
Daniel Uber
accb3c55ba
Use edited_html to generate timestamps (#15217)
The views.articles.edited template generates a <time> tag

Use edited_html (like published_html) when translating this to ensure
the time tag is rendered as html (and not escaped as text).
2021-10-27 16:37:59 -06:00
yheuhtozr
a93e9f1aa7
I18nize users (non-settings) & logo designer (#15078)
* users (mostly non-settings), logo designer i18n

* remove ja.yml

* Update _profile.html.erb

* Update _metadata.html.erb

* Update _sidebar.html.erb

* Update en.yml

* Update fr.yml

* Apply suggestions from code review

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update _profile.html.erb

* Update en.yml

* Update fr.yml

* Update _logo_design.html.erb

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-27 17:11:28 -04:00
yheuhtozr
7613b6caa3
I18nize articles & social_previews (#15097)
* views/articles (main part) etc i18n

* remove ja.yml

* delete a replaced core entry

* Update en.yml

* Update fr.yml

* Update _liquid.html.erb

* Update _single_story.html.erb

* Update en.yml

* Update fr.yml

* Update _liquid.html.erb

* Update discussion_lock_confirm.html.erb

* Update _widget_list_item.html.erb

* Update _single_story.html.erb
2021-10-27 16:21:47 -04:00
yheuhtozr
f762acca86
views/comments i18n (#15059)
* views/comments etc i18n

* comments PR fixes

* PR sync with main

* remove ja.yml

* Update _comment_header.html.erb

* Update index.html.erb

* Update _comment_header.html.erb

* Update en.yml

* Update fr.yml

* Update config/locales/views/comments/en.yml

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update _comment_date.erb

* Update en.yml

* Update fr.yml

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-10-27 17:13:43 +01:00
Thomas Bnt
4ec93a4b5f
Edit tweet intent URL (#15206) 2021-10-27 09:14:32 +01:00
yheuhtozr
ffd8c9ed1b
actions and reactions i18n (#15058)
* actions and reactions i18n

* remove ja.yml

* Update en.yml

* Update fr.yml

* Update _actions.html.erb
2021-10-25 12:35:05 -06:00
yheuhtozr
7eea2b6a22
article editor and manager i18n (#15070)
* article editor, manager i18n

* PR key name changes

* remove ja.yml
2021-10-21 08:18:48 +07:00
yheuhtozr
56ee3c571f
various small article elements i18n (#15023) 2021-10-15 11:06:44 +07:00
Michael Kohl
ee0bf55085
Add I18n pluralization format example (#15027) 2021-10-13 11:13:54 +07:00
Ben Halpern
ebc2961920
Translate pinned (#15008)
* Translate pinned

* Add pinned
2021-10-12 08:24:29 -04:00
Pramod
ce4ba84184
fix: accessibility issue with feeds comment section (#14958)
* fix: accessibility issue with feeds comment section

* fix: comments section name for logged out scenario and search results

* fix: review changes for logged in scenario

* fix: updated comments section aria label
2021-10-07 17:01:42 +01:00
Tayllan
fc77376c1b
Translate actions in articles view (#14911)
* Translate actions in articles view

* Move reactions to core.reactions namespace

* Add quotes to share_to in yml file

* Fix wrong translation in english locale

Co-authored-by: rhymes <github@rhymes.dev>
2021-10-07 12:08:14 +07:00
ludwiczakpawel
096cf18b10
Article layout (#14753)
* style updates

* author and tools

* overflow hidden for avatars because geeeez

* font smoothing

* reverting little change

* specs

* preview

* css fix

* avatar fix'

* No longer eager load user profile when showing articles.

articles show view no longer needs user profile, as it no longer
renders the user profile preview.

* tags

* tags

* tags reverts

* typo

* dropping initializer for user cards previews on article page

* spec

* remove spec

* revert

* Update app/decorators/article_decorator.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

* Update spec/requests/stories_show_spec.rb

Co-authored-by: Michael Kohl <me@citizen428.net>

* yoloing outline change on buttons because i couldn't see any visual difference

Co-authored-by: Dan Uber <dan@forem.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2021-09-30 19:08:06 +02:00
Daniel Uber
5678fb77f5
Remove unneeded checks for code tags when filtering articles from search indexing (#14801)
* Move logic to determine noindex from view to model

This brings attention to the code and allows for faster unit tests.

I expect we'll be modifying this soon to deemphasize the code tag as a
marker of quality.

* Replace "5" constant with home feed minimum score

* Remove check for "code" tags in low quality article check

This made sense for DEV and other devrel communities, but is no longer
necessary for Forems.

* Add UserExperience setting for minimum index score

- add setting, I used `index_minimum_score` to match the
`home_feed_minimum_score`, `minimum_index_score` feels natural but
breaks the pattern.

- use this to determine whether to include article in the sitemap

- use this to determine whether to add noindex meta to article show page

* Remove unneeded tests

Since there's no longer any check for <code> tags in the body, omit
those tests (which passed anyway).

* Add new setting to admin page
2021-09-28 13:44:35 -04:00
Ben Halpern
036d75aa6e
Admin-configurable display locale (#14620)
* Admin-configurable display locale

* Add i18n-js and namespacing

* Basic tests and clean up

* A few test adjustments

* Update vendor cache

* Fix a few tests

* Fix a few tests

* Update app/views/articles/_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_comments_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/comments/_comment_header.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/layouts/_sidebar_tags.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/listings/index.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/homepage/user_visits_homepage_articles_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/user/view_user_index_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Alphabetical locale page

* Add activerecord custom validation error translations

* Add i18n to webpacker

* Fix a few tests

* Adjust error messages

* Add i18n-tasks

* Adjust JS to get working with jest

* Adjust the way translations are pulled in

* Adjust jest tests

* Remove time localization

* Remove superfluous public js

* Add basic tests for i18n application controller

* Remove unnecessary content

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-09-28 11:04:35 -04:00
Ben Halpern
a5e8ed66ee
Fix inconsistencies with DisplayAd (#14789)
* Fix inconsistencies with DisplayAd

* Remove console log

* Fix tests

* Fix width/height being backwards

* Stub FastImage

* Update app/services/html/parser.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update spec/factories/display_ads.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Fix display language

* Add check for img

* Change name of rotatingDisplayUnits

* Update app/helpers/display_ad_helper.rb

Co-authored-by: Michael Kohl <citizen428@forem.com>

Co-authored-by: Michael Kohl <citizen428@forem.com>
2021-09-28 09:22:07 -04:00
Nick Taylor
2df2f88769
Fixed a11y issue with headings. (#14799) 2021-09-24 09:03:52 +01:00
ludwiczakpawel
e7af2bfc86
Little frontend refactor (#14755)
* profile dropdown update
* dropdown fixes
* preview cards fix
2021-09-17 16:23:51 +02:00
ludwiczakpawel
0b547bf8cd
Tabs (#14738)
* sliding tabs

* Add aria-label to the navigation

This supports the cypress tests, as well as retaining existing accessibility features.

* Adapt feedNavigation cypress test to handle new navigation layout

Before looking for week, month, year, or infinity top feeds, select
"Top" and wait for the page refresh.

* increasing tappable area + making foucs outline visible

Co-authored-by: Dan Uber <dan@forem.com>
2021-09-16 21:42:55 +02:00
Mac Siri
94d2261d42
Remove #sanitize_and_decode (#14727) 2021-09-15 11:05:06 -04:00
ludwiczakpawel
f2f2c34673
3d drop shadows (#14701)
* remove 3d box shadow

* profile cards fixes

* little fix

* dark mode + listings modal

* dropdowns padding

* whoops
2021-09-13 11:02:53 +02:00
Keshav Biswa
42c9a10f57
Accessible names for follow buttons (#14389)
* added follow hidden tags for accessibility

* fixed failing tests

* replaced hidden span with screen-reader-only with aria-label

* add aria-label dynamically to follow buttons

* fixed followButtons

* fixed cypress tests and updated addAriaLabelToButton helper

* Fixed failing tests

* fixed failing tests

* Update cypress/integration/seededFlows/notificationsFlows/followUserFromNotifications.spec.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-09-07 16:09:06 +01:00
Suzanne Aitchison
bfb4f00aae
Add copy to HTML feature for storybook (#14599)
* Add copy to HTML feature for storybook, inc fix for article markup

* remove html stories no longer needed
2021-08-27 16:09:21 +01:00
Khadija Sidhpuri
7e91cfe760
Fix Sponsors Image display in homefeed and sponsors page. (#14494) 2021-08-23 10:05:34 -04:00
Michael Kohl
1ebec4b67f
Remove hardcoded user profile fields (#14079)
* Remove duplicated work display from header

* Update work profile field handling

* Update DUS + spec

* Delegate more carefully

* Update delegation guard

* Adapt for removed delegation

* Undo accidental schema changes

* Fix seeds

* Remove accidentaly change

* Fix User#processed_website_url

* Update guard clause

* Update profile card content

* Add Organization#profile

* Be more conservative with profile fields

* Spec fixes round 1

* Fix typo

* Update spec

* Limit number of header fields and update card content

* Decorate correct model

* Update factory

* Update schema.rb

* Fix validation

* How bad could this possibly be?

* Pretty bad, nevermind

* Remove obsolete code

* Reset profile fields during test runs

* Move profile fields back to before(:suite)

* Spec fixes

* Remove accidentally re-added files

* More spec fixes

* Specs

* Change User#tag_keywords_for_search

* More spec fixes

* Add comment

* Undo accidental schema changes

* Attempt spec fix

* Remove fix attempt

* Fix e2e test

* Update spec

* Remove guard clause

* Remove hardcoded instances of education field

* WIP Access display_email_on_profile via User Settings

* Remove unused profile column

* WIP fix issues revealed by systems specs

* WIP fix issues revealed by services specs

* WIP Fix failing tests

* WIP Fix spec failures

* wip

* Move two attributes from controller to decorator

* Update comment

* More consistently use user.tag_line

Even before the profile changes we sometimes used the user.summary
attribute directly but used the user.tag_line method in other places.

* Remove education

* Add comment

* WIP

* Clean up mostly_work_with

* WIP

* Update work profile field handling

* More work-related changes

* Remove settings_only from display_area enum

* Remove quickfix from _metadata partial

* Remove special attributes

* Remove leftover spec

* Retrieve location from profile, not user

* Profile.special_attributes no longer exists

* Update specs

* More spec fixes

* Update UsersController

* Update UsersController and spec

* Fix e2e seeds

* Minor cleanup

* More e2e seed fixes

* Fix profile field CSV

* Fix e2e seeds

* Move one more attribute in e2e seeds

* Remove duplicate line

* Clear inputs before typing in them

Co-authored-by: Jacob Herrington <jacobherringtondeveloper@gmail.com>
2021-08-18 11:44:53 +07:00
Suzanne Aitchison
80096f63a7
Add author profile preview cards to feed (#14340)
* Add the preview card to logged out feed initial content

* initialise the initial dropdowns added on the logged out feed

* minor tweak to selector

* flip the follow button and the summary

* add minimal preview card to build article HTML

* WIP: data fetched an inserted into card on logged out feed

* WIP: cards added to logged in feed

* create separate profile preview card component

* small style tweak, import pack on each page that shows feed cards

* rename

* tweak some styling issues

* make sure follow buttons init in cards

* populate all matching metadata placeholders after fetch

* don't render full preview card upfront on logged out feed

* refactors from PR comments

* fix issue in person search results

* remove check for article author link that will be superseded by cypress test for preview card

* Revert "remove check for article author link that will be superseded by cypress test for preview card"

This reverts commit 9b42804ffd0f051891c87293d0b791ed2bb0367f.

* Revert "fix issue in person search results"

This reverts commit 04941e3520c0895212141193b60f2933faed5ca1.

* only show the preview cards on story cards for Posts (not users etc in search results)

* correct display on collections view

* remove link check that will be replaced by cypress test

* tweaks to small issues, add a test for the logged out feed

* add tests for logged in home feed, logged out tag index

* add search test and tag index logged in test

* fixes to preview profile spec

* tweak to followauthor spec

* add cypress test for preview on series page

* use a unique test user for series test

* correct the jsdoc comments

* tweaks following PR review

* allow feed preview cards to reposition

* move to separate file from pack
2021-08-13 10:55:43 +07:00
Suzanne Aitchison
e749626e71
Add horizontal padding on preview card trigger button (#14472)
* tweak trigger button padding on article byline

* tweak padding on comment preview triggers
2021-08-11 12:31:48 +01:00
Keshav Biswa
b58fdd013b
Comment reaction button accessibility (#14256)
* added aria-pressed to comment buttons

* Added accessibility title

* updated set attribute and text content of aria-title

* removed 'x likes' from svg titles

* Added e2e tests to test behaviour of like toggle button

* changed reaction button's description to save instead of Saved

* Fixed cypress test
2021-08-10 10:20:14 +01:00