Commit graph

43 commits

Author SHA1 Message Date
Joshua Wehner
6fe9d7d7a6
Allow org admins to add members as co-authors (#20008)
* Basics might be working?

* Stop propagating button clicks in autocomplete pills

* Better blank slate

* Better location to stop propagation

* Remove author_id from org co-authors

* Move UserStore and try testing it

* Remove extraneous comments

* OH... that's what that does!

* Very basic testing

* Re-organize javascripts

* Rename & re-org for testing

* Cleanup

* More tests

* Remove unnecessary nesting

* Coninuing to try to bump coverage

* Include /packs/ in code coverage metric

* Try tweaking jest coverage more?

We probably can't collect coverage from all of packs/* (because coverage is too low) but maybe we can try to opt-in for newer areas as we go?

* Relocate JS tests, for build & coverage

* User ID exception on search, not fetch

* Remove commented-out console.log

---------

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-09-15 08:12:41 -04:00
Ridhwana
272aea6127
Allow admins to delete an organization (#19699)
* feat: update the layout for organizations

* feat: update the layout for an organization

* feat: organization logos are square

* feat: change the text on the org visit button

* feat: initialize the dropdown menu

* feat: trigger the  modal

* feat: update the text in the model

* feat: tweak wording

* WIP/feat: hook up a route with an action that calls an organization delete worker.

* feat: redirect after showing the notice

* feat: update the authorization required to be super admin

* feat: add the notice to localization

* spec: integration test

* spec: fix

* spec: delete worker

* chore: update the link

* feat: add safe navigation

* feat: make sure that we show an error if the organization has credits

* fix: error message for modal unspent credits

* feat add the spec for the helper

* fix: remove rspec preface

* fix: small fixes to tests and I18n

* fix: updated the number of orgs

* feat: update the message

* feat: update the message

* chore: remove inclusion of helper

* feat: change the name of the parameter

* chore: newline
2023-07-17 12:09:24 +02:00
Rajat Talesra
28b8980c76
Organisation members page to show all users (#19611)
* Basic implementations

* Working implementation

* See all button added

* Added tests for See All Members button

* Added click test

* Grid design

* Nit fix to trigger build failure

* Applied design changes

* Nit design fixes

* Revert limit

* Applied Ben's suggestion

* Removed fixed hight

* Grid layout changes

* Updated test

* Indentation fix

* Added members page test
2023-06-28 12:35:15 +05:30
Dhanujha R
857dd285d5
Remove Dark and Light Nav Logo Image from Organization (#19309) 2023-05-08 17:01:03 -04:00
yheuhtozr
c4778d832e
app/controllers & decorators i18n (#16126)
* app/controllers (& decorators) i18n etc

* tidy key names

* update keys

* delete ja.yml

* delete an involved ja.yml

* fix for PR review

* fix for spec

* delete ja.yml
2022-02-03 13:35:56 -05:00
praveen raghav ns
4b8576aec3
Use constants for Permitted params in controller (#14895)
* Use constants for controller permitted params

* User constants for controller set 2

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2021-10-05 09:00:14 -04:00
dependabot[bot]
816855ce3b
Bump rubocop from 1.17.0 to 1.18.0 (#14107)
* Bump rubocop from 1.17.0 to 1.18.0

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* yarn install

* Fix violations

* Restore the default aligned setting

* Trigger Travis CI

* Escape HTML

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-07-01 13:51:49 +02:00
Anna Buianova
ba1c13bbb6
Asynchronous organization delete (#13388)
* Asynchronous organization destroy

* Notification after an organization was deleted

* Send data to Datadog and Honeybadger when org deletion failed

* Delete unused code

* Fixed Organization#destroyable? and organization delete specs

* Reorganized organization deletion specs

* Removed redundant specs

* Improved org deleted email text template

* Don't peform the org delete when a user or an org were not found

* Renamed user_id in the org delete worker

* Audit logging when deleten an organization

* Removed specs for tracking pixel and UTM params

* Changed slug for audit log on org delete

* Fixed schema.rb
2021-04-19 18:30:35 +03:00
Alex
eca7be8201
Update bust_user to EdgeCache::BustUser (#12051) 2020-12-29 09:53:00 +01:00
Andy Zhao
5ae4650e46
Invalidate cache for all org users' profiles (#11796) 2020-12-08 07:56:13 -05:00
rhymes
68b320a1de
Add contact email to SiteConfig and replace default where appropriate (#11630)
* Add a new contact email to use in place of default

* Replace :default with :contact email in all non transactional emails

* Add missing expectation
2020-11-27 16:39:38 +01:00
Alexis Moody
f4a10e4a44
[deploy] Adds a new admin setting for experience levels. (#10870)
* Adds a new admin setting for experience levels.

This is used in the post management UI to determine the range of experience. These values fallback to the ones we currently see in DEV, Total Newbies and Senior Devs. There is also a removal of the word coding when talking about experience level, since the context for each forem instance should be implied when referencing experience.

* Cleans up experience defaults

* Fixes instance_of usage
2020-10-16 12:40:25 -06:00
Michael Kohl
1a44d717fc
[deploy] Move settings tabs to constant (#10859) 2020-10-16 08:30:58 +07:00
Andy Zhao
a589529269
[deploy] Allow org admins to delete their organizations (#9357)
* Add destroy organization backend

* Add view for deleting org

* Add new line to end of file

* Refactor and move destroyable? to model

* Use a nice card to distinguish the message

* Prevent organizations from being deleted if they have credits

* Fix codeclimate issues

* Remove let_it_be_changeable for flakiness
2020-07-28 12:00:15 -04:00
rhymes
f1ec04a0c9
Rubocop: move dot in multi-line calls to leading position (#9262) 2020-07-16 15:51:11 +02:00
rhymes
3ab9b91575
Routine Rubocop fixes (#9302)
* rubocop -A

* rubocop --auto-gen-config

* Fix sorting in Bundler/OrderedGems to consider punctuation
2020-07-14 17:24:03 +02:00
rhymes
5b62811c98
[deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
Alex
004dbba500
[deploy] Remove logging of image data to Datadog (#7829) 2020-05-13 16:23:42 -04:00
rhymes
e28664c67f
[deploy] Render the correct partial when editing an organization fails (#7765) 2020-05-11 12:32:49 -04:00
Molly Struve
930ccdccf5
[deploy] Refactor Tracking Rate Limits for Actions (#7668) 2020-05-04 13:05:53 -05:00
Molly Struve
ba0ebbafa8
[deploy] RateLimit Refactor: Consolidate Logic for Checking a Limit and Raising an Error (#7636) 2020-05-01 13:31:44 -05:00
Alex
5060652939
Validate images are files (#7639)
* Validate images are files

* Skip image validation if there aren't any images
2020-05-01 10:39:20 -04:00
Molly Struve
74e75b4067
[deploy] Rate Limit Organization Creation (#7595) 2020-04-30 10:55:37 -05:00
Alex
b6664456c0
[deploy] Validate filenames server-side (#7405) 2020-04-23 14:30:59 -05:00
Alex
83e92cbfd3
Rescue error and add specs (#7292) 2020-04-15 10:34:00 -04:00
Anna Buianova
bef07a5834
Add nav_image and dark_nav_image fields to org settings form (#6336) [deploy] 2020-02-27 17:33:52 -05:00
Molly Struve
ac8e5b4fb0
Return not_found error if org is not found (#5179) [deploy] 2019-12-19 10:53:50 -06:00
John Curcio
1a8132f892 Fix encoding of special characters on organization page rendering (#3944) 2019-09-09 14:13:23 -04:00
John Curcio
c81ff56d13 Fix encoding of special characters in org (#3779) (#3817) 2019-08-24 15:08:31 -04:00
Feruz Oripov
c0e1ad0e46 Refactoring organizations_controller.rb. Adding set_organization method (#3793)
for not repeating query code.
2019-08-22 20:54:53 -04:00
Andy Zhao
47d9ec27fb Allow users to belong to multiple orgs (#2583)
* Allow user to have many orgs

* Allow users to handle multi orgs in settings

* Make rounded buttons inline

* Add multi org function to dashboards

* Fix merge conflicts

* Fix mistake in merge conflict fix oops

* Display the correct membership level

* Fix accessibility issues

* Display organizations for article editors

* Handle submitting org id with preact editors

* Make listings work with multiple organizations

* Allow listings to have multiple orgs on create

* Display the correct number of credits for each org

* Move script tag to Webpack

* Allow multi orgs for purchasing and viewing credits

* Use OrganizationMembership as authorization check

* Display multiple organizations for notifications

* Allow dashboard to be viewable under multi-orgs

* Remove unused method

* Add multi-org functionality for article editors

* Show pro dashboard buttons for member+ org levels

* Leave the correct organization

* Allow article API to change org id

* Add left-out authorization method oops

* Make nav buttons a bit more clear

* Fix merge conflict

* Fix adding org id for /api/articles and tests

* Fix tests for org policy

* Use proper logic for displaying org members

* Update org actions with new authorization

* Use correct org when creating a listing

* Remove additional payment charge oops

* Mark org notifications as read with authorization

* Remove deprecated post_as_organization attribute

* Use new org_admin syntax

* Remove deprecated org logic for article create and update

* Default all RSS posts to not belong to any org

* Render org_member page for guest users

* Update org policy spec to work with multi orgs

* Use org_membership for org traits and move identity code

* Use org_member trait

* Update to work with multi-orgs

* Validate article's org_id if param org_id is blank

* Make  a let variable

* Remove unnecessary eager load for credits

* Fix HTML structure and org logic for non-org users

* Update credits spec for multi-org

* Add test for failed payment when purchased by org

* Lint listings_spec

* Test that the listing was created under the user

* Add tests for POST /listings multi-org

* Use double quotes for classes

* Fix /manage and a few other multi-org bugs

* Fix test for multi org

* Use correct method SQL exists? not Rails exist?

* Fix reads spec for multi-org

* Fix org_controller actions to work with multi org

* Test only multi org and not old usage and fix leave_org

* Fix org showing user profile img test for multi-org

* Fix org logic for users with no orgs

* Remove switch org functionality

* Update tests and add hidden param for org id

* Redirect to the specific organization

* Test other org button actions

* Use settings_notice instead of legacy notice and refactor

* Fix weird extra end issue prob from merge conflicts

* Test for with new flash key

* Fix user_views_org tests for multi-org

* Test for new flash message

* Update snapshot with new a11y html

* Move styling to stylesheet

* Add site admins functionality

* Move org_member? method in user model and refactor

* Use unspent_credits_count for organizations

* Add tests for /listings/new and minor bug fixes

* Use .present? in case of empty array

* Fix a lingering deprecated method

* Use greater than 1 for random numbers

* Add tests for counting spent and unspent credits
2019-06-04 09:30:52 -04:00
Andy Zhao
182a787ac4 Add OrganizationMembership model (#2471)
* Remove deprecated analytics role

* Make anchor tag a bit more readable

* Add OrganizationMembership table and model

* Add organization_membership associations

* Add unique indices for user_id and org_id

* Wrap update and create calls in transactions

* Remove specs of deprecated analytics_beta_tester
2019-04-22 14:08:02 -04:00
rhymes
0d24dee4f0 Use touch a little bit less (#2395) 2019-04-11 23:43:54 -04:00
Abraham Williams
9cb40e546b Enables Rails cops (#2186)
* Enable Rails cops

* Fix Rails/DynamicFindBy

* Fix Rails/HttpStatus

* Fix Rails/Blank

* Fix Rails/RequestReferer

* Fix Rails/ActiveRecordAliases

* Fix Rails/FindBy

* Fix Rails/Presence

* Fix Rails/Delegate

* Fix Rails/Validation

* Fix Rails/PluralizationGrammar

* Fix Rails/Present

* Fix Rails/Output

* Fix Rails/Blank

* Fix Rails/FilePath

* Fix Rails/InverseOf

* Fix Rails/LexicallyScopedActionFilter

* Add Rails/OutputSafety to TODO

* Add Rails/HasManyOrHasOneDependent to TODO

* Add Rails/SkipsModelValidations to TODO
2019-03-25 09:25:55 -04:00
Ben Halpern
71a419e5ee
Add profile_updated_at and github_repos_updated_at to avoid extra fet… (#1754)
* Add profile_updated_at and github_repos_updated_at to avoid extra fetches

* Fix variant_number issue

* Fix test
2019-02-06 20:39:15 -04:00
rhymes
6553f08d94 Rubocop cleanups (#1415)
* Update rubocop-todo.yml with new violations

* Fix Layout/EmptyLine* rules

* Fix Layout/Indentation* rules

* Fix remaining Layout/* rules

* Fix Lint/DuplicateMethods by removing unused accessor

* Fix Lint/IneffectiveAccessModifier

* Fix Lint/MissingCopEnableDirective

* Re-run rubocop auto gen config

* Fix Layout/RescueEnsureAlignment

* Fix Naming/* rules

* Fix some RSpec/* rules

* Fix typos

* Fix RSpec/LetBeforeExamples

* Series should only be an attr_writer, not an attr_accessor

* Fix RSpec/InstanceVariable

* Fix RSpec/InstanceVariable

* Fix RSpec/RepeatedDescription and RSpec/RepeatedExample

* Fix Style/ClassAndModuleChildren

* Fix Style/ConditionalAssignment

* Fix some Style/* rules

* Trigger Travis CI build because failing tests are not failing locally

* Revert "Fix Style/ClassAndModuleChildren"

This reverts commit 1686801d8a1516ba1894f79e24401a20dea65f99.
2019-01-02 11:20:02 -05:00
Ben Halpern
f4f4af776c
Fix issue where only approved orgs could make CTAs (#1017)
* Fix issue where only approved orgs could make CTAs

* Adjust articles api
2018-10-27 13:03:56 -04:00
Edem Attikese
0ad8cd9eab Edem/improvements/pundit coverage (#498)
* added organization policy + spec

* user specs for is_org_admin?

* added authroize to organization controller

* admin policy + specs

* deleted enforce admin due to pundit policy redundancy

* applied admin policy to entire admin namespace

* refactoring analytics controller WIP - wanna test codeship

* Add protection against reactions to unpublished articles (#473)

* Add chat channel policy and spec (#474)

* Add comment policy and specs (#475)

* Fix edge case with apostrophes

* Add comment policy and specs

* Add login for deleting comment spec

* Change test to raise pundit error instead of 404

* Clean up comment destroy request specs

* Remove redundant raise

* Whitelist columns on to_json call (#477)

* Add pundit policy for several controllers (#476)

* Add pundit policy for several controllers

* Adjust video spec

* Fix tag request specs

* Add proper twilio tokens request specs

* Remove puts statements

* Add a couple basic request specs (#478)

* Add a few tests and fix user tag color bug (#482)

* Refactor handle_tag_index in stories_controller (#481)

* Modify valid_request_origin? (#483)

* Add misc specs and remove banned attribute from user model (#484)

*  Fix missing Cloudinary tags and misc specs (#486)

* removing current_user_is_admin? to use .is_admin? method

* added missing org policy routes

* Add comment for all public controllers

* Fix edge case for test

* Authorize mod controller and add specs

* Refactor methods via inheritance and use only super_admin role

* Create policy method for analytics via article_policy and refactor

* Capitalize all buttons in dashboard page

* Fix org tests and remove old admin test

* Use only happy path for analytics

* Fix tests to use Pundit error

* Update org_policy spec
2018-06-28 09:38:20 -04:00
Mac Siri
dd5a22dc80 Create UserPolicy (#480)
* Fix lint

* Create User#settings_tab_list

* Remove UsersController#finish_signup

* Remove UsersController#index

* Create UserPolicy WIP

* Replace UsersController's spec with request spec

* Fix broken specs

* Fix broken specs

* Remove comment

* Upgrade UserPolicy

* Fix specs
2018-06-22 20:40:08 -04:00
Ben Halpern
f073eb5754
Add badges and org cta (#324)
* Make org proof a required field

* Fix color picker and other minor org adjustments

* Add MVP of org add'l sidebar

* Add proof to org factory

* Fix org create action and fix tests

* Add new org fields to admin panel & lint

* Add proof to org edit for backward compatibility

* Add org info to edit preview

* Move preview edit notice to inside article div

* MVP of badge "final" steps

* Add info to user sidebar and clean up badge commit

* Modify sidebar for data

* Add organization decorator

* Add conditional so only users have new swipe nav, not orgs

* Add cloudinary prefix to badges

* Disallow duplicate badges
2018-05-17 18:22:37 -04:00
Ben Halpern
c1e623ebc2
Add additional content boxes under posts (#86)
* Add additional content boxes under posts

* Fix issue with classic article for under content
2018-03-16 16:35:54 -04:00
Andy Zhao
4d2af96d8d Fix a few org related issues and some other minor bugs (#74)
* Add CSRF tags to welcome index page

* Clean up auth service code a bit

* Add analytics role to approved org org_admins

* Add toggle links for org admins with no posts

* Fix wrong role name and add test

* Adjust validation for user fields

* Add test for user_role_service

* Fix confusing boolean
2018-03-15 11:39:53 -04:00
Mac Siri
301c6080e3 Initial commit 2018-02-28 16:11:08 -05:00