This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor comments to support markup types (#707)
Added a `markup` column in the `comments` table using a migration script. When creating or updating a comment, the default markup is used if none was provided. When showing comments, the default markup is also returned if none was found in the database (ie, for older comments). Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
- Loading branch information
Showing
11 changed files
with
172 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- add a 'markup' column in the 'comments' table | ||
alter table comments add column markup text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package rendering | ||
|
||
import "testing" | ||
import "github.com/stretchr/testify/assert" | ||
import "github.com/stretchr/testify/require" | ||
|
||
func TestGetDefaultMarkupFromNil(t *testing.T) { | ||
// when | ||
result := NilSafeGetMarkup(nil) | ||
// then | ||
require.NotNil(t, result) | ||
assert.Equal(t, SystemMarkupDefault, result) | ||
} | ||
|
||
func TestGetMarkupFromValue(t *testing.T) { | ||
// given | ||
markup := SystemMarkupMarkdown | ||
// when | ||
result := NilSafeGetMarkup(&markup) | ||
// then | ||
require.NotNil(t, result) | ||
assert.Equal(t, markup, result) | ||
} | ||
|
||
func TestGetMarkupFromEmptyValue(t *testing.T) { | ||
// given | ||
markup := "" | ||
// when | ||
result := NilSafeGetMarkup(&markup) | ||
// then | ||
require.NotNil(t, result) | ||
assert.Equal(t, SystemMarkupDefault, result) | ||
} |
Oops, something went wrong.