Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/workerwarehotspots into lp:widelands

2019-01-18 Thread hessenfarmer
Review: Approve test review

tested it. Looks good now. So if CI is green we should merge.

Thanks for fixing
-- 
https://code.launchpad.net/~widelands-dev/widelands/workerwarehotspots/+merge/359915
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/workerwarehotspots.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-better-syncstreams into lp:widelands

2019-01-18 Thread Notabilis
Notabilis has proposed merging 
lp:~widelands-dev/widelands/bug-better-syncstreams into lp:widelands.

Commit message:
Print more information in syncstreams.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-better-syncstreams/+merge/361922

Not ready for review and merge yet, only starting merge request for Windows 
builds.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-better-syncstreams into lp:widelands.
=== modified file 'data/tribes/buildings/productionsites/atlanteans/mill/init.lua'
--- data/tribes/buildings/productionsites/atlanteans/mill/init.lua	2018-09-06 08:21:35 +
+++ data/tribes/buildings/productionsites/atlanteans/mill/init.lua	2019-01-17 19:30:44 +
@@ -74,7 +74,7 @@
  }
   },
   produce_blackroot_flour = {
- -- TRANSLATORS: Completed/Skipped/Did not start grinding blackrootbecause ...
+ -- TRANSLATORS: Completed/Skipped/Did not start grinding blackroot because ...
  descname = _"grinding blackroot",
  actions = {
 -- No check whether we need blackroot_flour because blackroots cannot be used for anything else.

=== modified file 'src/economy/economy.cc'
--- src/economy/economy.cc	2018-12-13 07:24:01 +
+++ src/economy/economy.cc	2019-01-17 19:30:44 +
@@ -706,6 +706,7 @@
 		// alerts, so add info to the sync stream here.
 		{
 			::StreamWrite& ss = game.syncstream();
+			ss.unsigned_8(Syncstream::ProcessRequests);
 			ss.unsigned_8(req.get_type());
 			ss.unsigned_8(req.get_index());
 			ss.unsigned_32(req.target().serial());
@@ -1046,7 +1047,7 @@
 	// to avoid potential future problems caused by the supplies_ changing
 	// under us in some way.
 	::StreamWrite& ss = game.syncstream();
-	ss.unsigned_32(0x02decafa);  // appears as facade02 in sync stream
+	ss.unsigned_8(Syncstream::HandleActiveSupplies);
 	ss.unsigned_32(assignments.size());
 
 	for (const auto& temp_assignment : assignments) {

=== modified file 'src/economy/request.cc'
--- src/economy/request.cc	2018-12-13 07:24:01 +
+++ src/economy/request.cc	2019-01-17 19:30:44 +
@@ -380,7 +380,7 @@
 	assert(is_open());
 
 	::StreamWrite& ss = game.syncstream();
-	ss.unsigned_32(0x01decafa);  // appears as facade01 in sync stream
+	ss.unsigned_8(Syncstream::StartTransfer);
 	ss.unsigned_32(target().serial());
 	ss.unsigned_32(supp.get_position(game)->serial());
 

=== modified file 'src/logic/cmd_queue.cc'
--- src/logic/cmd_queue.cc	2018-12-13 07:24:01 +
+++ src/logic/cmd_queue.cc	2019-01-17 19:30:44 +
@@ -114,8 +114,7 @@
 
 			if (dynamic_cast()) {
 StreamWrite& ss = game_.syncstream();
-static uint8_t const tag[] = {0xde, 0xad, 0x00};
-ss.data(tag, 3);  // provide an easy-to-find pattern as debugging aid
+ss.unsigned_8(Syncstream::RunQueue);
 ss.unsigned_32(c.duetime());
 ss.unsigned_32(static_cast(c.id()));
 			}

=== modified file 'src/logic/filesystem_constants.h'
--- src/logic/filesystem_constants.h	2018-11-09 08:00:35 +
+++ src/logic/filesystem_constants.h	2019-01-17 19:30:44 +
@@ -49,6 +49,7 @@
 const std::string kReplayDir = "replays";
 const std::string kReplayExtension = ".wrpl";
 const std::string kSyncstreamExtension = ".wss";
+const std::string kSyncstreamExcerptExtension = ".wse";
 // The time in seconds for how long old replays/syncstreams should be kept
 // around, in seconds. Right now this is 4 weeks.
 constexpr double kReplayKeepAroundTime = 4 * 7 * 24 * 60 * 60;

=== modified file 'src/logic/game.cc'
--- src/logic/game.cc	2018-12-13 07:24:01 +
+++ src/logic/game.cc	2019-01-17 19:30:44 +
@@ -87,6 +87,8 @@
 void Game::SyncWrapper::start_dump(const std::string& fname) {
 	dumpfname_ = fname + kSyncstreamExtension;
 	dump_.reset(g_fs->open_stream_write(dumpfname_));
+	current_excerpt_id_ = 0;
+	excerpts_buffer_[current_excerpt_id_].clear();
 }
 
 void Game::SyncWrapper::data(void const* const sync_data, size_t const size) {
@@ -114,6 +116,8 @@
 			log("Writing to syncstream file %s failed. Stop synctream dump.\n", dumpfname_.c_str());
 			dump_.reset();
 		}
+		assert(current_excerpt_id_ < kExcerptSize);
+		excerpts_buffer_[current_excerpt_id_].append(static_cast(sync_data), size);
 	}
 
 	target_.data(sync_data, size);
@@ -603,6 +607,40 @@
 }
 
 /**
+ * Switches to the next part of the syncstream excerpt.
+ */
+void Game::report_sync_request() {
+	syncwrapper_.current_excerpt_id_ = (syncwrapper_.current_excerpt_id_ + 1) % SyncWrapper::kExcerptSize;
+	syncwrapper_.excerpts_buffer_[syncwrapper_.current_excerpt_id_].clear();
+}
+
+/**
+ * Triggers writing of syncstream excerpt and adds the playernumber of the desynced player
+ * to the stream.
+ */
+void Game::report_desync(uint32_t playernumber) {
+	std::string filename = syncwrapper_.dumpfname_;
+	filename.replace(filename.length() - kSyncstreamExtension.length(), 

[Widelands-dev] [Merge] lp:~widelands-dev/widelands-website/deleted_user2 into lp:widelands-website

2019-01-18 Thread kaputtnik
kaputtnik has proposed merging 
lp:~widelands-dev/widelands-website/deleted_user2 into lp:widelands-website.

Commit message:
Fix showing username in search results if user has deleted himself

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/deleted_user2/+merge/361963

Just stumbled over this during cleaning of users who had registered but never 
activated their account. So there are some more small changes:

- in admin/auth/user show if a user has deleted himself. So one can distinguish 
between inactive users and users who deleted them self (which are also inactive)
- show the deleted status also in admin/wlprofile
- added a new template filter 'user_status', which is used to either show 
DELETED_USERNAME or the real username. This makes some templates easier to use.
- this filter makes the context_processor in wlprofile superfluous
- use the filter in search results and other places
- fixed displaying smiley in delete_me page
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands-website/deleted_user2 into lp:widelands-website.
=== modified file 'mainpage/admin.py'
--- mainpage/admin.py	2018-12-11 10:22:21 +
+++ mainpage/admin.py	2019-01-18 12:08:44 +
@@ -36,6 +36,11 @@
 persons.allow_tags = True
 
 
+def deleted(self):
+return '' if self.wlprofile.deleted==False else 'Yes'
+deleted.short_description = u'Deleted himself'
+
+
 class GroupAdmin(GroupAdmin):
 list_display = ['name', persons]
 list_display_links = ['name']
@@ -47,7 +52,7 @@
 
 class UserAdmin(UserAdmin):
 list_display = ('username', 'email', 'date_joined', 'last_login',
-'is_active', 'is_staff', roles)
+'is_active', deleted, 'is_staff', roles)
 ordering = ('-date_joined',)
 
 

=== modified file 'settings.py'
--- settings.py	2018-12-18 11:38:34 +
+++ settings.py	2019-01-18 12:08:44 +
@@ -151,7 +151,6 @@
 'django.template.context_processors.static',
 'django.template.context_processors.tz',
 'django_messages.context_processors.inbox',
-'wlprofile.context_processors.deleted_user_data',
 ],
 },
 },

=== modified file 'templates/pybb/feeds/posts_description.html'
--- templates/pybb/feeds/posts_description.html	2018-09-13 20:19:07 +
+++ templates/pybb/feeds/posts_description.html	2019-01-18 12:08:44 +
@@ -1,6 +1,3 @@
-{% if obj.user.wlprofile.deleted %}
-{{ DELETED_USERNAME }}
-{% else %}
-{{ obj.user }}
-{% endif %}wrote:
+{% load wlprofile_extras %}
+{{ obj.user|user_status }} wrote:
 {{ obj.body_html|safe }}

=== modified file 'templates/pybb/feeds/topics_description.html'
--- templates/pybb/feeds/topics_description.html	2018-09-13 20:19:07 +
+++ templates/pybb/feeds/topics_description.html	2019-01-18 12:08:44 +
@@ -1,6 +1,3 @@
-{% if obj.head.user.wlprofile.deleted %}
-{{ DELETED_USERNAME }}
-{% else %}
-{{ obj.head.user }}
-{% endif %}wrote:
+{% load wlprofile_extras %}
+{{ obj.head.user|user_status }} wrote:
 {{ obj.head.body_html|safe }}

=== modified file 'templates/search/includes/posts.html'
--- templates/search/includes/posts.html	2017-09-17 15:52:45 +
+++ templates/search/includes/posts.html	2019-01-18 12:08:44 +
@@ -1,7 +1,8 @@
 {% load highlight %}
 {% load custom_date %}
+{% load wlprofile_extras %}
 
-Post by {{ post.user }} @ 
+Post by {{ post.user|user_status }} @ 
  Topic {{ post.object.topic }} @ 
  Forum {{ post.object.topic.forum }},
  {{ post.date|custom_date:user }}

=== modified file 'templates/search/includes/topics.html'
--- templates/search/includes/topics.html	2017-09-17 15:52:45 +
+++ templates/search/includes/topics.html	2019-01-18 12:08:44 +
@@ -1,6 +1,7 @@
 {% load custom_date %}
+{% load wlprofile_extras %}
 
 {{ topic.name }} @  
 Forum {{ topic.object.forum }}
-by {{topic.user}},
+by {{topic.user|user_status}},
 {{topic.date|custom_date:user}}

=== modified file 'templates/search/search.html'
--- templates/search/search.html	2018-11-22 11:08:51 +
+++ templates/search/search.html	2019-01-18 12:08:44 +
@@ -24,6 +24,7 @@
 will find all forum posts containing 'tribe' but exclude all forum posts containing 'barbarian'.
 The start date won't be considered when searching the encyclopedia, maps or the wiki.
 The default is set to return results for the span of one year.
+{{ sql_queries }}
 
 
   {{ form.non_field_errors }}

=== modified file 'templates/wiki/feeds/history_description.html'
--- templates/wiki/feeds/history_description.html	2018-09-13 20:19:07 +
+++ templates/wiki/feeds/history_description.html	2019-01-18 12:08:44 +
@@ -1,9 +1,6 @@
 {% load i18n %}
+{% load wlprofile_extras %}
 
-{% trans "Edited by user" %} {% if obj.editor.wlprofile.deleted %}
-