Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
3b550a8a
Unverified
Commit
3b550a8a
authored
Apr 13, 2024
by
Eng Zer Jun
Committed by
GitHub
Apr 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: replace util.Min helper with built-in min (#3224)
parent
cb7886dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
10 deletions
+2
-10
util.go
internal/util/util.go
+0
-7
rss.go
server/route/rss/rss.go
+2
-3
No files found.
internal/util/util.go
View file @
3b550a8a
...
@@ -41,13 +41,6 @@ func GenUUID() string {
...
@@ -41,13 +41,6 @@ func GenUUID() string {
return
uuid
.
New
()
.
String
()
return
uuid
.
New
()
.
String
()
}
}
func
Min
(
x
,
y
int
)
int
{
if
x
<
y
{
return
x
}
return
y
}
var
letters
=
[]
rune
(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
var
letters
=
[]
rune
(
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)
// RandomString returns a random string with length n.
// RandomString returns a random string with length n.
...
...
server/route/rss/rss.go
View file @
3b550a8a
...
@@ -13,7 +13,6 @@ import (
...
@@ -13,7 +13,6 @@ import (
"github.com/yourselfhosted/gomark/ast"
"github.com/yourselfhosted/gomark/ast"
"github.com/yourselfhosted/gomark/renderer"
"github.com/yourselfhosted/gomark/renderer"
"github.com/usememos/memos/internal/util"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/server/profile"
"github.com/usememos/memos/store"
"github.com/usememos/memos/store"
)
)
...
@@ -102,7 +101,7 @@ func (s *RSSService) generateRSSFromMemoList(ctx context.Context, memoList []*st
...
@@ -102,7 +101,7 @@ func (s *RSSService) generateRSSFromMemoList(ctx context.Context, memoList []*st
Created
:
time
.
Now
(),
Created
:
time
.
Now
(),
}
}
var
itemCountLimit
=
util
.
M
in
(
len
(
memoList
),
maxRSSItemCount
)
var
itemCountLimit
=
m
in
(
len
(
memoList
),
maxRSSItemCount
)
feed
.
Items
=
make
([]
*
feeds
.
Item
,
itemCountLimit
)
feed
.
Items
=
make
([]
*
feeds
.
Item
,
itemCountLimit
)
for
i
:=
0
;
i
<
itemCountLimit
;
i
++
{
for
i
:=
0
;
i
<
itemCountLimit
;
i
++
{
memo
:=
memoList
[
i
]
memo
:=
memoList
[
i
]
...
@@ -152,7 +151,7 @@ func getRSSItemTitle(content string) string {
...
@@ -152,7 +151,7 @@ func getRSSItemTitle(content string) string {
}
}
title
:=
strings
.
Split
(
content
,
"
\n
"
)[
0
]
title
:=
strings
.
Split
(
content
,
"
\n
"
)[
0
]
var
titleLengthLimit
=
util
.
M
in
(
len
(
title
),
maxRSSItemTitleLength
)
var
titleLengthLimit
=
m
in
(
len
(
title
),
maxRSSItemTitleLength
)
if
titleLengthLimit
<
len
(
title
)
{
if
titleLengthLimit
<
len
(
title
)
{
title
=
title
[
:
titleLengthLimit
]
+
"..."
title
=
title
[
:
titleLengthLimit
]
+
"..."
}
}
...
...
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