Fix #2659: Nomination notification links to nomination page (#2667)

This commit is contained in:
Vanshika Arora 2019-03-20 14:02:00 +05:30 committed by Adam Jones
parent a261dbb4fb
commit 309a51f46a

View file

@ -1,7 +1,10 @@
package fr.free.nrw.commons.delete;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationCompat.Builder;
@ -14,6 +17,7 @@ import java.util.Locale;
import javax.inject.Inject;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.CommonsApplication;
import fr.free.nrw.commons.Media;
import fr.free.nrw.commons.R;
@ -181,6 +185,10 @@ public class DeleteTask extends AsyncTask<Void, Integer, Boolean> {
.setProgress(0,0,false)
.setOngoing(false)
.setPriority(PRIORITY_HIGH);
String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/File:" + media.getFilename();
Intent browserIntent = new Intent(Intent.ACTION_VIEW , Uri.parse(urlForDelete));
PendingIntent pendingIntent = PendingIntent.getActivity(context , 1 , browserIntent , PendingIntent.FLAG_UPDATE_CURRENT);
notificationBuilder.setContentIntent(pendingIntent);
notificationManager.notify(NOTIFICATION_DELETE, notificationBuilder.build());
}
}