Skip to content

Commit

Permalink
Merge branch 'main' into places-watch-logged-in-design
Browse files Browse the repository at this point in the history
  • Loading branch information
cooltey authored Jul 11, 2024
2 parents af6ab39 + 8a7a6a6 commit 2cccfd3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/org/wikipedia/dataclient/Service.kt
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@ interface Service {
@Field("token") token: String,
@Field("summary") summary: String? = null,
@Field("captchaid") captchaId: Long? = null,
@Field("captchaword") captchaWord: String? = null
@Field("captchaword") captchaWord: String? = null,
@Field("matags") tags: String? = null
): DiscussionToolsEditResponse

@POST(MW_API_PREFIX + "action=discussiontoolsedit&paction=addcomment")
Expand All @@ -700,7 +701,8 @@ interface Service {
@Field("token") token: String,
@Field("summary") summary: String? = null,
@Field("captchaid") captchaId: Long? = null,
@Field("captchaword") captchaWord: String? = null
@Field("captchaword") captchaWord: String? = null,
@Field("matags") tags: String? = null
): DiscussionToolsEditResponse

@GET(MW_API_PREFIX + "action=query&generator=growthtasks")
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/java/org/wikipedia/edit/EditSectionActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ class EditSectionActivity : BaseActivity(), ThemeChooserDialog.Callback, EditPre
if (sectionID >= 0) sectionID.toString() else null, null, summaryText, if (isLoggedIn) "user" else null,
binding.editSectionText.text.toString(), null, currentRevision, token,
if (captchaHandler.isActive) captchaHandler.captchaId() else "null",
if (captchaHandler.isActive) captchaHandler.captchaWord() else "null", isMinorEdit, watchThisPage)
if (captchaHandler.isActive) captchaHandler.captchaWord() else "null",
isMinorEdit,
watchThisPage,
tags = getEditTag())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ result ->
Expand All @@ -325,6 +328,15 @@ class EditSectionActivity : BaseActivity(), ThemeChooserDialog.Callback, EditPre
BreadCrumbLogEvent.logInputField(this, editSummaryFragment.summaryText)
}

private fun getEditTag(): String {
return when {
invokeSource == Constants.InvokeSource.TALK_TOPIC_ACTIVITY -> EditTags.APP_TALK_SOURCE
!textToHighlight.isNullOrEmpty() -> EditTags.APP_SELECT_SOURCE
sectionID >= 0 -> EditTags.APP_SECTION_SOURCE
else -> EditTags.APP_FULL_SOURCE
}
}

private fun waitForUpdatedRevision(newRevision: Long) {
AnonymousNotificationHelper.onEditSubmitted()
disposables.add(ServiceFactory.getRest(pageTitle.wikiSite)
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/org/wikipedia/edit/EditTags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ object EditTags {
const val APP_DESCRIPTION_TRANSLATE = "app-description-translate"
const val APP_ROLLBACK = "app-rollback"
const val APP_UNDO = "app-undo"
const val APP_SECTION_SOURCE = "app-section-source"
const val APP_FULL_SOURCE = "app-full-source"
const val APP_SELECT_SOURCE = "app-select-source"
const val APP_TALK_SOURCE = "app-talk-source"
const val APP_TALK_REPLY = "app-talk-reply"
const val APP_TALK_TOPIC = "app-talk-topic"
}
5 changes: 3 additions & 2 deletions app/src/main/java/org/wikipedia/talk/TalkReplyViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.wikipedia.Constants
import org.wikipedia.database.AppDatabase
import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.dataclient.discussiontools.ThreadItem
import org.wikipedia.edit.EditTags
import org.wikipedia.extensions.parcelable
import org.wikipedia.page.PageTitle
import org.wikipedia.talk.db.TalkTemplate
Expand Down Expand Up @@ -71,9 +72,9 @@ class TalkReplyViewModel(bundle: Bundle) : ViewModel() {
}) {
val token = ServiceFactory.get(pageTitle.wikiSite).getToken().query?.csrfToken()!!
val response = if (topic != null) {
ServiceFactory.get(pageTitle.wikiSite).postTalkPageTopicReply(pageTitle.prefixedText, topic.id, body, token)
ServiceFactory.get(pageTitle.wikiSite).postTalkPageTopicReply(pageTitle.prefixedText, topic.id, body, token, tags = EditTags.APP_TALK_REPLY)
} else {
ServiceFactory.get(pageTitle.wikiSite).postTalkPageTopic(pageTitle.prefixedText, subject, body, token)
ServiceFactory.get(pageTitle.wikiSite).postTalkPageTopic(pageTitle.prefixedText, subject, body, token, tags = EditTags.APP_TALK_TOPIC)
}
postReplyData.postValue(Resource.Success(response.result!!.newRevId))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WatchlistItemView constructor(context: Context, attrs: AttributeSet? = nul
this.item = item
var isSummaryEmpty = false
binding.langCodeText.setLangCode(item.wiki!!.languageCode)
val summary = StringUtil.fromHtml(item.parsedComment).ifEmpty {
var summary = StringUtil.fromHtml(item.parsedComment).ifEmpty {
isSummaryEmpty = true
context.getString(R.string.page_edit_history_comment_placeholder)
}
Expand All @@ -74,7 +74,7 @@ class WatchlistItemView constructor(context: Context, attrs: AttributeSet? = nul
}
else -> {
binding.diffText.isVisible = false
binding.summaryText.text = StringUtil.fromHtml(item.logdisplay)
summary = StringUtil.fromHtml(item.logdisplay)
}
}
binding.containerView.alpha = 0.5f
Expand Down

0 comments on commit 2cccfd3

Please sign in to comment.