Fix Forem Ownership Field (#14730)

* fix: mistakenly renamed forem_owner_secret to owner_secret

* chore: revert change from merge

* refactor: use the Forem Instance model

* extra .
This commit is contained in:
Ridhwana 2021-09-16 12:56:59 +02:00 committed by GitHub
parent 0c164b9648
commit 69b4c6c5e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 8 deletions

View file

@ -58,7 +58,11 @@ will share this change with the people who need to know about it._
- [ ] I've updated the [Developer Docs](https://developers.forem.com) or
[Storybook](https://storybook.forem.com/) (for Crayons components)
- [ ] This PR changes the Forem platform and our documentation needs to be updated. I have filled out the [Changes Requested](https://github.com/forem/admin-docs/issues/new?assignees=&labels=&template=changes_requested.md) issue template so Community Success can help update the Admin Docs appropriately.
- [ ] This PR changes the Forem platform and our documentation needs to be
updated. I have filled out the
[Changes Requested](https://github.com/forem/admin-docs/issues/new?assignees=&labels=&template=changes_requested.md)
issue template so Community Success can help update the Admin Docs
appropriately.
- [ ] I've updated the README or added inline documentation
- [ ] I've added an entry to
[`CHANGELOG.md`](https://github.com/forem/forem/tree/main/CHANGELOG.md)

View file

@ -1494,7 +1494,10 @@ export class Chat extends Component {
? state.activeChannel.channel_name
: ' ';
const connectAnnouncement = (
<div className="bg-base-90 color-base-0 p-3 align-center fs-s m:fs-base lh-tight" aria-live="polite">
<div
className="bg-base-90 color-base-0 p-3 align-center fs-s m:fs-base lh-tight"
aria-live="polite"
>
We have made the decision to deprecate Connect as core functionality
from the application. &nbsp;
<a

View file

@ -35,4 +35,8 @@ class ForemInstance
def self.private?
!Settings::UserExperience.public?
end
def self.needs_owner_secret?
ENV["FOREM_OWNER_SECRET"].present? && Settings::General.waiting_on_first_user
end
end

View file

@ -84,14 +84,13 @@
<p id="password-helper-text" class="fs-xs color-base-60 mt-1">Minimum 8 characters</p>
</div>
<% needs_owner_secret_field = ENV["FOREM_OWNER_SECRET"].present? && Settings::General.waiting_on_first_user %>
<% if needs_owner_secret_field %>
<% if params[:owner_secret].present? %>
<%= f.hidden_field :owner_secret, value: params[:owner_secret] %>
<% if ForemInstance.needs_owner_secret? %>
<% if params[:forem_owner_secret].present? %>
<%= f.hidden_field :forem_owner_secret, value: params[:forem_owner_secret] %>
<% else %>
<div class="crayons-field mt-6">
<%= f.label :owner_secret, "New Forem Secret", class: "crayons-field__label" %>
<%= f.password_field :owner_secret, class: "crayons-textfield", required: needs_owner_secret_field, placeholder: "As provided by your Forem host" %>
<%= f.label :forem_owner_secret, "New Forem Secret", class: "crayons-field__label" %>
<%= f.password_field :forem_owner_secret, class: "crayons-textfield", required: ForemInstance.needs_owner_secret?, placeholder: "As provided by your Forem host" %>
</div>
<% end %>
<% end %>