chore: Delete story only if can redact

This commit is contained in:
Krille Fear 2021-12-30 09:53:55 +01:00
parent c1a0cb3f8d
commit 7024af3a16
2 changed files with 10 additions and 5 deletions

View File

@ -112,8 +112,8 @@ class SearchController extends State<Search> {
@override
void initState() {
super.initState();
controller.text = VRouter.of(context).queryParameters['query'] ?? '';
WidgetsBinding.instance?.addPostFrameCallback((_) async {
controller.text = VRouter.of(context).queryParameters['query'] ?? '';
final server = await Store().getItem(_serverStoreNamespace) as String?;
if (server?.isNotEmpty ?? false) {
this.server = server;

View File

@ -87,10 +87,11 @@ class StoryView extends StatelessWidget {
child: PopupMenuButton<PopupStoryAction>(
onSelected: controller.onPopupStoryAction,
itemBuilder: (context) => [
PopupMenuItem(
value: PopupStoryAction.delete,
child: Text(L10n.of(context)!.delete),
),
if (controller.currentEvent?.canRedact ?? false)
PopupMenuItem(
value: PopupStoryAction.delete,
child: Text(L10n.of(context)!.delete),
),
PopupMenuItem(
value: PopupStoryAction.report,
child: Text(L10n.of(context)!.reportMessage),
@ -336,6 +337,10 @@ class StoryView extends StatelessWidget {
child: SafeArea(
child: Center(
child: OutlinedButton.icon(
style: OutlinedButton.styleFrom(
backgroundColor:
Theme.of(context).colorScheme.surface,
),
onPressed: controller.displaySeenByUsers,
icon: const Icon(
Icons.visibility_outlined,