Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gab-social
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
gab
social
gab-social
Commits
6e17b7c1
Commit
6e17b7c1
authored
Sep 10, 2020
by
mgabdev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated GroupCategory functionality with Groups
• Updated: - GroupCategory functionality with Groups
parent
217aab9f
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
13 deletions
+53
-13
app/controllers/api/v1/groups_controller.rb
app/controllers/api/v1/groups_controller.rb
+3
-1
app/javascript/gabsocial/actions/group_editor.js
app/javascript/gabsocial/actions/group_editor.js
+2
-2
app/javascript/gabsocial/components/panel/group_info_panel.js
...javascript/gabsocial/components/panel/group_info_panel.js
+22
-4
app/javascript/gabsocial/features/group_create.js
app/javascript/gabsocial/features/group_create.js
+1
-1
app/javascript/gabsocial/reducers/group_editor.js
app/javascript/gabsocial/reducers/group_editor.js
+1
-1
app/models/group.rb
app/models/group.rb
+5
-1
db/migrate/20200908210102_remove_group_categories_id_from_group.rb
...e/20200908210102_remove_group_categories_id_from_group.rb
+5
-0
db/migrate/20200908210103_add_foreign_key_to_group_for_group_category.rb
...0908210103_add_foreign_key_to_group_for_group_category.rb
+6
-0
db/migrate/20200908210104_validate_add_foreign_key_to_group_for_group_category.rb
...4_validate_add_foreign_key_to_group_for_group_category.rb
+5
-0
db/schema.rb
db/schema.rb
+3
-3
No files found.
app/controllers/api/v1/groups_controller.rb
View file @
6e17b7c1
...
...
@@ -89,6 +89,8 @@ class Api::V1::GroupsController < Api::BaseController
end
def
group_params
params
.
permit
(
:title
,
:cover_image
,
:description
,
:is_private
,
:tags
,
:is_visible
,
:group_categories_id
,
:slug
)
thep
=
params
.
permit
(
:title
,
:password
,
:cover_image
,
:description
,
:is_private
,
:tags
,
:is_visible
,
:group_category_id
,
:slug
)
thep
[
:tags
]
=
thep
[
:tags
].
split
(
","
)
unless
thep
[
:tags
].
nil?
thep
end
end
app/javascript/gabsocial/actions/group_editor.js
View file @
6e17b7c1
...
...
@@ -62,7 +62,7 @@ const create = (options, routerHistory) => (dispatch, getState) => {
formData
.
append
(
'
title
'
,
options
.
title
)
formData
.
append
(
'
description
'
,
options
.
description
)
formData
.
append
(
'
tags
'
,
options
.
tags
)
formData
.
append
(
'
group_categor
ies
_id
'
,
options
.
category
)
formData
.
append
(
'
group_categor
y
_id
'
,
options
.
category
)
formData
.
append
(
'
is_private
'
,
options
.
isPrivate
)
formData
.
append
(
'
is_visible
'
,
options
.
isVisible
)
...
...
@@ -105,7 +105,7 @@ const update = (groupId, options, routerHistory) => (dispatch, getState) => {
formData
.
append
(
'
title
'
,
options
.
title
)
formData
.
append
(
'
description
'
,
options
.
description
)
formData
.
append
(
'
tags
'
,
options
.
tags
)
formData
.
append
(
'
group_categor
ies
_id
'
,
options
.
category
)
formData
.
append
(
'
group_categor
y
_id
'
,
options
.
category
)
formData
.
append
(
'
is_private
'
,
options
.
isPrivate
)
formData
.
append
(
'
is_visible
'
,
options
.
isVisible
)
formData
.
append
(
'
slug
'
,
options
.
slug
)
...
...
app/javascript/gabsocial/components/panel/group_info_panel.js
View file @
6e17b7c1
import
React
from
'
react
'
import
PropTypes
from
'
prop-types
'
import
{
connect
}
from
'
react-redux
'
import
{
NavLink
}
from
'
react-router-dom
'
import
{
defineMessages
,
injectIntl
}
from
'
react-intl
'
import
ImmutablePureComponent
from
'
react-immutable-pure-component
'
import
ImmutablePropTypes
from
'
react-immutable-proptypes
'
import
moment
from
'
moment-mini
'
import
{
shortNumberFormat
}
from
'
../../utils/numbers
'
import
slugify
from
'
../../utils/slugify
'
import
PanelLayout
from
'
./panel_layout
'
import
Button
from
'
../button
'
import
Divider
from
'
../divider
'
...
...
@@ -39,6 +41,7 @@ class GroupInfoPanel extends ImmutablePureComponent {
const
isPrivate
=
!!
group
?
group
.
get
(
'
is_private
'
)
:
false
const
isVisible
=
!!
group
?
group
.
get
(
'
is_visible
'
)
:
false
const
tags
=
!!
group
?
group
.
get
(
'
tags
'
)
:
[]
const
groupCategory
=
!!
group
?
group
.
getIn
([
'
group_category
'
,
'
text
'
],
null
)
:
null
const
descriptionHTML
=
!!
group
?
{
__html
:
group
.
get
(
'
description_html
'
)
}
:
{}
if
(
noPanel
)
{
...
...
@@ -143,11 +146,26 @@ class GroupInfoPanel extends ImmutablePureComponent {
<
/Button
>
<
/GroupInfoPanelRow
>
<
Divider
isSmall
/>
{
!!
groupCategory
&&
<
React
.
Fragment
>
<
Divider
isSmall
/>
<
GroupInfoPanelRow
title
=
{
intl
.
formatMessage
(
messages
.
category
)}
icon
=
'
apps
'
>
<
Text
>
General
<
/Text
>
<
/GroupInfoPanelRow
>
<
GroupInfoPanelRow
title
=
{
intl
.
formatMessage
(
messages
.
category
)}
icon
=
'
apps
'
>
<
Button
isText
color
=
'
brand
'
backgroundColor
=
'
none
'
className
=
{
_s
.
mlAuto
}
to
=
{
`/groups/browse/categories/
${
slugify
(
groupCategory
)}
`
}
>
<
Text
color
=
'
inherit
'
weight
=
'
medium
'
size
=
'
normal
'
className
=
{
_s
.
underline_onHover
}
>
{
groupCategory
}
<
/Text
>
<
/Button
>
<
/GroupInfoPanelRow
>
<
/React.Fragment
>
}
<
Divider
isSmall
/>
...
...
app/javascript/gabsocial/features/group_create.js
View file @
6e17b7c1
...
...
@@ -134,7 +134,7 @@ class GroupCreate extends ImmutablePureComponent {
const
memberCount
=
group
?
group
.
get
(
'
member_count
'
)
:
0
const
hasGroupSlug
=
group
?
!!
group
.
get
(
'
slug
'
)
:
false
let
categoriesOptions
=
[]
let
categoriesOptions
=
[
{
'
title
'
:
''
,
value
:
''
}
]
if
(
categories
)
{
for
(
let
i
=
0
;
i
<
categories
.
count
();
i
++
)
{
const
c
=
categories
.
get
(
i
)
...
...
app/javascript/gabsocial/reducers/group_editor.js
View file @
6e17b7c1
...
...
@@ -53,7 +53,7 @@ export default function groupEditorReducer(state = initialState, action) {
map
.
set
(
'
isPrivate
'
,
action
.
group
.
get
(
'
is_private
'
))
map
.
set
(
'
isVisible
'
,
action
.
group
.
get
(
'
is_visible
'
))
map
.
set
(
'
id
'
,
action
.
group
.
get
(
'
slug
'
))
map
.
set
(
'
category
'
,
action
.
group
.
get
(
'
category
'
))
map
.
set
(
'
category
'
,
action
.
group
.
get
In
([
'
group_category
'
,
'
id
'
],
null
))
map
.
set
(
'
isSubmitting
'
,
false
)
})
case
GROUP_EDITOR_TITLE_CHANGE
:
...
...
app/models/group.rb
View file @
6e17b7c1
...
...
@@ -20,11 +20,13 @@
# is_private :boolean default(FALSE)
# is_visible :boolean default(FALSE)
# tags :string default([]), is an Array
# group_categories_id :bigint(8)
# password :string
# group_category_id :integer
#
class
Group
<
ApplicationRecord
self
.
ignored_columns
=
[
"group_categories_id"
]
include
Paginable
include
GroupInteractions
include
GroupCoverImage
...
...
@@ -45,6 +47,8 @@ class Group < ApplicationRecord
has_many
:group_removed_accounts
,
inverse_of: :group
,
dependent: :destroy
has_many
:removed_accounts
,
source: :account
,
through: :group_removed_accounts
belongs_to
:group_categories
,
optional:
true
,
foreign_key:
'group_category_id'
validates
:title
,
presence:
true
validates
:description
,
presence:
true
...
...
db/migrate/20200908210102_remove_group_categories_id_from_group.rb
0 → 100644
View file @
6e17b7c1
class
RemoveGroupCategoriesIdFromGroup
<
ActiveRecord
::
Migration
[
5.2
]
def
change
safety_assured
{
remove_column
:groups
,
:group_categories_id
}
end
end
db/migrate/20200908210103_add_foreign_key_to_group_for_group_category.rb
0 → 100644
View file @
6e17b7c1
class
AddForeignKeyToGroupForGroupCategory
<
ActiveRecord
::
Migration
[
5.2
]
def
change
add_column
:groups
,
:group_category_id
,
:integer
add_foreign_key
:groups
,
:group_categories
,
on_delete: :nullify
,
validate:
false
end
end
db/migrate/20200908210104_validate_add_foreign_key_to_group_for_group_category.rb
0 → 100644
View file @
6e17b7c1
class
ValidateAddForeignKeyToGroupForGroupCategory
<
ActiveRecord
::
Migration
[
5.2
]
def
change
validate_foreign_key
:groups
,
:group_categories
end
end
db/schema.rb
View file @
6e17b7c1
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_09_0
1_165533
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_09_0
8_210104
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_stat_statements"
...
...
@@ -391,10 +391,9 @@ ActiveRecord::Schema.define(version: 2020_09_01_165533) do
t
.
boolean
"is_private"
,
default:
false
t
.
boolean
"is_visible"
,
default:
false
t
.
string
"tags"
,
default:
[],
array:
true
t
.
bigint
"group_categories_id"
t
.
string
"password"
t
.
integer
"group_category_id"
t
.
index
[
"account_id"
],
name:
"index_groups_on_account_id"
t
.
index
[
"group_categories_id"
],
name:
"index_groups_on_group_categories_id"
t
.
index
[
"slug"
],
name:
"index_groups_on_slug"
,
unique:
true
end
...
...
@@ -959,6 +958,7 @@ ActiveRecord::Schema.define(version: 2020_09_01_165533) do
add_foreign_key
"group_pinned_statuses"
,
"statuses"
,
on_delete: :cascade
add_foreign_key
"group_removed_accounts"
,
"accounts"
,
on_delete: :cascade
add_foreign_key
"group_removed_accounts"
,
"groups"
,
on_delete: :cascade
add_foreign_key
"groups"
,
"group_categories"
,
on_delete: :nullify
add_foreign_key
"identities"
,
"users"
,
name:
"fk_bea040f377"
,
on_delete: :cascade
add_foreign_key
"imports"
,
"accounts"
,
name:
"fk_6db1b6e408"
,
on_delete: :cascade
add_foreign_key
"invites"
,
"users"
,
on_delete: :cascade
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment