Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hivemind
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
hivemind
Commits
ab3b90f5
Commit
ab3b90f5
authored
5 years ago
by
roadscape
Browse files
Options
Downloads
Patches
Plain Diff
update docs for settings props, validate avatar url protocol
parent
6020a059
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/communities.md
+3
-0
3 additions, 0 deletions
docs/communities.md
hive/indexer/community.py
+7
-2
7 additions, 2 deletions
hive/indexer/community.py
with
10 additions
and
2 deletions
docs/communities.md
+
3
−
0
View file @
ab3b90f5
...
@@ -147,6 +147,9 @@ Can be stored as a JSON dictionary.
...
@@ -147,6 +147,9 @@ Can be stored as a JSON dictionary.
-
`description`
: a blob of markdown to describe purpose, enumerate rules, etc. (5000 chars)
-
`description`
: a blob of markdown to describe purpose, enumerate rules, etc. (5000 chars)
-
`flag_text`
: custom text for reporting content
-
`flag_text`
: custom text for reporting content
-
`settings': json dict; recognized keys:
-
`settings': json dict; recognized keys:
- `
avatar_url
` - same format as account avatars; usually rendered as a circle
- `
cover_url
` - same format as account covers; used as header background image
- `
default_view
` = `
list | blog | grid
` - default post display
- `
bg_color
`: background color - hex-encoded RGB value (e.g. `
#EEDDCC
`)
- `
bg_color
`: background color - hex-encoded RGB value (e.g. `
#EEDDCC
`)
- `
bg_color2
`: background color - hex-encoded RGB value (if provided, creates a gradient)
- `
bg_color2
`: background color - hex-encoded RGB value (if provided, creates a gradient)
...
...
This diff is collapsed.
Click to expand it.
hive/indexer/community.py
+
7
−
2
View file @
ab3b90f5
...
@@ -43,6 +43,10 @@ LANGS = ("ab,aa,af,ak,sq,am,ar,an,hy,as,av,ae,ay,az,bm,ba,eu,be,bn,bh,bi,"
...
@@ -43,6 +43,10 @@ LANGS = ("ab,aa,af,ak,sq,am,ar,an,hy,as,av,ae,ay,az,bm,ba,eu,be,bn,bh,bi,"
"
st,es,su,sw,ss,sv,ta,te,tg,th,ti,bo,tk,tl,tn,to,tr,ts,tt,tw,ty,
"
"
st,es,su,sw,ss,sv,ta,te,tg,th,ti,bo,tk,tl,tn,to,tr,ts,tt,tw,ty,
"
"
ug,uk,ur,uz,ve,vi,vo,wa,cy,wo,fy,xh,yi,yo,za
"
).
split
(
'
,
'
)
"
ug,uk,ur,uz,ve,vi,vo,wa,cy,wo,fy,xh,yi,yo,za
"
).
split
(
'
,
'
)
def
_valid_url_proto
(
url
):
assert
url
return
url
[
0
:
7
]
==
'
http://
'
or
url
[
0
:
8
]
==
'
https://
'
def
assert_keys_match
(
keys
,
expected
,
allow_missing
=
True
):
def
assert_keys_match
(
keys
,
expected
,
allow_missing
=
True
):
"""
Compare a set of input keys to expected keys.
"""
"""
Compare a set of input keys to expected keys.
"""
if
not
allow_missing
:
if
not
allow_missing
:
...
@@ -531,8 +535,9 @@ class CommunityOp:
...
@@ -531,8 +535,9 @@ class CommunityOp:
settings
=
read_key_dict
(
props
,
'
settings
'
)
settings
=
read_key_dict
(
props
,
'
settings
'
)
out
[
'
settings
'
]
=
json
.
dumps
(
settings
)
out
[
'
settings
'
]
=
json
.
dumps
(
settings
)
if
'
avatar_url
'
in
settings
:
if
'
avatar_url
'
in
settings
:
# TODO: enforce https://
avatar_url
=
settings
[
'
avatar_url
'
]
out
[
'
avatar_url
'
]
=
settings
[
'
avatar_url
'
]
assert
not
avatar_url
or
_valid_url_proto
(
avatar_url
)
out
[
'
avatar_url
'
]
=
avatar_url
assert
out
,
'
props were blank
'
assert
out
,
'
props were blank
'
self
.
props
=
out
self
.
props
=
out
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment