Commit graph

427 commits

Author SHA1 Message Date
Anna Buianova
2d6b740940
Renamed DisplayAd model to Billboard (#19993)
* Renamed Resource Admin: DisplayAd to Billboard

* Renamed DisplayAd to Billboard

* Added a data update script for roles
2023-08-28 08:09:36 -04:00
Ben Halpern
0c92bc3f27
Full minimagick social image rollout (#19949)
* Full minimagick social image rollout

* Fix errant puts

* Remove unnecessary file
2023-08-21 09:11:14 -04:00
Ben Halpern
c9af090af0
Prefer Minimagick for social image generation (#19826)
* Prefer Minimagick for social image generation

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Reformat main file

* Fix user tests

* Finish up tests

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Change asset path syntax

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Refactor magickally file

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix style issues

* Remove pure black

* Test color swap

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add more test coverage to service

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix doubled spec name

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Add upload spec

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update spec/services/images/generate_social_image_magickally_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Swap out magickally in social image worker

* Add test stub and rescue

* Update spec/rails_helper.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix regex

* Add cache busting and error logging

* Update app/services/images/generate_social_image_magickally.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix style issues

* Add more test coverage

* Add feature flag

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-08-11 08:22:06 -04:00
PJ
7be865b295
Feature-flagged support for filtering billboards by location (#19834)
* add migrations

* add countries gem?

* first pass at location model

* specs 

* add location to filtered ads query

* feature flag and nicer errors

* cosmetic fixes

* more tweaks (remove unnecessary index, add initializer)
2023-07-27 18:13:26 +01:00
Jerin K C
6c2c1660db
Fix blank user's name (#19723) 2023-07-21 09:55:41 -04:00
Joshua Wehner
6b80d99c1b
Update onboarding suggested tag logic (#19477)
* Onboarding suggested tags should include supported

* Migrate tags to add suggested boolean column

* Use new suggested attribute

* Sync Settings.suggested_tags with new form setting

* Better sort order

* Test logic update

* Add a little comment
2023-05-23 17:22:27 +02:00
Mac Siri
b4a4b30153
Add Staging specific seed file (#19434) 2023-05-10 16:10:19 -04:00
Joshua Wehner
dc1ab81401
Allow DisplayAd to target users via audience segmentation (#19284)
* Trying some models for audience segmentation

* AudienceSegment basics

* Attach AudienceSegment to DisplayAd

* Possibly use a DUS to populate AudienceSegments

* Add to display ad form UI

* Add to display ad API

* Refresh strategy for audience segments

* Add user_id to async ads query

* Maybe :testing -> :manual, for no-refresh segment

* Test & tweak segment refresh

* Testing audience_segment#refresh logic

* Coverage: testing human_readable

* Scope segment refresh to recently active users

* Tweak logic for when to refresh

* Tweak experience levels to match SettingsHelper

* Test for front-end logic

* Fix test, hope this helps coverage?

* Better test names

* One worker for all, many workers for each, perform_bulk

* Fix audience segment UI, needs to use id, not enum

* cron/schedule should RefreshAll

* Singular id in RefreshWorker
2023-04-25 08:41:10 -04:00
Anna Buianova
784afdf41e
Routine rubocop fixes (#19254)
* Rubocop fixes

* Rubocop fixes

* Fixed rubocop violation

* Fixed policies rubocop violations

* More rubocop fixes
2023-03-24 14:37:44 +03:00
Ben Halpern
e155212a19
Remove dead sitemap generator code (#19150) 2023-02-20 10:23:11 -05:00
Joshua Wehner
ea2154d506
Fixing design issues with multiple reactions (#19020)
* Try disabling text-select (mobile long-tap)

* Try to force button color on mobile safari

* Try making notification decorator more helpful

* More using notification decorator

* Helper so I can see exceptions

* As we toggle feature flag, temporary show 'heart' for unsupported reactions

* Reaction on Comment is a 'reaction'-type notification

* Temporarily add new emojis to i18n

* Render full-color, unique SVGs for multiple_reactions

* Restore card layout

* Aggregate reaction icons also need unique SVGs

* This seems unnecessary?

* Multiple is -more-than-one-

* Display *unique* reaction categories on /notifications

* Comment notification no longer needs to re-render as reaction

* Decorator needs to handle some data gaps

* Fix NotificationHelper

* Try a better name for this

* Tests for the notification decorator

* These partials wound up without an outer layer

* Add a descriptive comment

* index needs force_unique

* Try multiple reactions external img (#19076)

* Try external img SVGs

* Unique SVG might not be necessary if this works

* Can also remove this spec if successful

* Restore flash icon behavior

* Plus external img for #index as well
2023-02-08 11:39:47 +01:00
Joshua Wehner
30c0485507
Frontend for multiple reactions (v1) (#18808)
* Remove extraneous comment (see 9361d2 and 5c18f8)

* Flexible, multiple reaction types

* Fix reaction counts

* Re-use svg for active state for now

* Update yml, update spec

* Possible temp fix for failing tests

* Colorize reaction icon svgs

* Reaction engagement above post title

* Index reactions engagements (for logged-out)

* Maybe readinglist is special

* Try using crayons' dropdown as a drawer?

* readinglist isn't really public now

* feat: update the styles for the reaction drawer

* Grey background highlight, turn off border/shadow

* Read our feature flag docs, saw this was recommended

* Missed fifth emoji: party/tada

* Fix JS test errors

* Update test with tada

* Suppress flashing engagements when no public reactions

* Liberate jump-to-comments from unicorn replacement

* 'Add reaction' on tooltip

* Don't show reaction emoji on index unless it's been used

* rubocop

* Update heart+ total count when toggling

* Do not include 'readinglist' in drawer/public counts

* Fix semi-public readinglist so that icon is badged for current user

* Tweak heart-plus svg

* Style tweak: border on active reaction

* Show reacted icon on drawer trigger for 1.5 sec

* Tweak styles for engagements bar

* Style tweaks for multiple engagements (#index)

* Trying to get size working through crayons/inline_svg

* Sparkle hearts

* Restore unicorn

* Make heart-plus-active work when user has an active reaction

* Try 'hoverdown' a dropdown that activates with hover

* Long touch?

* Tap *outside* the drawer to close

* Mobile reaction drawer is also supposed to be columns

* More reaction count cleanup

* Final emoticons maybe?

* Fix reaction bug when feature disabled

* Remove readinglist from public reaction counts

* Update specs for new reaction categories

* Shuffle makes specs flaky

* Order does not matter

* rubocop

* Update to preserve readinglist analytics

* Shuffle makes specs flaky

* Fix flickering images, remove icon highlight for now

* Don't update total for readinglist

* reactions_by_user_id

* Try renaming this observer function

* Try unid ids for SVGs

* Remove local test file

* Simplistic test for the unique svg transform

* Fix javascript for current SVG

* Signifcant string literals in this case, rubocop

* Use the right expected output

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2023-01-23 16:00:50 +01:00
Anna Buianova
f7a93aabbb
Remove html variants tracking (#18594)
* Removed code related to tracking html_variants

* Remove code related to HtmlVariant#find_for_test

* Remove spec for HtmlVariant#success_rate
2022-10-21 14:57:20 +03:00
Ridhwana
9361d2426f
✂️✂️✂️ Part 1: Remove Sponsorship (#18512)
* feat: remove initializeSponsorshipVisibility and related code

* feat: remove sponsorships from sidebar

* feat: remove sponsorships from the admin - route, controller, view, spec

* feat: remove the admin menu item

* feat: remove the i8n for admin sponsors controller

* feat: sponsorship decorator was not being used anywhere

* feat: sponsorship slack messenger was not being used anywhere

* feat: remove the sponsorship_headline that gets configures on the admin

* feat: remove the /sponsors page

* feat: remove renedring of single_sponsor partial and associated partials

* feat: remove the navigation link rake task for sponsors

* feat: remove sponsorship from tags

* feat: remove i8n constants used

* remove sponsor references in text to the privacy page

* feat: remove the sponsorship detail from the organization page

* feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb

* feat: remove the sponsorship i8n that was used in the slack messengers

* feat: swap out the decorators to use Article as an example

* feat: remove spec to show sponsors on home page

* feat: update the specs to use Article Decorator instead of the Sponsorship Decorator

* fix: use direct and not all

* fix: remove tests for tag sponsorship

* fix: remove organization sponsorship test

* feat: remove more i8n
2022-10-03 16:26:32 +02:00
Ridhwana
3d3e5156a3
Add "name" field to Display Ads (#18396)
* feat: create a migration to add the display ad name column to the tanle

* feat: add a display ad name to the interface

* feat: add a display ad name after create

* feat: whoops the migration file

* feat: add a DUS to update previous Display Ads names

* fix: test

* refactor: update the name after_save

* fix: add name to params
2022-09-02 16:29:33 +02:00
Mac Siri
0ea60867d4
Revert all Rack::Attack changes (#18407) 2022-08-31 18:11:56 -04:00
Mac Siri
9c0fc6b918
Use remote_ip in Rack::Attack (#18397) 2022-08-31 10:50:26 -04:00
Julianna Tetreault
de4acd4fa5
Remove Community Emoji from Admin Config 🌱 (#16902)
* Removes all community_emoji-related code

* Removes community_emoji-related specs from codebase

* Updates communitySection.spec.js to test for member_label

* chore: merge conflicts

* feat: remove data update script

* chore: add file back

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2022-08-30 17:16:58 +02:00
Julianna Tetreault
806a5a774e
Backfill community_emoji data with a DUS 🌱 (#16896)
* Adds a DUS to backfill community_emoji for Forems that have one

* Adds a DUS spec to test backfilling community names

* update the script adn the tests to allow us to change the community name

* feat: add a stub for the community name

* feat: generate a later timestamp so that it doesnt cause confusion

* chcek if the emoji already appears in the community name

* feat: remove community emoji from displaying on the UI

* refactor:remove the else if completely

Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
2022-08-26 16:12:46 +02:00
Joshua Wehner
445fd0f9e5
Try renaming moderator -> super_moderator (#18261)
* Try renaming moderator -> super_moderator

* Still finding 'moderator' words

* Fixes for failing specs

* Update test with new role name

* Update app/services/moderator/manage_activity_and_roles.rb

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-08-10 16:43:30 +02:00
Suzanne Aitchison
f1df37f431
Add "only display when logged out" as an option on Navigation Links (#18275)
* add new column with enum value

* refactor to use display_to column

* add some more specs to application_helper

* test for the backfill DUS

* fix line length

* refactor
2022-08-08 10:55:24 +01:00
Anna Buianova
80ce8909ec
Fixed most rubocop issues (#18048)
* Fixed most rubocop issues

* Fixed accidental schema changes

* Fixed Vault specs
2022-07-07 14:36:08 -06:00
Anna Buianova
ff76cdd3c5
Scheduling articles (#17939)
* Article query spec for scheduled articles

* Added scheduled article badge on the user dashboard

* Added published_at field to editor options

* Accept and validate published_at from editor

* Refactor published_at validation

* Allow 1-minute difference in published_at

* Notice on an unpublished article page

* Added specs for 'Click to edit' link on scheduled article preview page

* ContextNotification model

* Articles::Publish worker

* Added specs for articles publish worker

* Schedule publish articles worker

* Added tests to check for scheduled posts in feeds

* Don't allow managing scheduled articles

* Don't send notifications for scheduled articles

* Set published_at in Articles::Updater when publishing

* Published_at value in post options

* Pass timezone and set published_at accordingly

* Limit setting published_at to the future

* Readonly published_at for articles that were already published

* Chagning published_at format in editor v1 (start)

* Changed published_at format in frontmatter, specs

* Added specs for updating published_at from frontmatter

* Fixed accepting past published_at for articles published_from_feed

* Enabled published_at validation: don't allow updating published_at for already published articles

* Validate published_at on create

* Added a spec for updating published_at for exported articles

* Fixed specs related to creating articles with past published_at

* Fixed specs related to past published_at for articles

* Added a hack so that admins would be able to update published_at

* Switch button text schedule/publish when changin publishedAt

* Fixed saving published_at with timezone

* Added a feature flag for scheduling articles

* Default text in markdown editor depends on feature flag

* Enable article editor cache again

* Fixed the default value in the markdown editor

* Fix sitemaps spec

* Removed tooltip

* Fixed articles update specs

* Added missing locales

* Fixed article create specs

* Fixed spec

* Removed commented code

* Returned enabling extensions in the schema

* Returned accidentally deleted constraint

* Make articles query spec more stable

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Removed commented code

* Removed unused code

* A clearer policy

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Use StringInquirer for article current state

* Added a note and todo to articles factory past trait

* Remove duplicated PropType

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

* Refactor query in the Articles::PublishWorker

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Refactor articleForm.jsx

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed specs that are no longer relevant

* Removed useless onKeyUp on a hidden input

* Refactored articleForm

* Hide scheduling from post options when published_at is readonly

* Run sends notifications worker every 5 minutes instead of every minute

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-07-07 17:32:49 +03:00
Mac Siri
678dda8cf4
Routine Rubopcop lint fixes (#17844)
* Routine Rubopcop lint fixes

* Undo app_secrets_spec changes

* Fix broken spec
2022-06-07 10:17:16 -04:00
Daniel Uber
d571231ea4
Remove sustaining member newsletter, and its settings (#17514)
* Remove sustaining member newsletter, and its settings

This removes the concept of sustaining memberships from the system,
and logic related to or dependent on it.

This does not remove the monthly_dues column from the users table (todo).

* Remove unused newsletter setting

Since nothing accesses the mailchimp_sustaining_members_id setting,
it's safe to remove.

* Use destroy rather than delete to ensure settings cache is cleared

We have a callback in Settings::Base to clear the cache after commit,
I assume it's useful to trigger that. This requires destroy, not
delete, to be called.
2022-04-29 11:47:12 -05:00
Suzanne Aitchison
866546b031
disable creator onboarding feature flag (#17404) 2022-04-22 15:44:07 +01:00
Daniel Uber
8276d1d8c6
Remove profile admin feature flag (#17194)
Remove test cases built around it (modified when the guards were removed).
2022-04-11 09:27:35 -05:00
Daniel Uber
c8149e8e1a
Enable :profile_admin feature flag (#17187)
This makes profile fields available for all forems.

There is a follow up task to remove the conditionals around this (and
remove the flag).
2022-04-08 14:03:55 -05:00
Daniel Uber
1a07ad8d9e
Profile attribute names should be unique and non-empty (#16396)
* transliterate when generating attribute names to avoid emptiness

If you enter a non-ascii (non `\w` matching) string as the profile
field label, the attribute name is the empty string.

This causes problems outlined in #16391

To avoid losing user provided data, transliterate (Sterile is the same
tool we're using for Article#title_to_slug) before matching against
the word regex.

If we persist an empty string, or persist a non-`\w` name, the
coordinating regex in Profile::ATTRIBUTE_NAME_REGEX will leave a nil
match and raise NoMethodError (the method missing is for
match[:attribute_name] when match was nil, not Profile - that's the
next commit.

* Guard against nil matches

If an attribute name doesn't match the regex, the match is nil, and
trying to access (nil)[:attribute_name] raises a NoMethodError.

If there was no match, assume profile does not respond to the
selector, and don't handle it in method missing.

* Ensure generated attribute name is valid before saving

This raises a validation error if the generated name (from the label)
would be empty.

It's not an optimal error message (since the user can't see the
internal attribute name) but it prevents persisting broken/empty data

* actually raise error when validating

validate/valid? only return true or false (and set errors on the
object). In order to reject the creation, we need to raise a
validation error, not only call validate. I think this is because the
execution of before_create hooks happens after validation (which is
why the validation was only checked on update, not create).

* Generate an attribute name completely independent of the field label

This prevents mistakenly labeling a field "Class" or "Association" or
one of the other hundred public methods an AR model like Profile
exposes. Since attribute_name will be passed to `profile.public_send`
we really shouldn't build selectors from user supplied inputs.

* Use the admin supplied label in the sidebar

The profile decorator is used in the Users#show page to populate the
sidebar fields. Don't use the attribute name (which we mangled during
creation, and now generate randomly) as the label, use the label.

* Make the label lookup null safe, and filter attributes more

* Update data update script to not expect predictable labels

This is low impact since it ran in july, but we no longer know what
attribute name a label will create.

* Fix moderator spec

"Test Field" label no longer predictably generates :test_field as an
attribute name. Ask the field what it's name is before asking profile
about it.

* Fix profile preview card request spec

Remove the assumption that profile responds to a method name based on
the label for Work and Education fields.

* Update old DUS and its test

This can probably be archived

* Update profile spec to use fields generated attribute names

We used to "know" how attributes were generated from labels. Now we don't.

* update e2e seeds for profile field change

* Don't expect attribute name to be based on the label

* expect created profile fields respond to their attribute name

* Update system test

The label, not the attribute name, is shown on the profile form (the
field has an id related to the attribute name, but the view shows the
mutable/human-readable label).

* Keep the field title lowercase when sending the json preview card

The userMetadata component expects "work" and "education" to be
attributes of the metadata, but the ui_attributes_for() method was
titlizing these (for display).

Ideally we wouldn't have "special purposed" these two field names, but
they're there.

* update profile field by attribute name, not based on label

* Update profile field removal assumptions

We don't know what the method selectors will be, we have to ask.

* remove old test

* Update translations for Education and Work

Since the ui_attributes_for(area:) now gives the label, not the
attribute, we need to match the label of the profile field.

Note to self: this exposes an issue in localizing the custom profile
fields (probably a bigger problem for large, international communities
like DEV than some others, but trying to match static translation
files against user-modifiable database records seems like a problem
we'll see again).

* Empty commit to retrigger buildkite

* Remove profile field migration update scripts

Cloned the specs from the other "remove unused scripts" script.

* Remove unused scripts

The data update script removes the entry from the table (recording
that these have run) - we also want to remove the files (preventing
them from running again).

* remove unneeded spec for removed file

* when translation for header area field not found, use the title

Only Work and Education already have keys in the yml translation file,
and there's not a great (or easy?) way to make multiple translations
on these fields right now.

Since an admin can create a new field, and assign it to the header
area, we can't assume the code has a configured translation key for
this field.

Fallback to the title (we do this in another context already) if
there's no translation.

* PR feedback: Avoid n+1 query for labels

the original implementation of "label_for_attribute" had an n+1 query
looping over each matched key.

Follow suggested improvement and pull labels and attributes at once
from the db and modify the returned hash.

* Downcase title before looking for translation key

This avoids putting "odd" capitalized keys into the yml translation
file

Revert addition of "Work" and "Education" to the users files.

* use a let binding for duplicated test data

* Update app/models/profile_field.rb

prefer SecureRandom.hex for a dashless uuid (instead of removing the dashes).

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2022-04-04 12:14:02 -05:00
Daniel Uber
f680bc8d53
Remove the connect feature flag (#17061)
There's an existing data update to introduce the connect feature flag,
and it's been disabled. However, since all the code relying on this is
now gone, it makes sense to remove the flag.
2022-03-30 14:51:45 -05:00
Daniel Uber
c6c30d58ab
Remove fastly http purge feature flag and conditional behavior (#16903)
* Always use purge, never post, to fastly

* Remove unneeded feature flag
2022-03-18 09:10:43 -05:00
Julianna Tetreault
aa44786ebd
Remove admin_member_view Feature Flag-Related Conditionals (#16764)
* Removes admin_member_view feature flags and refactors  conditionals

* Removes unused admin/users/_email_tools partial and user_email_tools_spec

* Actually remove the admin/user_email_tools_spec this time

* Removes the edit route from admin.rb users

* Adds a DUS (and spec) to disable and remove admin_member_view flag

* Fixes admin/users_spec.rb failures by updating spec with Member Detail changes

* Fixes spec failures within admin_bans_or_warns_user_spec.rb

* Refactors Admin::UsersController#credit_params due to failing specs

* Removes last traces of edit_admin_user_path and fixes buttons, specs, etc.
2022-03-10 08:29:05 -07:00
Fernando Valverde
06cec96324
Rebranding from passport to forem account (#16754) 2022-03-09 10:03:16 -06:00
Ridhwana
fc21eda0c1
feat: enable the feature flag across all Forems (#16700) 2022-03-01 10:46:43 -07:00
Daniel Uber
71a4c47181
Update identities where the auth data dump is a plain hash (#16676)
* Update identities where the auth data dump is a plain hash

All but 3 records in DEV have OmniAuth::AuthHash objects serialized as
auth data dump. Normalize the remaining ones so they don't cause no
method errors when we treat the auth_data_dump as an object (sending
`#info` instead of asking for `['info']`).

should address https://app.honeybadger.io/projects/66984/faults/84183659

Add null safety check in a second example (that null values should not
cause an error, and should not be coerced to auth hashes).

* Ignore rubocop suggestion to create list

Because the factory for identities doesn't automatically create the
required user object, this is impractical.

While I'm here, move the identity hash update into the creation block
rather than doing this in two passes.

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2022-02-23 14:14:14 -06:00
Julianna Tetreault
45b7806120
Remove Remaining logo_svg Code (#16291)
* Removes logo_svg-related code

* Removes logo_svg-related specs

* Removes the logo_uploader and logo_uploader DUS spec

* Removes the logo_uploader_spec.rb

* Adds a DUS to remove the logo_svg var from the DB

* Reverts the removal of the logo_svg_uploader.rb
2022-02-22 12:05:16 -07:00
Suzanne Aitchison
591981466b
remove detect_animated_images feature flag (#16621) 2022-02-17 15:27:48 +00:00
Jeremy Friesen
75ae759465
Short-circuiting parsing any articles to update (#16413)
* Short-circuiting parsing any articles to update

Setting a field that is to help track from where we received an image.

Related to #16075 and #16407.

See [Slack Thread][1] for all the details

[1]:https://forem-team.slack.com/archives/CSY5KKK9U/p1643916711077719

* Fix

* Apply suggestions from code review

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>

Co-authored-by: Jamie Gaskins <jgaskins@hey.com>
2022-02-04 11:13:01 -05:00
Jeremy Friesen
c17fa11875
Bypassing validiation for data script (#16407)
* Bypassing validiation for data script

Prior to this commit, we attempted to run a script against all articles
using validation.  In the case of DEV, we have lots of articles that
would no longer validate.  This change now updates the column value
without running validation.

Relates to #16075

* Bump for travis
2022-02-03 13:29:14 -05:00
VISHAL DEEPAK
14a945326d
Add boolean attribute main_image_from_frontmatter to indicate if cove… (#16075)
* Add boolean attribute main_image_from_frontmatter to indicate if cover image was set via frontmatter

* use article model spec for main_image_from_frontmatter test cases

* Add data migration script and spec for main_image_from_frontmatter for articles

* Update app/models/article.rb

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2022-02-03 09:16:48 -05:00
Suzanne Aitchison
0dd77bcf52
Fixes for home nav link positioning (#16381)
* Add new DUS to fix home nav link positioning

* fix bug in local db seeding
2022-02-01 14:06:51 +00:00
Suzanne Aitchison
f1864847e7
Make home link an admin-customisable navigation link (#16268)
* move home link to a customisable navlink

* add trailing slash for path

* update specs

* replace positions, set home link to -1

* add update script for adding home navigation link

* update data update script
2022-02-01 09:27:09 +00:00
Julianna Tetreault
5afcdb3f71
Add admin_member_view Feature Flag (#16346)
* Adds an admin_member_view feature flag and spec

* Adds the admin_member_view FeatureFlag to seeds_e2e for testing
2022-01-28 09:13:35 -07:00
Jeremy Friesen
0484c550c5
Create/update by NavigationLink identity (#16312)
Prior to this commit, we were treating all NavigationLink attributes as
unique.  So, were we to change a position of one of the NavigationLinks
during the add_navigation_links rake task, we would have created a new
NavigationLink (and the only one would have remained).

With this commit, we're introducing the concept of the NavigationLink's
surrogate identity, that is to say if we have two NavigationLink objects
with the same `url` and `name` we should consider them the same
NavigationLink.  This allows us to update properties of those
NavigationLinks (via the rake task) without the risk of creating new
entries.

This unblocks PR #16268 which addresses #16076.
2022-01-27 13:51:41 -05:00
Michael Kohl
38f7957e3a
Clear app cache during bin/setup (#16267) 2022-01-26 13:10:36 +07:00
Jeremy Friesen
fc8158a5ba
Stripping tags from "tags.short_summary" column (#16248)
On the DEV.to database, I ran the following SQL:

```sql
SELECT name, short_summary FROM tags WHERE short_summary LIKE '%<%';
```

There were three tags with a `<` in them:

- changelog
- cnc2018
- javascript

This PR will tidy up our short summary as part of saving a tag.  It will
also tidy up the existing tags.
2022-01-21 09:38:26 -05:00
Jeremy Friesen
711f1bb0cd
Let override of ToS and CoC show in onboarding (#16217)
* Let override of ToS and CoC show in onboarding

Prior to this commit any changes to the terms or code of conduct were
not reflected in the onboarding links.

With this commit, I'm leveraging a newly created method that first
checks if there's a page for the given slug.  If there is, use that
page's copy.

To test:

- Overwrite default /terms page on a Forem
- Navigate to /onboarding or sign up as a new user
- Click on Terms of Use link text
- Review Terms of Use

Closes #15296

* Adding spec around not passing a block
2022-01-20 19:45:39 -05:00
Josh Puetz
4f24c5ff43
Constantize broadcast messages (#16219) 2022-01-20 11:47:01 -06:00
Jeremy Friesen
e1a88d6f81
Allow for skipping navigation link creation (#16112)
* Allow for skipping navigation link creation

This commit provides a possible solution for preventing the re-creation
of a navigation link deleted by a Forem creator.

What I need is a discussion around the life-cycle of the application
installation and updates.

In particular, does this provide a robust enough mechanism for resolving
the issue at hand?

_Note: it pains me to ask about a user's role, but this is provided as a
point of discussion and possible implementationi to address the
underlying issue.  But I'm referencing a constant in the Rake task so
hopefully that will help future refactors.  Also, it's one reason I
needed to remove the `private_constant` declaration._

If we accept this code change, a future task is to document the ENV and
behavior.

Closes #15960

**Further considerations**:

- How might we refine this to not be as "role" reliant?
- Could we have a Site::Setting that we enable/disable
  regarding the navigation links?

Regarding QA:

- Start from an empty database
- Run setup
- Verify Navigation Link exists
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)
- Run seeds
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)

```shell
$ cd ./path/to/forem/repo

$ rails db:drop db:create db:schema:load

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails db:seed

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"c
  => false
```

* Bump for travis
2022-01-17 17:22:24 -05:00
Ridhwana
f3cb4238d2
Launch creator Onboarding with the Feature Flag [ To merge only on January 17 ] (#16090)
* feat: add the DUS script

* feat: enable the Feature Flag
2022-01-17 16:46:38 +02:00