mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 11:17:49 +01:00
Add env variables to test and fix some of them
This commit is contained in:
@@ -3,6 +3,8 @@ import { FormEvent } from 'react';
|
||||
|
||||
import IPostStatus from '../../interfaces/IPostStatus';
|
||||
|
||||
const NO_POST_STATUS_VALUE = 'none';
|
||||
|
||||
interface Props {
|
||||
postStatuses: Array<IPostStatus>;
|
||||
selectedPostStatusId: number;
|
||||
@@ -18,7 +20,7 @@ const PostStatusSelect = ({
|
||||
handleChange,
|
||||
}: Props) => (
|
||||
<select
|
||||
value={selectedPostStatusId || 'Loading...'}
|
||||
value={selectedPostStatusId || NO_POST_STATUS_VALUE}
|
||||
onChange={
|
||||
(e: FormEvent) => (
|
||||
handleChange(parseInt((e.target as HTMLSelectElement).value))
|
||||
@@ -34,7 +36,7 @@ const PostStatusSelect = ({
|
||||
))}
|
||||
</optgroup>
|
||||
<optgroup label="No post status">
|
||||
<option value="none">None</option>
|
||||
<option value={NO_POST_STATUS_VALUE}>None</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
class User < ApplicationRecord
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
:recoverable, :rememberable, :validatable,
|
||||
:confirmable
|
||||
|
||||
self.send(:devise, :confirmable) if Rails.application.email_confirmation?
|
||||
|
||||
has_many :comments
|
||||
|
||||
enum role: [:user, :moderator, :admin]
|
||||
after_initialize :set_default_role, if: :new_record?
|
||||
after_initialize :skip_confirmation, if: :new_record?
|
||||
|
||||
validates :full_name, presence: true, length: { in: 2..32 }
|
||||
|
||||
@@ -15,6 +15,13 @@ class User < ApplicationRecord
|
||||
self.role ||= :user
|
||||
end
|
||||
|
||||
def skip_confirmation
|
||||
return if Rails.application.email_confirmation?
|
||||
skip_confirmation!
|
||||
skip_confirmation_notification!
|
||||
skip_reconfirmation!
|
||||
end
|
||||
|
||||
def gravatar_url
|
||||
gravatar_id = Digest::MD5::hexdigest(email.downcase)
|
||||
"https://secure.gravatar.com/avatar/#{gravatar_id}"
|
||||
|
||||
Reference in New Issue
Block a user