* Tidying up and documenting Tag model
Prior to this commit we had a custom `where(alias_for: [nil, ""])`
call. That call highlighted that we lacked a term for a Tag that was
not an alias. As part of this commit, I named that a "concrete" tag.
Further, I added scopes to assist in helping "name" those concepts.
This commit also adds a data migration and utilization of
StringAttributeCleaner to hopefully get away from `alias_for == ""`
situations.
As of writing this commit <2022-01-04 Tue 17:22 UTC>, in DEV.to we had 5
tags with `alias_for == ""`:
- actionshackathon21
- regex
- atlashackathon
- hotwire
- foremfest
In https://dev.to/admin/blazer I ran the following:
```sql
SELECT name FROM tags WHERE alias_for = ''
```
* Renaming concrete to direct
* We no longer need to manually install faraday 1.8.0 as a work-around
Faraday 2.0.1 re-introduces the default adapter (net_http), which
makes the prior work around (installing faraday 1.8 prior to
installing dpl, preventing it from bringing in 2.0.0 as the current
release).
There's currently a related dependency issue where a circular
dependency between dpl, faraday, and faraday-patron was causing deploy
failures (faraday-patron requiring faraday 2.0.x but we had
specified otherwise).
Remove the temporary shim to enable travis heroku deploys, and let
their team manage that.
* No longer require faraday before install
This was a first attempt to address the deploy issue, but failed. It
installed faraday in the target ruby version 3, while travis was
installing the conflicting package dpl in their travis internal ruby
version.
Safe to remove.
* Skip google analytics when ga_tracking_id is nil
This commit involves short-circuiting Google Analytics calls when the
Forem has not configured a `Settings::General.ga_tracking_id`. Note,
depending on your local `.env` file (or configured ENV variables) you
may have a `GA_TRACKING_ID` value set; I did, it was set to "Optional"
which overrode the database setting.
We set the HTML data properites in two places: [admin.html.erb][1] and
[application.html.erb][2].
In addition, I'm short-circuiting the local fallback analytics call (via
[Stacato][https://github.com/tpitale/staccato]). My understanding of
Stacato, based on a cursory read, requires a Google Analytics Tracking
ID to work.
And last, we have a one off of javascript for Google Analytics tracking.
This closes#15962.
[1]:528bd2baa6/app/views/layouts/admin.html.erb (L31)
[2]:528bd2baa6/app/views/layouts/application.html.erb (L55)
How to test?
- Check your .env file to see if you have set GA_TRACKING_ID. If so,
unset it.
- Start with a fresh Forem instance.
- Open your browser and open the developer tools to inspect the Network
activity.
- Open the homepage of your local Forem instance (http://localhost:3000)
- Filter your Network results for analytics. You shouldn't see any.
Also, make sure you're disabling any blockers you might have as that
influences things.
* Commenting out GA_TRACKING_ID
Related to https://github.com/forem/forem/pull/15967
* Favor empty GA_TRACKING_ID env variable
Faraday 2.0.1 re-introduces the default adapter (net_http), which
makes the prior work around (installing faraday 1.8 prior to
installing dpl, preventing it from bringing in 2.0.0 as the current
release).
There's currently a related dependency issue where a circular
dependency between dpl, faraday, and faraday-patron was causing deploy
failures (faraday-patron requiring faraday 2.0.x but we had
specified otherwise).
Remove the temporary shim to enable travis heroku deploys, and let
their team manage that.
* core functionality in place
* fix dark theme background issues
* separate list for aria-live, add delete and blur functionality
* fix issue with input resize on edit
* handle input blur, prevent special characters, tweak keyup to keydown to ensure runs before change event
* group buttons and add default styles
* style tweaks
* fix logic error with insert index
* refactors
* clear suggestions on blur, even if no input value
* tweaks
Prior to this commit, we had a couple of references to magic strings
regarding DisplayAdEvent objects. This commit seeks to consolidate that
behavior.
In a handful of cases we had javascript variables, but as these JS files
are `erb` templates, we can inject the constant as well. This reduces
repetition of knowledge.
* add missing unique key to fragment created with map
* add appropriate key for fragment
* Remove files removed from main
* After merge cleanup
Co-authored-by: Michael Kohl <me@citizen428.net>
* add needed fields to tag search
* specs
* add badge to tags suggest response (#15840)
* Add badge to tags suggest response
* Update tags_spec.rb
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* limit tag search badge to only badge_image
* only unpack badge image if badge exists
Co-authored-by: Dwight Scott <dwight@forem.com>
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
* Send custom user agent string when fetching feeds
dev.to blocks access to the feeds for user agent "Ruby"
Use "Forem Feeds Import" as alternate user agent when fetching feeds.
fixes https://github.com/forem/forem/issues/15939
* Update app/services/feeds/import.rb
Co-authored-by: Michael Kohl <citizen428@forem.com>
Co-authored-by: Michael Kohl <citizen428@forem.com>