mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes invalid authorname in explore (#4054)
* Fixes #3341, #4018 * Defined two feild author and user in Media and used them at the corresponding places Minor bug fixes -displaying userName in uploadedBy. -modified HTML parsing in getArtist. -Replaced creator with author. * Fixes #3341, #4018 * Defined two feild author and user in Media and used them at the corresponding places Minor bug fixes -displaying userName in uploadedBy. -modified HTML parsing in getArtist. -Replaced creator with author.
This commit is contained in:
parent
f1b40728b2
commit
d720750ab4
17 changed files with 56 additions and 61 deletions
|
|
@ -55,13 +55,15 @@ class Media constructor(
|
||||||
val licenseUrl: String? = null,
|
val licenseUrl: String? = null,
|
||||||
/**
|
/**
|
||||||
* Gets the name of the creator of the file.
|
* Gets the name of the creator of the file.
|
||||||
* @return creator name as a String
|
* @return author name as a String
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Sets the creator name of the file.
|
* Sets the author name of the file.
|
||||||
* @param creator creator name as a string
|
* @param author creator name as a string
|
||||||
*/
|
*/
|
||||||
var creator: String? = null,
|
var author: String? = null,
|
||||||
|
|
||||||
|
var user:String?=null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the categories the file falls under.
|
* Gets the categories the file falls under.
|
||||||
|
|
@ -83,12 +85,13 @@ class Media constructor(
|
||||||
categories: List<String>?,
|
categories: List<String>?,
|
||||||
filename: String?,
|
filename: String?,
|
||||||
fallbackDescription: String?,
|
fallbackDescription: String?,
|
||||||
creator: String?
|
author: String?, user:String?
|
||||||
) : this(
|
) : this(
|
||||||
filename = filename,
|
filename = filename,
|
||||||
fallbackDescription = fallbackDescription,
|
fallbackDescription = fallbackDescription,
|
||||||
dateUploaded = Date(),
|
dateUploaded = Date(),
|
||||||
creator = creator,
|
author = author,
|
||||||
|
user=user,
|
||||||
categories = categories,
|
categories = categories,
|
||||||
captions = captions
|
captions = captions
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class SessionManager {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private Account currentAccount; // Unlike a savings account... ;-)
|
private Account currentAccount; // Unlike a savings account... ;-)
|
||||||
private JsonKvStore defaultKvStore;
|
private JsonKvStore defaultKvStore;
|
||||||
private static final String KEY_RAWUSERNAME = "rawusername";
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public SessionManager(Context context,
|
public SessionManager(Context context,
|
||||||
|
|
@ -99,17 +98,6 @@ public class SessionManager {
|
||||||
return account == null ? null : account.name;
|
return account == null ? null : account.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
private String getRawUserName() {
|
|
||||||
Account account = getCurrentAccount();
|
|
||||||
return account == null ? null : accountManager().getUserData(account, KEY_RAWUSERNAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAuthorName(){
|
|
||||||
return getRawUserName() == null ? getUserName() : getRawUserName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
Account account = getCurrentAccount();
|
Account account = getCurrentAccount();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.facebook.drawee.view.SimpleDraweeView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import fr.free.nrw.commons.Media;
|
import fr.free.nrw.commons.Media;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
@ -87,9 +86,9 @@ public class GridViewAdapter extends ArrayAdapter {
|
||||||
Media item = data.get(position);
|
Media item = data.get(position);
|
||||||
SimpleDraweeView imageView = convertView.findViewById(R.id.categoryImageView);
|
SimpleDraweeView imageView = convertView.findViewById(R.id.categoryImageView);
|
||||||
TextView fileName = convertView.findViewById(R.id.categoryImageTitle);
|
TextView fileName = convertView.findViewById(R.id.categoryImageTitle);
|
||||||
TextView author = convertView.findViewById(R.id.categoryImageAuthor);
|
TextView uploader = convertView.findViewById(R.id.categoryImageAuthor);
|
||||||
fileName.setText(item.getMostRelevantCaption());
|
fileName.setText(item.getMostRelevantCaption());
|
||||||
setAuthorView(item, author);
|
setUploaderView(item, uploader);
|
||||||
imageView.setImageURI(item.getThumbUrl());
|
imageView.setImageURI(item.getThumbUrl());
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
@ -107,14 +106,14 @@ public class GridViewAdapter extends ArrayAdapter {
|
||||||
/**
|
/**
|
||||||
* Shows author information if its present
|
* Shows author information if its present
|
||||||
* @param item
|
* @param item
|
||||||
* @param author
|
* @param uploader
|
||||||
*/
|
*/
|
||||||
private void setAuthorView(Media item, TextView author) {
|
private void setUploaderView(Media item, TextView uploader) {
|
||||||
if (!TextUtils.isEmpty(item.getCreator())) {
|
if (!TextUtils.isEmpty(item.getAuthor())) {
|
||||||
author.setVisibility(View.VISIBLE);
|
uploader.setVisibility(View.VISIBLE);
|
||||||
author.setText(getContext().getString(R.string.image_uploaded_by, item.getCreator()));
|
uploader.setText(getContext().getString(R.string.image_uploaded_by, item.getUser()));
|
||||||
} else {
|
} else {
|
||||||
author.setVisibility(View.GONE);
|
uploader.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,8 @@ data class Contribution constructor(
|
||||||
categories,
|
categories,
|
||||||
item.fileName,
|
item.fileName,
|
||||||
formatDescriptions(item.uploadMediaDetails),
|
formatDescriptions(item.uploadMediaDetails),
|
||||||
sessionManager.authorName
|
sessionManager.userName,
|
||||||
|
sessionManager.userName
|
||||||
),
|
),
|
||||||
localUri = item.mediaUri,
|
localUri = item.mediaUri,
|
||||||
decimalCoords = item.gpsCoords.decimalCoords,
|
decimalCoords = item.gpsCoords.decimalCoords,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
import fr.free.nrw.commons.contributions.ContributionsListAdapter.Callback;
|
import fr.free.nrw.commons.contributions.ContributionsListAdapter.Callback;
|
||||||
import fr.free.nrw.commons.media.MediaClient;
|
import fr.free.nrw.commons.media.MediaClient;
|
||||||
import fr.free.nrw.commons.utils.ViewUtil;
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
@ -68,7 +67,7 @@ public class ContributionViewHolder extends RecyclerView.ViewHolder {
|
||||||
this.contribution = contribution;
|
this.contribution = contribution;
|
||||||
this.position = position;
|
this.position = position;
|
||||||
titleView.setText(contribution.getMedia().getMostRelevantCaption());
|
titleView.setText(contribution.getMedia().getMostRelevantCaption());
|
||||||
authorView.setText(contribution.getMedia().getCreator());
|
authorView.setText(contribution.getMedia().getAuthor());
|
||||||
|
|
||||||
imageView.getHierarchy().setPlaceholderImage(R.drawable.image_placeholder);
|
imageView.getHierarchy().setPlaceholderImage(R.drawable.image_placeholder);
|
||||||
imageView.getHierarchy().setFailureImage(R.drawable.image_placeholder);
|
imageView.getHierarchy().setFailureImage(R.drawable.image_placeholder);
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import fr.free.nrw.commons.contributions.ContributionDao
|
||||||
* The database for accessing the respective DAOs
|
* The database for accessing the respective DAOs
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Database(entities = [Contribution::class], version = 6, exportSchema = false)
|
@Database(entities = [Contribution::class], version = 7, exportSchema = false)
|
||||||
@TypeConverters(Converters::class)
|
@TypeConverters(Converters::class)
|
||||||
abstract class AppDatabase : RoomDatabase() {
|
abstract class AppDatabase : RoomDatabase() {
|
||||||
abstract fun contributionDao(): ContributionDao
|
abstract fun contributionDao(): ContributionDao
|
||||||
|
|
|
||||||
|
|
@ -94,11 +94,10 @@ public class DeleteHelper {
|
||||||
String userPageString = "\n{{subst:idw|" + media.getFilename() +
|
String userPageString = "\n{{subst:idw|" + media.getFilename() +
|
||||||
"}} ~~~~";
|
"}} ~~~~";
|
||||||
|
|
||||||
String creator = media.getCreator();
|
String creator = media.getAuthor();
|
||||||
if (creator == null || creator.isEmpty()) {
|
if (creator == null || creator.isEmpty()) {
|
||||||
throw new RuntimeException("Failed to nominate for deletion");
|
throw new RuntimeException("Failed to nominate for deletion");
|
||||||
}
|
}
|
||||||
String creatorName = creator.replace(" (page does not exist)", "");
|
|
||||||
|
|
||||||
return pageEditClient.prependEdit(media.getFilename(), fileDeleteString + "\n", summary)
|
return pageEditClient.prependEdit(media.getFilename(), fileDeleteString + "\n", summary)
|
||||||
.flatMap(result -> {
|
.flatMap(result -> {
|
||||||
|
|
@ -113,7 +112,7 @@ public class DeleteHelper {
|
||||||
throw new RuntimeException("Failed to nominate for deletion");
|
throw new RuntimeException("Failed to nominate for deletion");
|
||||||
}).flatMap(result -> {
|
}).flatMap(result -> {
|
||||||
if (result) {
|
if (result) {
|
||||||
return pageEditClient.appendEdit("User_Talk:" + creatorName, userPageString + "\n", summary);
|
return pageEditClient.appendEdit("User_Talk:" + creator, userPageString + "\n", summary);
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Failed to nominate for deletion");
|
throw new RuntimeException("Failed to nominate for deletion");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ class MediaConverter @Inject constructor() {
|
||||||
safeParseDate(metadata.dateTime()),
|
safeParseDate(metadata.dateTime()),
|
||||||
metadata.licenseShortName(),
|
metadata.licenseShortName(),
|
||||||
metadata.prefixedLicenseUrl,
|
metadata.prefixedLicenseUrl,
|
||||||
getArtist(metadata),
|
getAuthor(metadata),
|
||||||
|
imageInfo.user,
|
||||||
MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories),
|
MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories),
|
||||||
metadata.latLng,
|
metadata.latLng,
|
||||||
entity.labels().mapValues { it.value.value() },
|
entity.labels().mapValues { it.value.value() },
|
||||||
|
|
@ -61,11 +62,16 @@ class MediaConverter @Inject constructor() {
|
||||||
* @param metadata
|
* @param metadata
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private fun getArtist(metadata: ExtMetadata): String? {
|
private fun getAuthor(metadata: ExtMetadata): String? {
|
||||||
return try {
|
return try {
|
||||||
val artistHtml = metadata.artist()
|
val authorHtml = metadata.artist()
|
||||||
artistHtml.substring(artistHtml.indexOf("title=\""), artistHtml.indexOf("\">"))
|
val anchorStartTagTerminalChars = "\">"
|
||||||
.replace("title=\"User:", "")
|
val anchorCloseTag = "</a>"
|
||||||
|
|
||||||
|
return authorHtml.substring(
|
||||||
|
authorHtml.indexOf(anchorStartTagTerminalChars) + anchorStartTagTerminalChars
|
||||||
|
.length, authorHtml.indexOf(anchorCloseTag)
|
||||||
|
)
|
||||||
} catch (ex: java.lang.Exception) {
|
} catch (ex: java.lang.Exception) {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ class SearchImagesViewHolder(containerView: View, val onImageClicked: (Int) -> U
|
||||||
categoryImageView.setOnClickListener { onImageClicked(item.second) }
|
categoryImageView.setOnClickListener { onImageClicked(item.second) }
|
||||||
categoryImageTitle.text = media.mostRelevantCaption
|
categoryImageTitle.text = media.mostRelevantCaption
|
||||||
categoryImageView.setImageURI(media.thumbUrl)
|
categoryImageView.setImageURI(media.thumbUrl)
|
||||||
if (media.creator?.isNotEmpty() == true) {
|
if (media.author?.isNotEmpty() == true) {
|
||||||
categoryImageAuthor.visibility = View.VISIBLE
|
categoryImageAuthor.visibility = View.VISIBLE
|
||||||
categoryImageAuthor.text =
|
categoryImageAuthor.text =
|
||||||
containerView.context.getString(R.string.image_uploaded_by, media.creator)
|
containerView.context.getString(R.string.image_uploaded_by, media.user)
|
||||||
} else {
|
} else {
|
||||||
categoryImageAuthor.visibility = View.GONE
|
categoryImageAuthor.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
@ -66,7 +65,6 @@ import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||||
import fr.free.nrw.commons.nearby.Label;
|
import fr.free.nrw.commons.nearby.Label;
|
||||||
import fr.free.nrw.commons.ui.widget.HtmlTextView;
|
import fr.free.nrw.commons.ui.widget.HtmlTextView;
|
||||||
import fr.free.nrw.commons.utils.ViewUtilWrapper;
|
import fr.free.nrw.commons.utils.ViewUtilWrapper;
|
||||||
import io.reactivex.Observable;
|
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
@ -542,10 +540,10 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
||||||
|
|
||||||
updateCategoryList();
|
updateCategoryList();
|
||||||
|
|
||||||
if (media.getCreator() == null || media.getCreator().equals("")) {
|
if (media.getAuthor() == null || media.getAuthor().equals("")) {
|
||||||
authorLayout.setVisibility(GONE);
|
authorLayout.setVisibility(GONE);
|
||||||
} else {
|
} else {
|
||||||
author.setText(media.getCreator());
|
author.setText(media.getAuthor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,7 +677,7 @@ public class MediaDetailFragment extends CommonsDaggerSupportFragment implements
|
||||||
@SuppressLint("StringFormatInvalid")
|
@SuppressLint("StringFormatInvalid")
|
||||||
@OnClick(R.id.nominateDeletion)
|
@OnClick(R.id.nominateDeletion)
|
||||||
public void onDeleteButtonClicked(){
|
public void onDeleteButtonClicked(){
|
||||||
if (AccountUtil.getUserName(getContext()) != null && AccountUtil.getUserName(getContext()).equals(media.getCreator())) {
|
if (AccountUtil.getUserName(getContext()) != null && AccountUtil.getUserName(getContext()).equals(media.getAuthor())) {
|
||||||
final ArrayAdapter<String> languageAdapter = new ArrayAdapter<>(getActivity(),
|
final ArrayAdapter<String> languageAdapter = new ArrayAdapter<>(getActivity(),
|
||||||
R.layout.simple_spinner_dropdown_list, reasonList);
|
R.layout.simple_spinner_dropdown_list, reasonList);
|
||||||
final Spinner spinner = new Spinner(getActivity());
|
final Spinner spinner = new Spinner(getActivity());
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ public class MediaDetailPagerFragment extends CommonsDaggerSupportFragment imple
|
||||||
// Initialize bookmark object
|
// Initialize bookmark object
|
||||||
bookmark = new Bookmark(
|
bookmark = new Bookmark(
|
||||||
m.getFilename(),
|
m.getFilename(),
|
||||||
m.getCreator(),
|
m.getAuthor(),
|
||||||
BookmarkPicturesContentProvider.uriForName(m.getFilename())
|
BookmarkPicturesContentProvider.uriForName(m.getFilename())
|
||||||
);
|
);
|
||||||
updateBookmarkState(menu.findItem(R.id.menu_bookmark_current_image));
|
updateBookmarkState(menu.findItem(R.id.menu_bookmark_current_image));
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import retrofit2.http.QueryMap;
|
||||||
* Interface for interacting with Commons media related APIs
|
* Interface for interacting with Commons media related APIs
|
||||||
*/
|
*/
|
||||||
public interface MediaInterface {
|
public interface MediaInterface {
|
||||||
String MEDIA_PARAMS="&prop=imageinfo&iiprop=url|extmetadata&iiurlwidth=640" +
|
String MEDIA_PARAMS="&prop=imageinfo&iiprop=url|extmetadata|user&&iiurlwidth=640" +
|
||||||
"&iiextmetadatafilter=DateTime|Categories|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal" +
|
"&iiextmetadatafilter=DateTime|Categories|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal" +
|
||||||
"|Artist|LicenseShortName|LicenseUrl";
|
"|Artist|LicenseShortName|LicenseUrl";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ class PageContentsCreator {
|
||||||
.append("{{Information\n")
|
.append("{{Information\n")
|
||||||
.append("|description=").append(media.getFallbackDescription()).append("\n")
|
.append("|description=").append(media.getFallbackDescription()).append("\n")
|
||||||
.append("|source=").append("{{own}}\n")
|
.append("|source=").append("{{own}}\n")
|
||||||
.append("|author=[[User:").append(media.getCreator()).append("|")
|
.append("|author=[[User:").append(media.getAuthor()).append("|")
|
||||||
.append(media.getCreator()).append("]]\n");
|
.append(media.getAuthor()).append("]]\n");
|
||||||
|
|
||||||
String templatizedCreatedDate = getTemplatizedCreatedDate(
|
String templatizedCreatedDate = getTemplatizedCreatedDate(
|
||||||
contribution.getDateCreated(), contribution.getDateCreatedSource());
|
contribution.getDateCreated(), contribution.getDateCreatedSource());
|
||||||
|
|
|
||||||
|
|
@ -97,10 +97,10 @@ public class UploadController {
|
||||||
final Media media = contribution.getMedia();
|
final Media media = contribution.getMedia();
|
||||||
if (store.getBoolean("useAuthorName", false)) {
|
if (store.getBoolean("useAuthorName", false)) {
|
||||||
final String authorName = store.getString("authorName", "");
|
final String authorName = store.getString("authorName", "");
|
||||||
media.setCreator(authorName);
|
media.setAuthor(authorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(media.getCreator())) {
|
if (TextUtils.isEmpty(media.getAuthor())) {
|
||||||
final Account currentAccount = sessionManager.getCurrentAccount();
|
final Account currentAccount = sessionManager.getCurrentAccount();
|
||||||
if (currentAccount == null) {
|
if (currentAccount == null) {
|
||||||
Timber.d("Current account is null");
|
Timber.d("Current account is null");
|
||||||
|
|
@ -108,7 +108,7 @@ public class UploadController {
|
||||||
sessionManager.forceLogin(context);
|
sessionManager.forceLogin(context);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
media.setCreator(sessionManager.getAuthorName());
|
media.setAuthor(sessionManager.getUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (media.getFallbackDescription() == null) {
|
if (media.getFallbackDescription() == null) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ fun media(
|
||||||
dateUploaded: Date? = Date(),
|
dateUploaded: Date? = Date(),
|
||||||
license: String? = "license",
|
license: String? = "license",
|
||||||
licenseUrl: String? = "licenseUrl",
|
licenseUrl: String? = "licenseUrl",
|
||||||
creator: String? = "creator",
|
author: String? = "creator",
|
||||||
|
user:String?="user",
|
||||||
pageId: String = "pageId",
|
pageId: String = "pageId",
|
||||||
categories: List<String>? = listOf("categories"),
|
categories: List<String>? = listOf("categories"),
|
||||||
coordinates: LatLng? = LatLng(0.0, 0.0, 0.0f),
|
coordinates: LatLng? = LatLng(0.0, 0.0, 0.0f),
|
||||||
|
|
@ -56,7 +57,8 @@ fun media(
|
||||||
dateUploaded,
|
dateUploaded,
|
||||||
license,
|
license,
|
||||||
licenseUrl,
|
licenseUrl,
|
||||||
creator,
|
author,
|
||||||
|
user,
|
||||||
categories,
|
categories,
|
||||||
coordinates,
|
coordinates,
|
||||||
captions,
|
captions,
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class DeleteHelperTest {
|
||||||
whenever(media.displayTitle).thenReturn("Test file")
|
whenever(media.displayTitle).thenReturn("Test file")
|
||||||
|
|
||||||
val creatorName = "Creator"
|
val creatorName = "Creator"
|
||||||
whenever(media.creator).thenReturn("$creatorName (page does not exist)")
|
whenever(media.author).thenReturn("$creatorName")
|
||||||
whenever(media.filename).thenReturn("Test file.jpg")
|
whenever(media.filename).thenReturn("Test file.jpg")
|
||||||
|
|
||||||
val makeDeletion = deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
val makeDeletion = deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
||||||
|
|
@ -78,7 +78,7 @@ class DeleteHelperTest {
|
||||||
.thenReturn(Observable.just(true))
|
.thenReturn(Observable.just(true))
|
||||||
whenever(media.displayTitle).thenReturn("Test file")
|
whenever(media.displayTitle).thenReturn("Test file")
|
||||||
whenever(media.filename).thenReturn("Test file.jpg")
|
whenever(media.filename).thenReturn("Test file.jpg")
|
||||||
whenever(media.creator).thenReturn("Creator (page does not exist)")
|
whenever(media.author).thenReturn("Creator (page does not exist)")
|
||||||
|
|
||||||
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +93,7 @@ class DeleteHelperTest {
|
||||||
.thenReturn(Observable.just(false))
|
.thenReturn(Observable.just(false))
|
||||||
whenever(media.displayTitle).thenReturn("Test file")
|
whenever(media.displayTitle).thenReturn("Test file")
|
||||||
whenever(media.filename).thenReturn("Test file.jpg")
|
whenever(media.filename).thenReturn("Test file.jpg")
|
||||||
whenever(media.creator).thenReturn("Creator (page does not exist)")
|
whenever(media.author).thenReturn("Creator (page does not exist)")
|
||||||
|
|
||||||
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
@ -108,7 +108,7 @@ class DeleteHelperTest {
|
||||||
.thenReturn(Observable.just(true))
|
.thenReturn(Observable.just(true))
|
||||||
whenever(media.displayTitle).thenReturn("Test file")
|
whenever(media.displayTitle).thenReturn("Test file")
|
||||||
whenever(media.filename).thenReturn("Test file.jpg")
|
whenever(media.filename).thenReturn("Test file.jpg")
|
||||||
whenever(media.creator).thenReturn("Creator (page does not exist)")
|
whenever(media.author).thenReturn("Creator (page does not exist)")
|
||||||
|
|
||||||
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +125,7 @@ class DeleteHelperTest {
|
||||||
whenever(media.displayTitle).thenReturn("Test file")
|
whenever(media.displayTitle).thenReturn("Test file")
|
||||||
whenever(media.filename).thenReturn("Test file.jpg")
|
whenever(media.filename).thenReturn("Test file.jpg")
|
||||||
|
|
||||||
whenever(media.creator).thenReturn(null)
|
whenever(media.author).thenReturn(null)
|
||||||
|
|
||||||
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
deleteHelper.makeDeletion(context, media, "Test reason")?.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class UploadControllerTest {
|
||||||
val contribution = mock(Contribution::class.java)
|
val contribution = mock(Contribution::class.java)
|
||||||
val media = mock<Media>()
|
val media = mock<Media>()
|
||||||
whenever(contribution.media).thenReturn(media)
|
whenever(contribution.media).thenReturn(media)
|
||||||
whenever(media.creator).thenReturn("Creator")
|
whenever(media.author).thenReturn("Creator")
|
||||||
uploadController!!.startUpload(contribution)
|
uploadController!!.startUpload(contribution)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue