-
Notifications
You must be signed in to change notification settings - Fork 5k
Add support for federated avatars #3320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
dfe0183
Add support for federated avatars
strk e419ad5
Run gofmt on all modified files
strk 7083bc4
Move Avatar form in its own page
strk 263c4c5
Add go-libravatar dependency to vendor/ dir
strk 2f19a11
Revert "Add go-libravatar dependency to vendor/ dir"
strk b1e900d
Make federated avatar setting a global configuration
strk 3bc34b9
Move avatar handling back to base tool, disable federated avatar in o…
strk a9089ab
Format, handle error
strk eb02cc6
Properly set fallback host
strk 34364fd
Use unsupported github.com mirror for importing go-libravatar
strk f0c5e34
Remove comment showing life exists outside of github.com
strk d4e1cf5
Use Combo for Get and Post methods over /avatar
strk 9c0d4e6
FEDERATED_AVATAR -> ENABLE_FEDERATED_AVATAR
strk c51eeb5
Fix persistance of federated avatar lookup checkbox at install time
strk 7899268
Federated Avatars -> Enable Federated Avatars
strk c6f3a53
Use len(string) == 0 instead of string == ""
strk 1c15251
Move import line where it belong
strk f5eb2bd
Save a line (and waste much more expensive time)
strk c6ae15b
Remove redundant parens
strk 8fd46fd
Remove an empty line
strk 1bcd929
Remove empty lines
strk 0ef1ca8
Reorder lines to make diff smaller
strk 62571de
Remove another newline
strk ede0577
Move DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR after OFFLINE_MODE
strk 856d773
Remove newlines that weren't there before my intervention
strk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
{{template "base/head" .}} | ||
<div class="user settings avatar"> | ||
<div class="ui container"> | ||
<div class="ui grid"> | ||
{{template "user/settings/navbar" .}} | ||
<div class="twelve wide column content"> | ||
{{template "base/alert" .}} | ||
<h4 class="ui top attached header"> | ||
{{.i18n.Tr "settings.avatar"}} | ||
</h4> | ||
<div class="ui attached segment"> | ||
|
||
<form class="ui form" action="{{.Link}}" method="post" enctype="multipart/form-data"> | ||
{{.CsrfTokenHtml}} | ||
{{if not DisableGravatar}} | ||
<div class="inline field"> | ||
<div class="ui radio"> | ||
<input name="source" value="lookup" type="radio" {{if not .SignedUser.UseCustomAvatar}}checked{{end}}> | ||
<label>{{.i18n.Tr "settings.lookup_avatar_by_mail"}}</label> | ||
</div> | ||
</div> | ||
<div class="field {{if .Err_Gravatar}}error{{end}}"> | ||
<label for="gravatar">Avatar {{.i18n.Tr "email"}}</label> | ||
<input id="gravatar" name="gravatar" value="{{.SignedUser.AvatarEmail}}" /> | ||
</div> | ||
{{end}} | ||
|
||
<div class="inline field"> | ||
<div class="ui radio"> | ||
<input name="source" value="local" type="radio" {{if .SignedUser.UseCustomAvatar}}checked{{end}}> | ||
<label>{{.i18n.Tr "settings.enable_custom_avatar"}}</label> | ||
</div> | ||
</div> | ||
|
||
<div class="inline field"> | ||
<label for="avatar">{{.i18n.Tr "settings.choose_new_avatar"}}</label> | ||
<input name="avatar" type="file" > | ||
</div> | ||
|
||
<div class="field"> | ||
<button class="ui green button">{{$.i18n.Tr "settings.update_avatar"}}</button> | ||
<a class="ui red button delete-post" data-request-url="{{.Link}}/delete" data-done-url="{{.Link}}">{{$.i18n.Tr "settings.delete_current_avatar"}}</a> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{{template "base/footer" .}} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
OfflineMode
should only be checked insetting.go
, so when it istrue
,setting.EnableFederatedAvatar
should be force to be false at first place. Then continue avatar option check in thisAvatarLink
function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Note that I didn't change that to keep focused on the topic of this PR. What you suggest is also valid in current develop branch (no need to check both OfflineMode and DisableGravatar). How about fixing that in develop so that I then clean it up here on next rebase ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do the fix if the code actually works, but just coding style issues. You can leave it to me.