Skip to content

Commit

Permalink
Merge pull request #312 from Automattic/adam/294_scopes
Browse files Browse the repository at this point in the history
QuickEditor: Gravatar OAuth scopes
  • Loading branch information
AdamGrzybkowski authored Sep 12, 2024
2 parents d449c6e + 71dac56 commit e4f4fa5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private suspend fun AvatarPickerAction.handle(
) {
when (this) {
is AvatarPickerAction.AvatarSelected -> {
onAvatarSelected(AvatarUpdateResult(avatar.fullUrl.toUri()))
onAvatarSelected(AvatarUpdateResult(avatar.imageUrl.toUri()))
snackState.showQESnackbar(
message = context.getString(R.string.avatar_selected_confirmation),
withDismissAction = true,
Expand Down Expand Up @@ -344,6 +344,3 @@ private fun AvatarPickerErrorPreview() {
)
}
}

internal val Avatar.fullUrl: String
get() = "https://www.gravatar.com$imageUrl?size=200"
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ internal fun Profile.copyAvatar(avatar: Avatar): Profile {
hash = this@copyAvatar.hash
displayName = this@copyAvatar.displayName
profileUrl = this@copyAvatar.profileUrl
avatarUrl = URI.create(avatar.fullUrl)
avatarUrl = URI.create(avatar.imageUrl)
avatarAltText = avatar.altText
location = this@copyAvatar.location
description = this@copyAvatar.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import com.gravatar.quickeditor.QuickEditorFileProvider
import com.gravatar.quickeditor.R
import com.gravatar.quickeditor.ui.avatarpicker.AvatarUi
import com.gravatar.quickeditor.ui.avatarpicker.AvatarsSectionUiState
import com.gravatar.quickeditor.ui.avatarpicker.fullUrl
import com.gravatar.restapi.models.Avatar
import com.gravatar.ui.GravatarTheme
import java.time.Instant
Expand Down Expand Up @@ -116,7 +115,7 @@ internal fun AvatarsSection(
items(items = state.avatars, key = { it.avatarId }) { avatarModel ->
when (avatarModel) {
is AvatarUi.Uploaded -> SelectableAvatar(
imageUrl = avatarModel.avatar.fullUrl,
imageUrl = avatarModel.avatar.imageUrl,
isSelected = avatarModel.isSelected,
isLoading = avatarModel.isLoading,
onAvatarClicked = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ internal object WordPressOauth {
.appendQueryParameter("client_id", clientId)
.appendQueryParameter("redirect_uri", redirectUri)
.appendQueryParameter("response_type", "code")
.appendQueryParameter("scope", "auth")
.appendQueryParameter("scope[1]", "auth")
.appendQueryParameter("scope[2]", "gravatar-profile:read")
.appendQueryParameter("scope[3]", "gravatar-profile:manage")
.appendQueryParameter("user_email", email.toString())
.build()
.toString()
Expand Down

0 comments on commit e4f4fa5

Please sign in to comment.